bodewig 2003/03/13 08:22:14
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH Ear.java War.java src/main/org/apache/tools/ant/util Tag: ANT_15_BRANCH FileUtils.java Log: Merge fix for bug 17871 from HEAD Revision Changes Path No revision No revision 1.15.2.5 +4 -2 ant/src/main/org/apache/tools/ant/taskdefs/Ear.java Index: Ear.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Ear.java,v retrieving revision 1.15.2.4 retrieving revision 1.15.2.5 diff -u -r1.15.2.4 -r1.15.2.5 --- Ear.java 19 Feb 2003 08:13:59 -0000 1.15.2.4 +++ Ear.java 13 Mar 2003 16:22:13 -0000 1.15.2.5 @@ -56,6 +56,7 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; +import org.apache.tools.ant.util.FileUtils; import org.apache.tools.zip.ZipOutputStream; import java.io.File; @@ -64,7 +65,7 @@ /** * Creates a EAR archive. Based on WAR task * - * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a> + * @author Stefan Bodewig * @author <a href="mailto:[EMAIL PROTECTED]">Les Hughes</a> * * @since Ant 1.4 @@ -75,6 +76,7 @@ private File deploymentDescriptor; private boolean descriptorAdded; + private static final FileUtils fu = FileUtils.newFileUtils(); /** * Create an Ear task. @@ -147,7 +149,7 @@ // <fileset> element. if (vPath.equalsIgnoreCase("META-INF/application.xml")) { if (deploymentDescriptor == null - || !deploymentDescriptor.equals(file) + || !fu.fileNameEquals(deploymentDescriptor, file) || descriptorAdded) { log("Warning: selected " + archiveType + " files include a META-INF/application.xml which will" 1.23.2.6 +5 -2 ant/src/main/org/apache/tools/ant/taskdefs/War.java Index: War.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/War.java,v retrieving revision 1.23.2.5 retrieving revision 1.23.2.6 diff -u -r1.23.2.5 -r1.23.2.6 --- War.java 19 Feb 2003 08:13:59 -0000 1.23.2.5 +++ War.java 13 Mar 2003 16:22:13 -0000 1.23.2.6 @@ -57,6 +57,7 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; +import org.apache.tools.ant.util.FileUtils; import org.apache.tools.zip.ZipOutputStream; import java.io.File; @@ -73,7 +74,7 @@ * attributes of zipfilesets in a Zip or Jar task.)</p> * <p>The extended zipfileset element from the zip task (with attributes <i>prefix</i>, <i>fullpath</i>, and <i>src</i>) is available in the War task.</p> * - * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a> + * @author Stefan Bodewig * * @since Ant 1.2 * @@ -92,6 +93,8 @@ */ private boolean descriptorAdded; + private static final FileUtils fu = FileUtils.newFileUtils(); + public War() { super(); archiveType = "war"; @@ -181,7 +184,7 @@ // by the "webxml" attribute and in a <fileset> element. if (vPath.equalsIgnoreCase("WEB-INF/web.xml")) { if (deploymentDescriptor == null - || !deploymentDescriptor.equals(file) + || !fu.fileNameEquals(deploymentDescriptor, file) || descriptorAdded) { log("Warning: selected " + archiveType + " files include a WEB-INF/web.xml which will be ignored " No revision No revision 1.25.2.8 +16 -1 ant/src/main/org/apache/tools/ant/util/FileUtils.java Index: FileUtils.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v retrieving revision 1.25.2.7 retrieving revision 1.25.2.8 diff -u -r1.25.2.7 -r1.25.2.8 --- FileUtils.java 10 Feb 2003 14:25:24 -0000 1.25.2.7 +++ FileUtils.java 13 Mar 2003 16:22:14 -0000 1.25.2.8 @@ -878,5 +878,20 @@ return p; } } + + /** + * Compares two filenames. + * + * <p>Unlike java.io.File#equals this method will try to compare + * the absolute paths and "normalize" the filenames + * before comparing them.</p> + * + * @since Ant 1.5.3 + */ + public boolean fileNameEquals(File f1, File f2) { + return normalize(f1.getAbsolutePath()) + .equals(normalize(f2.getAbsolutePath())); + } + }