Browse Source

This is supposed to fix bug 17871.

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-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
f984f9775a
3 changed files with 22 additions and 3 deletions
  1. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/Ear.java
  2. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/War.java
  3. +15
    -1
      src/main/org/apache/tools/ant/util/FileUtils.java

+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -58,6 +58,7 @@ import java.io.IOException;
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;

/**
@@ -74,6 +75,7 @@ public class Ear extends Jar {

private File deploymentDescriptor;
private boolean descriptorAdded;
private static final FileUtils fu = FileUtils.newFileUtils();

/**
* Create an Ear task.
@@ -146,7 +148,7 @@ public class Ear extends Jar {
// <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"


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/War.java View File

@@ -59,6 +59,7 @@ import java.io.IOException;
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;


@@ -91,6 +92,8 @@ public class War extends Jar {
*/
private boolean descriptorAdded;

private static final FileUtils fu = FileUtils.newFileUtils();

public War() {
super();
archiveType = "war";
@@ -180,7 +183,7 @@ public class War extends Jar {
// 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 "


+ 15
- 1
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -734,7 +734,7 @@ public class FileUtils {
return false;
}

if (f1.equals(f2)) {
if (fileNameEquals(f1, f2)) {
// same filename => true
return true;
}
@@ -1001,5 +1001,19 @@ public class FileUtils {
return path;
}

/**
* Compares two filenames.
*
* <p>Unlike java.io.File#equals this method will try to compare
* the absolute paths and &quot;normalize&quot; 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()));
}

}


Loading…
Cancel
Save