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

transform(File,File) prints stack trace instead of exception

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1ea2
    • CPU:
      sparc
    • OS:
      solaris_7
    • Verification:
      Verified

      Description



      Name: inR10064 Date: 11/10/2000


        JAXP 1.1 method javax.xml.transform.Transform.transform(File in, File out)
      prints stack trace instead of throwing an exception while processing
      bad input file (See sample and log below).

        Second problem - java process doesn't exit after execution the method main()
      of the sample class. Possibly some thread remains running.

      This bug presents in build jaxp-1.1ea2-b10-03_nov_2000
      and affects new test in TCK JAXP 1.1

      api/javax_xml_transform/Transform/Transform1Tests.html#transformTest003
           
      ------------------------------- transformTest003.java -------------------
      package Transform1Tests;

      import java.io.File;
      import javax.xml.transform.TransformFactory;
      import javax.xml.transform.Transform;

      class transformTest003 {
          
          public static void main(String[] args) {
              TransformFactory factory = TransformFactory.newInstance();
              Transform transform = factory.newTransform(new File("hello_world.xsl"));
              try {
                  File xmlFile = new File("parse1_invalid_doc.xml");
                  File htmlFile = new File("hello_world.html");
                  
                  if (args.length == 0)
                     transform.transform(xmlFile, htmlFile);
                  
                  System.out.println("### The method didn't throw an exception.");
              } catch (Exception e) {
                  System.out.println("### Exception: " + e);
              }
          }
      }
      ------------------------------- hello_world.xsl -------------------
      <?xml version="1.0"?>

      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      version="1.0"
      >

         <xsl:template match="root">Hello World!</xsl:template>

      </xsl:stylesheet>
      ------------------------------- parse1_invalid_doc.xml ------------------
      <?xml version="1.0"?>
      <root>
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      ___/export/home/inev/work/tmp/JAXP 263 java -classpath .:jaxp1.1/jaxp.jar:jaxp1.1/crimson.jar:jaxp1.1/xalan.jar Transform1Tests.transformTest003
      org.xml.sax.SAXParseException: End of entity not allowed; an end tag is missing.
      at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3030)
      at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3018)
      at org.apache.crimson.parser.Parser2.content(Parser2.java:1753)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1461)
      at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:499)
      at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
      at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
      at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:305)
      at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:617)
      at org.apache.xalan.jaxp.XalanTransformImpl.transform(XalanTransformImpl.java:77)
      at org.apache.xalan.jaxp.XalanTransformImpl.transform(XalanTransformImpl.java:52)
      at Transform1Tests.transformTest003.main(transformTest003.java:17)
      End of entity not allowed; an end tag is missing.
       (org.xml.sax.SAXParseException): End of entity not allowed; an end tag is missing.; SystemID: file:/export/home/inev/work/tmp/JAXP/parse1_invalid_doc.xml; Line#: 3; Column#: -1
      ### The method didn't throw an exception.
      Killed
      ---------------------------------------------------------------------------

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

      Name: inR10064 Date: 11/15/2000



        There are similar problems in method
          
      Transform.transform(InputStream,OutputStream,String)

      when it is used to transform an invalid xml document as the input stream.

      This bug presents in build jaxp-1.1ea2-b10-03_nov_2000
      and affects new test in TCK JAXP 1.1

      api/javax_xml_transform/Transform/Transform2Tests.html#transformTest004


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

        Attachments

          Activity

            People

            • Assignee:
              duke J. Duke (Inactive)
              Reporter:
              inevsunw Inev Inev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: