Author: maartenc Date: Mon Sep 1 14:52:35 2008 New Revision: 691071 URL: http://svn.apache.org/viewvc?rev=691071&view=rev Log: FIX: Ivy Publish Task Fails When XML Comments Exist Next to Dependency Declarations (IVY-888)
Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml Modified: ant/ivy/core/trunk/ (props changed) ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java Propchange: ant/ivy/core/trunk/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Mon Sep 1 14:52:35 2008 @@ -1,4 +1,5 @@ -.classpath -build -lib -bin +.classpath +build +lib +bin +nbproject Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=691071&r1=691070&r2=691071&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Mon Sep 1 14:52:35 2008 @@ -108,6 +108,7 @@ - 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) Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=691071&r1=691070&r2=691071&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Mon Sep 1 14:52:35 2008 @@ -704,6 +704,10 @@ } 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); Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java?rev=691071&r1=691070&r2=691071&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java Mon Sep 1 14:52:35 2008 @@ -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 @@ 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 Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml?rev=691071&view=auto ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml (added) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml Mon Sep 1 14:52:35 2008 @@ -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>