The patch looks innocent enough for me to merge it into the 1.5 branch right away, but I cannot really verify it fixes the bug because of my persistent (and self-imposed) lack of a Windows system. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274248 13f79535-47bb-0310-9956-ffa450edef68master
@@ -58,6 +58,7 @@ import java.io.IOException; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
import org.apache.tools.ant.util.FileUtils; | |||||
import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
/** | /** | ||||
@@ -74,6 +75,7 @@ public class Ear extends Jar { | |||||
private File deploymentDescriptor; | private File deploymentDescriptor; | ||||
private boolean descriptorAdded; | private boolean descriptorAdded; | ||||
private static final FileUtils fu = FileUtils.newFileUtils(); | |||||
/** | /** | ||||
* Create an Ear task. | * Create an Ear task. | ||||
@@ -146,7 +148,7 @@ public class Ear extends Jar { | |||||
// <fileset> element. | // <fileset> element. | ||||
if (vPath.equalsIgnoreCase("META-INF/application.xml")) { | if (vPath.equalsIgnoreCase("META-INF/application.xml")) { | ||||
if (deploymentDescriptor == null | if (deploymentDescriptor == null | ||||
|| !deploymentDescriptor.equals(file) | |||||
|| !fu.fileNameEquals(deploymentDescriptor, file) | |||||
|| descriptorAdded) { | || descriptorAdded) { | ||||
log("Warning: selected " + archiveType | log("Warning: selected " + archiveType | ||||
+ " files include a META-INF/application.xml which will" | + " files include a META-INF/application.xml which will" | ||||
@@ -59,6 +59,7 @@ import java.io.IOException; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.types.ZipFileSet; | import org.apache.tools.ant.types.ZipFileSet; | ||||
import org.apache.tools.ant.util.FileUtils; | |||||
import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
@@ -91,6 +92,8 @@ public class War extends Jar { | |||||
*/ | */ | ||||
private boolean descriptorAdded; | private boolean descriptorAdded; | ||||
private static final FileUtils fu = FileUtils.newFileUtils(); | |||||
public War() { | public War() { | ||||
super(); | super(); | ||||
archiveType = "war"; | archiveType = "war"; | ||||
@@ -180,7 +183,7 @@ public class War extends Jar { | |||||
// by the "webxml" attribute and in a <fileset> element. | // by the "webxml" attribute and in a <fileset> element. | ||||
if (vPath.equalsIgnoreCase("WEB-INF/web.xml")) { | if (vPath.equalsIgnoreCase("WEB-INF/web.xml")) { | ||||
if (deploymentDescriptor == null | if (deploymentDescriptor == null | ||||
|| !deploymentDescriptor.equals(file) | |||||
|| !fu.fileNameEquals(deploymentDescriptor, file) | |||||
|| descriptorAdded) { | || descriptorAdded) { | ||||
log("Warning: selected " + archiveType | log("Warning: selected " + archiveType | ||||
+ " files include a WEB-INF/web.xml which will be ignored " | + " files include a WEB-INF/web.xml which will be ignored " | ||||
@@ -734,7 +734,7 @@ public class FileUtils { | |||||
return false; | return false; | ||||
} | } | ||||
if (f1.equals(f2)) { | |||||
if (fileNameEquals(f1, f2)) { | |||||
// same filename => true | // same filename => true | ||||
return true; | return true; | ||||
} | } | ||||
@@ -1001,5 +1001,19 @@ public class FileUtils { | |||||
return path; | return path; | ||||
} | } | ||||
/** | |||||
* 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.2 | |||||
*/ | |||||
public boolean fileNameEquals(File f1, File f2) { | |||||
return normalize(f1.getAbsolutePath()) | |||||
.equals(normalize(f2.getAbsolutePath())); | |||||
} | |||||
} | } | ||||