[
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:
[email protected]
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)