You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Kenny MacLeod (JIRA)" <ji...@apache.org> on 2008/03/04 12:08:40 UTC
[jira] Created: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
[FileUtils] Return target File from copyFileToDirectory()
---------------------------------------------------------
Key: IO-157
URL: https://issues.apache.org/jira/browse/IO-157
Project: Commons IO
Issue Type: Improvement
Components: Utilities
Affects Versions: 1.4
Reporter: Kenny MacLeod
Priority: Minor
It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842404#action_12842404 ]
Niall Pemberton commented on IO-157:
------------------------------------
I also don't see how changing a return type from "void" to return something is going to ever break compatibility for someone. However nothing has changed since Stephens comment - we were already on Java 1.5 then and I don't see how upgrading to Java 1.5 makes any difference to this.
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Reopened: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb reopened IO-157:
---------------------
Assignee: (was: Niall Pemberton)
Reverted:
URL: http://svn.apache.org/viewvc?rev=919995&view=rev
Log:
Revert r919684 - not binary compatible
Modified:
commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved IO-157.
---------------------
Resolution: Fixed
Reapplied.
Binary incompatibility (if it was) is no longer a problem given that IO now needs Java 1.5
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797442#action_12797442 ]
Sebb commented on IO-157:
-------------------------
Not sure I understand why changing a method to return File rather than void can break binary compatibility.
Any existing code that uses the void method will still work; the return value will just be ignored.
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (IO-157) [FileUtils] Return target
File from copyFileToDirectory()
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842404#action_12842404 ]
Niall Pemberton edited comment on IO-157 at 3/7/10 11:13 AM:
-------------------------------------------------------------
I also don't see how changing a return type from "void" to return something is going to ever break compatibility for someone. However nothing has changed since Stephens comment - we were already on Java 1.5 then and I don't see how upgrading to Java 1.5 means binary incompatibility is no longer a problem?
was (Author: niallp):
I also don't see how changing a return type from "void" to return something is going to ever break compatibility for someone. However nothing has changed since Stephens comment - we were already on Java 1.5 then and I don't see how upgrading to Java 1.5 makes any difference to this.
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12673697#action_12673697 ]
Niall Pemberton commented on IO-157:
------------------------------------
OK I reverted this:
http://svn.apache.org/viewvc?view=rev&revision=744725
Mailing list discussion is here:
http://commons.markmail.org/message/sfnp6cp6vl6k5okf
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton resolved IO-157.
--------------------------------
Resolution: Fixed
Fix Version/s: 2.0
Assignee: Niall Pemberton
Fixed http://svn.apache.org/viewvc?view=rev&revision=661658
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842425#action_12842425 ]
Sebb commented on IO-157:
-------------------------
Sometimes what is obvious is not true ;-)
I decided to to test IO 2.0 with the test cases from IO 1.4.
Create the jars:
- mvn jar:test-jar in IO 1.4
- mvn jar:jar in IO 2.0
Then use JUnit command-line mode:
{code}
set CLASSPATH=junit-3.8.2.jar;commons-io-1.4-tests.jar;commons-io-2.0-SNAPSHOT.jar
java junit.textui.TestRunner org.apache.commons.io.FileUtilsTestCase
....
There were 2 errors:
1) testCopyFile1ToDir(org.apache.commons.io.FileUtilsTestCase)java.lang.NoSuchMethodError:
org.apache.commons.io.FileUtils.copyFileToDirectory(Ljava/io/File;Ljava/io/File;)V
at org.apache.commons.io.FileUtilsTestCase.testCopyFile1ToDir(FileUtilsTestCase.java:881)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2) testCopyFile2ToDir(org.apache.commons.io.FileUtilsTestCase)java.lang.NoSuchMethodError:
org.apache.commons.io.FileUtils.copyFileToDirectory(Ljava/io/File;Ljava/io/File;)V
at org.apache.commons.io.FileUtilsTestCase.testCopyFile2ToDir(FileUtilsTestCase.java:906)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
{code}
Oops!
The return type IS part of the signature that the JVM looks for when resolving method calls.
So the jar is clearly not a drop-in replacement for IO 1.4
Note: the same test ran fine with commons-io-1.4.jar (as expected).
However, the suggestion still has merit.
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Reopened: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting reopened IO-157:
------------------------------
Reopening, as this change breaks binary compatibility with IO 1.4.
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Assignee: Niall Pemberton
> Priority: Minor
> Fix For: 2.0
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (IO-157) [FileUtils] Return target File from
copyFileToDirectory()
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/IO-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton updated IO-157:
-------------------------------
Fix Version/s: 2.x
(was: 2.0)
Re-consider this if/when we break compatibility
> [FileUtils] Return target File from copyFileToDirectory()
> ---------------------------------------------------------
>
> Key: IO-157
> URL: https://issues.apache.org/jira/browse/IO-157
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.4
> Reporter: Kenny MacLeod
> Priority: Minor
> Fix For: 2.x
>
>
> It would be useful if the FileUtils.copyFileToDirectory() method returned the target file to which it does the copy. Currently, it creates the target File object, passes it to copyFile(), and discards the reference. This could just be returned from the method instead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.