Author: bodewig Date: Wed Feb 10 12:09:08 2010 New Revision: 908464 URL: http://svn.apache.org/viewvc?rev=908464&view=rev Log: fix regression in <ear> that would allow multiple application.xml files. PR 6836
Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java ant/core/trunk/src/tests/antunit/taskdefs/ear-test.xml Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=908464&r1=908463&r2=908464&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Wed Feb 10 12:09:08 2010 @@ -18,6 +18,10 @@ the first one. Bugzilla Report 48715. + * Regression: The <ear> task would allow multiple + META-INF/application.xml files to be added. + Bugzilla Report 6836. + Other changes: -------------- Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java?rev=908464&r1=908463&r2=908464&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java Wed Feb 10 12:09:08 2010 @@ -40,6 +40,8 @@ private File deploymentDescriptor; private boolean descriptorAdded; private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml"; + private static final String XML_DESCRIPTOR_PATH_LC = + XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH); /** * Create an Ear task. @@ -126,8 +128,8 @@ // file is specified by the "appxml" attribute and in a // <fileset> element. String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH); - if (XML_DESCRIPTOR_PATH.equals(vPathLowerCase)) { - if (deploymentDescriptor != null + if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) { + if (deploymentDescriptor == null || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) || descriptorAdded) { logWhenWriting("Warning: selected " + archiveType Modified: ant/core/trunk/src/tests/antunit/taskdefs/ear-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/ear-test.xml?rev=908464&r1=908463&r2=908464&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/ear-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/ear-test.xml Wed Feb 10 12:09:08 2010 @@ -26,5 +26,6 @@ <ear destfile="${output}/test.ear" appxml="${input}/x.xml"> <fileset dir="${input}"/> </ear> + <au:assertLogContains text="Warning: selected ear files include a META-INF/application.xml which will be ignored (please use appxml attribute to ear task)"/> </target> </project>