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

Messages about document errors are reported to System.err during parsing

XMLWordPrintable



      Name: eaR10174 Date: 02/18/2002


        Messages about document errors are reported to System.err in case when the invalid
      document is parsed by javax.xml.parses.DocumentBuilder (see test.java below). The
      javadoc spec does not describe such behaviour.
        This bug is found in jaxp-1.2.0-beta-b06-06_feb_2002 and affects the JAXP TCK build
      because the messages get into the log file. And they confuse the release engineer.
        I think these "[Fatal Error]" messages are also unpleasant to be found in logs of
      web or app server.

        The messages are produced while running the following tests in the JAXP 1.2 TCK
      (same as in JCK Merlin):

           api/javax_xml/parsers/DocumentBuilder/index.html#Parse[Parse003]
           api/javax_xml/parsers/DocumentBuilder/index.html#Parse[Parse008]
           api/javax_xml/parsers/DocumentBuilder/index.html#Parse[Parse013]
           api/javax_xml/parsers/DocumentBuilder/index.html#Parse[Parse018]
           api/javax_xml/parsers/DocumentBuilder/index.html#Parse[Parse021]


      ------------------------------------test.java-----------------------------
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.DocumentBuilder;
      import org.xml.sax.InputSource;
      import java.io.StringReader;

      public class test {

          public static void main (String[] args) {
              String data = "<?xml version='1.0' ?>"
                          + "<root>";
              try {
                  DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance()
                      .newDocumentBuilder();
                  
                  InputSource in = new InputSource(new StringReader(data));
                  docBuilder.parse(in);
              } catch (Exception e) {
                  System.exit(0);
              }
          }
      }
      --------------------------------------------------------------------------
      % echo $CLASSPATH
      .:/home/evg/lib/dom.jar:/home/evg/lib/sax.jar:/home/evg/lib/jaxp-api.jar:/home/evg/lib
      /xalan.jar:/home/evg/lib/xercesImpl.jar

      % java -showversion test
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      [Fatal Error] :1:29: XML document structures must start and end within the same
      entity.
      ---------------------------------------------------------------------------

      ======================================================================

            duke J. Duke
            evgsunw Evg Evg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: