[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-06-14 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=610546&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-610546
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 14/Jun/21 08:04
Start Date: 14/Jun/21 08:04
Worklog Time Spent: 10m 
  Work Description: boris-unckel closed pull request #196:
URL: https://github.com/apache/commons-io/pull/196


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 610546)
Time Spent: 1.5h  (was: 1h 20m)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-06-07 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=607848&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-607848
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 07/Jun/21 13:28
Start Date: 07/Jun/21 13:28
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #196:
URL: https://github.com/apache/commons-io/pull/196#issuecomment-855929320


   @boris-unckel 
   May you please rebase on master?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 607848)
Time Spent: 1h 20m  (was: 1h 10m)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=544641&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544641
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 30/Jan/21 03:09
Start Date: 30/Jan/21 03:09
Worklog Time Spent: 10m 
  Work Description: coveralls commented on pull request #196:
URL: https://github.com/apache/commons-io/pull/196#issuecomment-770146131


   
   [![Coverage 
Status](https://coveralls.io/builds/36715560/badge)](https://coveralls.io/builds/36715560)
   
   Coverage increased (+0.1%) to 89.121% when pulling 
**cb1751782b038c10b4219fa5208cfeccfc627634 on 
boris-unckel:utilize_objects_requirenotnull** into 
**8665a70d1ea00939d12c7a22ff6c8a8124924acd on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 544641)
Time Spent: 1h 10m  (was: 1h)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=544308&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544308
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 29/Jan/21 15:25
Start Date: 29/Jan/21 15:25
Worklog Time Spent: 10m 
  Work Description: boris-unckel commented on pull request #196:
URL: https://github.com/apache/commons-io/pull/196#issuecomment-769871226


   @garydgregory 
   - Fixed the formatting (is there a official eclipse configuration you can 
recommend?)
   - Removed single parameter checks in case of direct usage, 
   - Kept single parameter checks when prior (different) Object creation 
happens (see case above)
   - Kept multiple parameter checks
   - Removed double checks in constructors, even if objects are created
   - Kept all checks in constructors, where fail will be in post constructor 
usage of methods



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 544308)
Time Spent: 1h  (was: 50m)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=544287&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544287
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 29/Jan/21 14:38
Start Date: 29/Jan/21 14:38
Worklog Time Spent: 10m 
  Work Description: boris-unckel commented on a change in pull request #196:
URL: https://github.com/apache/commons-io/pull/196#discussion_r566852479



##
File path: src/main/java/org/apache/commons/io/FileUtils.java
##
@@ -866,6 +868,8 @@ public static void copyFile(final File srcFile, final File 
destFile, final CopyO
  * @since 2.1
  */
 public static long copyFile(final File input, final OutputStream output) 
throws IOException {
+Objects.requireNonNull(input, "input");
+Objects.requireNonNull(output, "output");

Review comment:
   @garydgregory The other cases before I understood the pattern behind 
"-1". In this case a FileInputStream is created, afterwards copyLarge calls 
copy calls copyLarge which then does the check.
   I'll fix the former cases and wait with removal for cases like this on your 
comment.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 544287)
Time Spent: 50m  (was: 40m)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=543884&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-543884
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 28/Jan/21 21:10
Start Date: 28/Jan/21 21:10
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #196:
URL: https://github.com/apache/commons-io/pull/196#issuecomment-769397122


   > @garydgregory Please review and mark the cases you don't want to change 
for compatibility and/or design reasons. I'll change then all occurrences 
accordingly.
   
   Hi @boris-unckel 
   
   Sorry but I don't want to take the time to review each change in each of 31 
files. If you do not want to revise the PR to minimize changes and duplication 
of null checks, that's fine as well. I might get to these kinds of changes 
later. Thank you for your contributions so far though :-)



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 543884)
Time Spent: 40m  (was: 0.5h)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=543855&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-543855
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 28/Jan/21 20:12
Start Date: 28/Jan/21 20:12
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on a change in pull request #196:
URL: https://github.com/apache/commons-io/pull/196#discussion_r566371592



