Attempt to download a file with & in its name causes SAXParseException in Ivy
-----------------------------------------------------------------------------

                 Key: IVY-635
                 URL: https://issues.apache.org/jira/browse/IVY-635
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.4
            Reporter: Pavel Sher
            Priority: Critical


I've created a file with name file&_.txt and tried to download it by Ivy. I get 
the following exception:

Caused by: java.text.ParseException: failed to parse report: 
C:\BuildAgent\work\.ivy\cache\org-bt79-default.xml: The reference to entity "_" 
must end with the ';' delimiter.
        at 
fr.jayasoft.ivy.xml.XmlReportParser.getArtifacts(XmlReportParser.java:150)
        at 
fr.jayasoft.ivy.xml.XmlReportParser.getArtifacts(XmlReportParser.java:141)
        at fr.jayasoft.ivy.Ivy.determineArtifactsToCopy(Ivy.java:2038)
        at fr.jayasoft.ivy.Ivy.retrieve(Ivy.java:1930)
        ... 8 more
Caused by: org.xml.sax.SAXParseException: The reference to entity "_" must end 
with the ';' delimiter.
        at 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.scanAttributeValue(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:311)
        at 
fr.jayasoft.ivy.xml.XmlReportParser$SaxXmlReportParser.parse(XmlReportParser.java:50)
        at 
fr.jayasoft.ivy.xml.XmlReportParser.getArtifacts(XmlReportParser.java:147)
        ... 11 more

Deeper investigation revealed that Ivy stores incorrect xml files in its cache. 
In particular bug is in the method XmlModuleDescriptorWriter.write() - it does 
not do any XML escaping while producing XML file. Moreover it does not check 
that there are no characters that cannot appear in XML attributes, tags and so 
on.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to