ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r693732 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
Date Wed, 10 Sep 2008 08:08:24 GMT
Author: bodewig
Date: Wed Sep 10 01:08:23 2008
New Revision: 693732

URL: http://svn.apache.org/viewvc?rev=693732&view=rev
Log:
remove duplicate code

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java?rev=693732&r1=693731&r2=693732&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java Wed Sep 10 01:08:23 2008
@@ -32,6 +32,7 @@
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.GlobPatternMapper;
 import org.apache.tools.ant.util.JavaEnvUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
@@ -89,6 +90,8 @@
     private static final String PACKAGE_INFO_JAVA = "package-info.java";
     private static final String PACKAGE_INFO_CLASS = "package-info.class";
 
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+
     private Path src;
     private File destDir;
     private Path compileClasspath;
@@ -1148,7 +1151,7 @@
             return true;
         }
         // return true if destDir contains the file
-        String rel = relativePath(srcDir, file);
+        String rel = FILE_UTILS.removeLeadingPath(srcDir, file);
         File destFile = new File(destDir, rel);
         File parent = destFile.getParentFile();
         destFile = new File(parent, PACKAGE_INFO_CLASS);
@@ -1167,8 +1170,4 @@
         return false;
     }
 
-    private String relativePath(File src, File file) {
-        return file.getAbsolutePath().substring(
-            src.getAbsolutePath().length() + 1);
-    }
 }



Mime
View raw message