Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 21943 invoked from network); 29 Feb 2008 12:03:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Feb 2008 12:03:48 -0000 Received: (qmail 83414 invoked by uid 500); 29 Feb 2008 12:03:43 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 83399 invoked by uid 500); 29 Feb 2008 12:03:43 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 83390 invoked by uid 99); 29 Feb 2008 12:03:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 04:03:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 12:03:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6E5291A9832; Fri, 29 Feb 2008 04:03:27 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r632301 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/core/settings/ src/java/org/apache/ivy/plugins/parser/xml/ src/java/org/apache/ivy/util/ test/java/org/apache/ivy/core/resolve/ test/repositories/xml-entities/ test/repositories/x... Date: Fri, 29 Feb 2008 12:03:24 -0000 To: notifications@ant.apache.org From: xavier@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080229120327.6E5291A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: xavier Date: Fri Feb 29 04:03:19 2008 New Revision: 632301 URL: http://svn.apache.org/viewvc?rev=632301&view=rev Log: FIX: XML entity parsing does not work properly (IVY-737) (thanks to Patrick Woodworth) Added: ant/ivy/core/trunk/test/repositories/xml-entities/ ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt (with props) ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt (with props) ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml (with props) ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml (with props) ant/ivy/core/trunk/test/repositories/xml-entities/module1/ ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml (with props) ant/ivy/core/trunk/test/repositories/xml-entities/module2/ ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml (with props) Modified: ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=632301&r1=632300&r2=632301&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Fri Feb 29 04:03:19 2008 @@ -59,11 +59,13 @@ Jason Trump Tjeerd Verhagen John Williams + Patrick Woodworth Jaroslaw Wypychowski trunk version ===================================== - FIX: PublishEventsTest fails when Ivy sources are located in a directory with a + (IVY-755) +- FIX: XML entity parsing does not work properly (IVY-737) (thanks to Patrick Woodworth) 2.0.0-beta2 ===================================== Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=632301&r1=632300&r2=632301&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Fri Feb 29 04:03:19 2008 @@ -43,6 +43,7 @@ import org.apache.ivy.util.url.URLHandlerRegistry; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; /** @@ -96,7 +97,9 @@ InputStream stream = null; try { stream = URLHandlerRegistry.getDefault().openStream(settingsUrl); - SAXParserFactory.newInstance().newSAXParser().parse(stream, this); + InputSource inSrc = new InputSource(stream); + inSrc.setSystemId(settingsUrl.toExternalForm()); + SAXParserFactory.newInstance().newSAXParser().parse(settingsUrl.toExternalForm(), this); } catch (IOException e) { throw e; } catch (Exception e) { 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=632301&r1=632300&r2=632301&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 Fri Feb 29 04:03:19 2008 @@ -57,6 +57,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import org.xml.sax.InputSource; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; @@ -738,7 +739,10 @@ try { UpdaterHandler updaterHandler = new UpdaterHandler(settings, out, resolvedRevisions, status, revision, pubdate, ns, replaceInclude, confsToExclude, inStreamCtx); - XMLHelper.parse(in, null, updaterHandler, updaterHandler); + InputSource inSrc = new InputSource(in); + if (inStreamCtx != null) + inSrc.setSystemId(inStreamCtx.toExternalForm()); + XMLHelper.parse(inSrc, null, updaterHandler, updaterHandler); } catch (ParserConfigurationException e) { IllegalStateException ise = new IllegalStateException( "impossible to update Ivy files: parser problem"); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java?rev=632301&r1=632300&r2=632301&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java Fri Feb 29 04:03:19 2008 @@ -32,6 +32,7 @@ import org.w3c.dom.Document; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.InputSource; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; @@ -94,7 +95,9 @@ throws SAXException, IOException, ParserConfigurationException { InputStream xmlStream = URLHandlerRegistry.getDefault().openStream(xmlURL); try { - parse(xmlStream, schema, handler, lHandler); + InputSource inSrc = new InputSource(xmlStream); + inSrc.setSystemId(xmlURL.toExternalForm()); + parse(inSrc, schema, handler, lHandler); } finally { try { xmlStream.close(); @@ -106,6 +109,12 @@ public static void parse( InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) + throws SAXException, IOException, ParserConfigurationException { + parse(new InputSource(xmlStream), schema, handler, lHandler ); + } + + public static void parse( + InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) throws SAXException, IOException, ParserConfigurationException { InputStream schemaStream = null; try { Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=632301&r1=632300&r2=632301&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Fri Feb 29 04:03:19 2008 @@ -235,6 +235,21 @@ assertTrue(report.hasError()); } + public void testResolveWithXmlEntities() throws Exception { + Ivy ivy = new Ivy(); + Throwable th = null; + try { + ivy.configure(new File("test/repositories/xml-entities/ivysettings.xml").toURL()); + ResolveReport report = ivy.resolve(new File("test/repositories/xml-entities/ivy.xml").toURL(), + getResolveOptions(new String[] {"*"})); + assertNotNull(report); + assertFalse(report.hasError()); + } catch(Throwable e) { + th = e; + } + assertNull(th); + } + public void testResolveNoRevisionInPattern() throws Exception { // module1 depends on latest version of module2, for which there is no revision in the // pattern Added: ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt Fri Feb 29 04:03:19 2008 @@ -0,0 +1 @@ + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/bar.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt Fri Feb 29 04:03:19 2008 @@ -0,0 +1,3 @@ + + + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/foo.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml Fri Feb 29 04:03:19 2008 @@ -0,0 +1,29 @@ + + +]> + + + + + + + &foo; + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/ivy.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml Fri Feb 29 04:03:19 2008 @@ -0,0 +1,33 @@ + + +]> + + &bar; + + + + + + + + + + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/ivysettings.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml Fri Feb 29 04:03:19 2008 @@ -0,0 +1,25 @@ + + + + + + + + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/module1/ivy-1.0.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml?rev=632301&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml (added) +++ ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml Fri Feb 29 04:03:19 2008 @@ -0,0 +1,28 @@ + + + + + + + + + + + Propchange: ant/ivy/core/trunk/test/repositories/xml-entities/module2/ivy-2.0.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain