JDK-6992561 : Encoding of SystemId in Locator in JDK 6
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.parsers
  • Affected Version: 2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2010-10-15
  • Updated: 2012-04-25
  • Resolved: 2011-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.0 1.4Fixed 6u32Fixed 7Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The Locator set on my ContentHandler has systemId  encoded which
causes problem in JAX-WS (wsimport) when some parts of our runtime use the systemId
originally set on the InputSource and some use from the Locator set on
the ContentHandler to resolve relative references. The original issue is reported as https://jax-ws.dev.java.net/issues/show_bug.cgi?id=861.

 Please use the test program to reproduce the issue on JDK 6 and compare it by running on JDK 5.

import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.ByteArrayInputStream;

/**
 * @author Rama Pulavarthi
 */
public class Test {

    public static void main(String[] args) throws Exception {

        ContentHandler handler = new DefaultHandler() {
            public void setDocumentLocator(Locator locator) {
                System.out.println(locator.getSystemId());
            }
        };

        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser parser = spf.newSAXParser();
        XMLReader reader = parser.getXMLReader();
        reader.setContentHandler(handler);
        String xml= "<test>abc</test>";
        ByteArrayInputStream bis =new ByteArrayInputStream(xml.getBytes());
        InputSource is = new InputSource("file:/home2/ramapulavarthi/w/bugs/jaxws861/foo~bla/test/src/wsdl/HelloTypes.xsd");
        is.setByteStream(bis);
        reader.parse(is);
    }
}

Comments
EVALUATION Patch in jaxp 1.4 now. Also filed 7012041 to track URI issue.
13-01-2011

EVALUATION The patch for 6435319 encoded original system Id in order to read paths that contain unicode characters. Since util.URI does not support unicode characters, the fix for this issue uses java.net.URI to process such paths and encodes only the copy of the original paths to avoid changing the originals.
10-01-2011

EVALUATION The encoding was added as a fix for 6435319. But I cannot find any test for 6435319. Need to add a testcase to make sure any change won't break previous fix. This issue may also be related to 6341770.
29-12-2010

EVALUATION Looks like it's encoded in com.sun.org.apache.xerces.internal.impl.XMLEntityManager private static String expandSystemIdStrictOff(String systemId, String baseSystemId) throws URI.MalformedURIException { systemId = escapeNonUSAscii(systemId); [...]
01-12-2010