Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6992561

Encoding of SystemId in Locator in JDK 6

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 2.0
    • xml
    • 1.4
    • sparc
    • solaris_9
    • Verified

        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);
            }
        }

              joehw Joe Wang
              ramap Rama Pulavarthi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: