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

Transformer.transform() throws java.lang.ExceptionInInitializerError

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1b18
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: inR10064 Date: 12/26/2000



        The implementation of the method javax.xml.transform.Transformer.transform(Source source, Result result)
      throws java.lang.ExceptionInInitializerError if the ouput property 'method' is set to 'html' (See test.java
      below).

        This bug is found in the build jaxp-1.1ea2-b15-20_dec_2000.

      ------------------------------------test.java-----------------------------
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.stream.StreamSource;
      import javax.xml.transform.stream.StreamResult;
      import javax.xml.transform.OutputKeys;

      import java.util.Properties;
      import java.io.ByteArrayInputStream;

      public class test {
          
          public static void main(String argv[]) {
              
              String xmlData =
                  "<?xml version=\"1.0\"?>" +
                  "<root/>";
              try {
                  TransformerFactory tfactory = TransformerFactory.newInstance();

                  Transformer transformer = tfactory.newTransformer();
               
                  transformer.setOutputProperty(OutputKeys.METHOD, "html");
                  
                  byte[] data = xmlData.getBytes();
                  ByteArrayInputStream in = new ByteArrayInputStream(data);
                  
                  StreamSource source = new StreamSource(in);
                  StreamResult result = new StreamResult(System.out);
                             
                  transformer.transform(source, result);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -showversion -cp
      .:jaxp-1.1ea2-b15-18_dec_2000/jaxp.jar:jaxp-1.1ea2-b15-18_dec_2000/crimson.jar:jaxp-1.1ea2-b15-18_dec_2000/
      xalan.jar test
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      <root>
      </root>

      % java -showversion -cp
      .:jaxp-1.1ea2-b15-20_dec_2000/jaxp.jar:jaxp-1.1ea2-b15-20_dec_2000/crimson.jar:jaxp-1.1ea2-b15-20_dec_2000/
      xalan.jar test
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.RuntimeException: The resource
      [HTMLEntities.res] could not load: java.net.MalformedURLException: no protocol: HTMLEntities.res
      HTMLEntities.res java.net.MalformedURLException: no protocol: HTMLEntities.res
              at org.apache.xalan.serialize.CharInfo.<init>(CharInfo.java:179)
              at org.apache.xalan.serialize.FormatterToHTML.<clinit>(FormatterToHTML.java:102)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:120)
              at org.apache.xalan.serialize.SerializerFactory.getSerializer(SerializerFactory.java:127)
              at
      org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:985)
              at
      org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:922)
              at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1035)
              at test.main(test.java:30)
      ---------------------------------------------------------------------------

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

        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: