Browse Source

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
master
Steve Loughran 18 years ago
parent
commit
c87de2b75e
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      src/main/org/apache/tools/ant/taskdefs/Ear.java

+ 10
- 5
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Locale;

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;
@@ -37,6 +39,7 @@ public class Ear extends Jar {


private File deploymentDescriptor; private File deploymentDescriptor;
private boolean descriptorAdded; private boolean descriptorAdded;
private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml";


/** /**
* Create an Ear task. * Create an Ear task.
@@ -72,7 +75,7 @@ public class Ear extends Jar {
// Create a ZipFileSet for this file, and pass it up. // Create a ZipFileSet for this file, and pass it up.
ZipFileSet fs = new ZipFileSet(); ZipFileSet fs = new ZipFileSet();
fs.setFile(deploymentDescriptor); fs.setFile(deploymentDescriptor);
fs.setFullpath("META-INF/application.xml");
fs.setFullpath(XML_DESCRIPTOR_PATH);
super.addFileset(fs); super.addFileset(fs);
} }


@@ -122,14 +125,16 @@ public class Ear extends Jar {
// attribute - or if it's being added twice, meaning the same // attribute - or if it's being added twice, meaning the same
// file is specified by the "appxml" attribute and in a // file is specified by the "appxml" attribute and in a
// <fileset> element. // <fileset> 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) || !FILE_UTILS.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 "+ XML_DESCRIPTOR_PATH +" which will"
+ " be ignored (please use appxml attribute to " + " be ignored (please use appxml attribute to "
+ archiveType + " task)", Project.MSG_WARN);
+ archiveType + " task)",
Project.MSG_WARN);
} else { } else {
super.zipFile(file, zOut, vPath, mode); super.zipFile(file, zOut, vPath, mode);
descriptorAdded = true; descriptorAdded = true;


Loading…
Cancel
Save