##
File path: src/main/java/org/apache/commons/io/FileDeleteStrategy.java
##
@@ -144,6 +147,7 @@ public boolean deleteQuietly(final File fileToDelete) {
  * @throws IOException if an error occurs during file deletion
  */
 protected boolean doDelete(final File file) throws IOException {
+Objects.requireNonNull(file,"file");

Review comment:
   Fix formatting.
   

##
File path: src/main/java/org/apache/commons/io/FileSystemUtils.java
##
@@ -271,9 +272,8 @@ public static long freeSpaceKb(final long timeout) throws 
IOException {
  * @throws IOException if an error occurs when finding the free space
  */
 long freeSpaceOS(final String path, final int os, final boolean kb, final 
long timeout) throws IOException {
-if (path == null) {
-throw new IllegalArgumentException("Path must not be null");
-}
+Objects.requireNonNull(path,"path");

Review comment:
   Fix formatting.

##
File path: src/main/java/org/apache/commons/io/FileSystemUtils.java
##
@@ -396,6 +396,7 @@ long parseDir(final String line, final String path) throws 
IOException {
  */
 long freeSpaceUnix(final String path, final boolean kb, final boolean 
posix, final long timeout)
 throws IOException {
+Objects.requireNonNull(path,"path");

Review comment:
   Fix formatting.

##
File path: src/main/java/org/apache/commons/io/FileUtils.java
##
@@ -340,6 +341,7 @@ public static void cleanDirectory(final File directory) 
throws IOException {
  * @see #forceDeleteOnExit(File)
  */
 private static void cleanDirectoryOnExit(final File directory) throws 
IOException {
+Objects.requireNonNull(directory, "directory");

Review comment:
   -1: no need, already done on the next line in `listFiles`.

##
File path: src/main/java/org/apache/commons/io/FilenameUtils.java
##
@@ -1510,6 +1510,9 @@ public static boolean wildcardMatch(final String 
fileName, final String wildcard
  * @return true if the given name is a valid host name
  */
 private static boolean isValidHostName(final String name) {
+if(Objects.isNull(name)) {

Review comment:
   Fix formatting and no need to call an API meant for use in lambdas when 
`name == null` would do.
   

##
File path: 
src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
##
@@ -200,12 +201,9 @@ public FileAlterationObserver(final File directory, final 
FileFilter fileFilter,
  */
 protected FileAlterationObserver(final FileEntry rootEntry, final 
FileFilter fileFilter,
  final IOCase caseSensitivity) {
-if (rootEntry == null) {
-throw new IllegalArgumentException("Root entry is missing");
-}
-if (rootEntry.getFile() == null) {
-throw new IllegalArgumentException("Root directory is missing");
-}
+Objects.requireNonNull(rootEntry, "rootEntry");
+Objects.requireNonNull(rootEntry.getFile(),"rootDirectory");

Review comment:
   Fix formatting.
   

##
File path: src/main/java/org/apache/commons/io/FileUtils.java
##
@@ -866,6 +868,8 @@ public static void copyFile(final File srcFile, final File 
destFile, final CopyO
  * @since 2.1
  */
 public static long copyFile(final File input, final OutputStream output) 
throws IOException {
+Objects.requireNonNull(input, "input");
+Objects.requireNonNull(output, "output");

Review comment:
   -1: no need to check on `output`, this already done in `copyLarge`.
   
   I'll stop this type of comment since these checks over the top in this PR. 
IOW, let's not check for NPEs when we do not need to.
   

##
File path: src/main/java/org/apache/commons/io/FileUtils.java
##
@@ -314,6 +314,7 @@ public static long checksumCRC32(final File file) throws 
IOException {
  * @see #forceDelete(File)
  */
 public static void cleanDirectory(final File directory) throws IOException 
{
+Objects.requireNonNull(directory, "directory");

Review comment:
   -1: no need, already done on the next line in `listFiles`.

##
File path: src/main/java/org/apache/commons/io/FileUtils.java
##
@@ -1200,6 +1210,7 @@ public static void deleteDirectory(final File directory) 
throws IOException {
  * @thr

[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=543756&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-543756
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 28/Jan/21 17:16
Start Date: 28/Jan/21 17:16
Worklog Time Spent: 10m 
  Work Description: boris-unckel commented on pull request #196:
URL: https://github.com/apache/commons-io/pull/196#issuecomment-769239872


   @garydgregory Please review and mark the cases you don't want to change for 
compatibility and/or design reasons. I'll change then all occurrences 
accordingly.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 543756)
Time Spent: 20m  (was: 10m)

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (IO-711) Use Objects.requireNotNull for fail fast method/constructors

2021-01-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/IO-711?focusedWorklogId=543755&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-543755
 ]

ASF GitHub Bot logged work on IO-711:
-

Author: ASF GitHub Bot
Created on: 28/Jan/21 17:14
Start Date: 28/Jan/21 17:14
Worklog Time Spent: 10m 
  Work Description: boris-unckel opened a new pull request #196:
URL: https://github.com/apache/commons-io/pull/196


   Fixes https://issues.apache.org/jira/browse/IO-711



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 543755)
Remaining Estimate: 0h
Time Spent: 10m

> Use Objects.requireNotNull for fail fast method/constructors
> 
>
> Key: IO-711
> URL: https://issues.apache.org/jira/browse/IO-711
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Filters, Streams/Writers, Utilities
>Affects Versions: 2.8.0
>Reporter: Boris Unckel
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently some NullPointer checks are IllegalArgumentException, at other 
> points a lot of constructor and/or method logic happens before a null pointer 
> occurs.
> The approach is to make these places use 
> Objects.requireNonNull(sampleObject,"sampleObject");
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)