[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17267745#comment-17267745 ] Dominik Derwiński commented on IO-695: -- {noformat} * Note: Setting preserveFileDate to {@code true} tries to preserve the file's last * modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation * will succeed. If the modification operation fails, the methods throws IOException. {noformat} Guess I'll have to settle with just corrected javadoc. But it's still an improvement, when you can't be nastily surprised by undocumented exception, right? > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17266659#comment-17266659 ] Gary D. Gregory commented on IO-695: [~morvael] Please try again with git master as the internals are now different. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17262451#comment-17262451 ] Dominik Derwiński commented on IO-695: -- I'm not sure not setting the date at all is the same as ignoring failure to set it. It's a bonus operation, that is welcome if it succeeds, but nothing dramatic happens if it doesn't. Perhaps there need to be multiple versions of the method. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17262436#comment-17262436 ] Gary D. Gregory commented on IO-695: Hi [~morvael], The copy API makes sure that the operation you asked it to perform (preserveFileDate=true) actually worked. Since failing silently is what the JRE does (no exception is thrown, instead the method returns a boolean), we validate this operation manually by throwing an IOException. As I am sure you know, most JRE IO APIs throw IOException, but for some of these very old APIs, they return a boolean instead. If you do not care about a failure when setting the file's timestamp, then do not ask for that operation to be performed in the first place by setting preserveFileDate to false. Now that the docs are fixed, we can close this ticket IMO. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17255627#comment-17255627 ] Dominik Derwiński commented on IO-695: -- That throwing the exception for this optional operation is working as designed. For me, the main operation here is copying the file. I don't need an exception if the copy operation succeeds, but setting last modified time fails. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17255619#comment-17255619 ] Gary D. Gregory commented on IO-695: [~morvael] What do you mean by WAD in this context? > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17255464#comment-17255464 ] Dominik Derwiński commented on IO-695: -- Code behaving like the Javadoc says would be better than altering the Javadoc to match how the code works. But I understand throwing exception is WAD. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-695) Exception while there should be none in copyFile
[ https://issues.apache.org/jira/browse/IO-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17252499#comment-17252499 ] Gary D. Gregory commented on IO-695: I've reworked some of the docs, please see git master for the current Javadoc. > Exception while there should be none in copyFile > > > Key: IO-695 > URL: https://issues.apache.org/jira/browse/IO-695 > Project: Commons IO > Issue Type: Bug > Components: Utilities >Affects Versions: 2.8.0 >Reporter: Dominik Derwiński >Priority: Minor > > {{public static void copyFile(final File srcFile, final File destFile, final > boolean preserveFileDate)}} java doc says: "If the modification operation > fails, no indication is provided", yet the method raises an {{IOException}} > "Failed setLastModified on ...". -- This message was sent by Atlassian Jira (v8.3.4#803005)