From c87de2b75ef28b235eb1880058c71aa47ae0f888 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 23 Apr 2007 21:13:52 +0000 Subject: [PATCH] make the name of application.xml a constant, use locale-sensitive case conversion git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@531603 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Ear.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Ear.java b/src/main/org/apache/tools/ant/taskdefs/Ear.java index ea289899e..77d7fed25 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import java.io.IOException; +import java.util.Locale; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.ZipFileSet; @@ -37,6 +39,7 @@ public class Ear extends Jar { private File deploymentDescriptor; private boolean descriptorAdded; + private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml"; /** * Create an Ear task. @@ -72,7 +75,7 @@ public class Ear extends Jar { // Create a ZipFileSet for this file, and pass it up. ZipFileSet fs = new ZipFileSet(); fs.setFile(deploymentDescriptor); - fs.setFullpath("META-INF/application.xml"); + fs.setFullpath(XML_DESCRIPTOR_PATH); super.addFileset(fs); } @@ -122,14 +125,16 @@ public class Ear extends Jar { // attribute - or if it's being added twice, meaning the same // file is specified by the "appxml" attribute and in a // element. - if (vPath.equalsIgnoreCase("META-INF/application.xml")) { - if (deploymentDescriptor == null + String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH); + if (XML_DESCRIPTOR_PATH.equals(vPathLowerCase)) { + if (deploymentDescriptor != null || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) || descriptorAdded) { log("Warning: selected " + archiveType - + " files include a META-INF/application.xml which will" + + " files include a "+ XML_DESCRIPTOR_PATH +" which will" + " be ignored (please use appxml attribute to " - + archiveType + " task)", Project.MSG_WARN); + + archiveType + " task)", + Project.MSG_WARN); } else { super.zipFile(file, zOut, vPath, mode); descriptorAdded = true;