Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 93589 invoked from network); 7 Mar 2010 13:22:11 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Mar 2010 13:22:11 -0000 Received: (qmail 71424 invoked by uid 500); 7 Mar 2010 13:21:50 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 71327 invoked by uid 500); 7 Mar 2010 13:21:50 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 71316 invoked by uid 99); 7 Mar 2010 13:21:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Mar 2010 13:21:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Mar 2010 13:21:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 36518234C4B1 for ; Sun, 7 Mar 2010 13:21:27 +0000 (UTC) Message-ID: <1216961534.124961267968087221.JavaMail.jira@brutus.apache.org> Date: Sun, 7 Mar 2010 13:21:27 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (IO-157) [FileUtils] Return target File from copyFileToDirectory() In-Reply-To: <775604790.1204628920628.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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.