FIX: Ivy Publish Task Fails When XML Comments Exist Next to Dependency Declarations (IVY-888)

git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@691071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maarten Coene 2008-09-01 21:52:35 +00:00
parent cf0b494e4d
commit aaa2583f35
4 changed files with 61 additions and 0 deletions

View File

@ -108,6 +108,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br
- IMPROVEMENT: Add a memory cache for the module descriptor that are parsed from the cache (IVY-883)
- IMPROVEMENT: Improve performance (IVY-872)
- FIX: Ivy Publish Task Fails When XML Comments Exist Next to Dependency Declarations (IVY-888)
- FIX: Incorrect directory path resolve when running from a different directory (IVY-232)
- FIX: Ivy#listTokenValues(String, Map) does not filter returned values, and does not use maven-metadata.xml files with IBiblio resolver (IVY-886)
- FIX: Circular Dependency messages in a resolve do not reflect the configuration used during the resolve (IVY-708)

View File

@ -704,6 +704,10 @@ public final class XmlModuleDescriptorUpdater {
}
public void comment(char[] ch, int start, int length) throws SAXException {
if (justOpen != null) {
write(">");
justOpen = null;
}
if (!inHeader) {
StringBuffer comment = new StringBuffer();
comment.append(ch, start, length);

View File

@ -17,6 +17,7 @@
*/
package org.apache.ivy.plugins.parser.xml;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -78,6 +79,23 @@ public class XmlModuleUpdaterTest extends TestCase {
assertEquals(expected, updated);
}
public void testUpdateWithComments() throws Exception {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-with-comments.xml").toURL();
XmlModuleDescriptorUpdater.update(settingsUrl, new BufferedOutputStream(buffer, 1024),
getUpdateOptions("release", "mynewrev"));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
false), true);
DependencyDescriptor[] dependencies = updatedMd.getDependencies();
assertNotNull(dependencies);
assertEquals(3, dependencies.length);
}
public void testVariableReplacement() throws Exception {
/*
* For updated file to be equals to updated.xml, we have to fix the line separator to the

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
revision="1.0"
status="integration"
publication="20050913185628"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default"/>
</publications>
<dependencies>
<dependency org="myorg" name="mod1" rev="1.0" conf="*->*"/><!-- dependency 1 -->
<dependency org="test" name="mod2" rev="2.0" conf="default->default"/><!-- dependency 2 -->
<dependency org="test" name="mod3" rev="2.0" conf="default->*"><!-- dependency 3 (IVY-888) --></dependency>
</dependencies>
</ivy-module>