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

Transformer doesn't transform an empty StreamSource

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b32
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Name: eaR10174 Date: 10/16/2001


        javax.xml.transform.Transformer does not transform an empty StreamSource, it throws a
      TransformerException (See test.java below).
        The javadoc description (jdk1.4.0beta-b83) of the constructor StreamSource() reads:
        
         "public StreamSource()
          ...
          If this constructor is used, and no other method is called, the Transformer assumes an
      empty input tree, with a default root node."

        This bug is found in the builds jdk1.4.0-beta3-b83, jaxp-1.1.3 and affects a new JCK1.4
      test

      api/javax_xml/transform/stream/StreamSource/index.html#Ctor[Ctor009]

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


      public class test {

          public static void main(String[] args) {
              try {
                  Transformer transformer =
                          TransformerFactory.newInstance().newTransformer();
                  StreamResult result = new StreamResult(System.out);
                  StreamSource source = new StreamSource();
                  
                  transformer.transform(source, result);
              } catch (Exception e) {
                  System.out.println(e);
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -showversion test
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b83)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b83, mixed mode)

      javax.xml.transform.TransformerException: java.lang.NullPointerException
      ---------------------------------------------------------------------------

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

      Name: inR10064 Date: 04/14/2003


      copy Description from 4515042:


      Name: eaR10174 Date: 10/16/2001


        javax.xml.transform.Transformer does not transform an empty SAXSource, it throws a
      TransformerException (See test.java below).
        The javadoc description (jdk1.4.0beta-b83) of the constructor SAXSource(InputSource)
      reads:
        
         "public SAXSource()
          ...
          If this constructor is used, and no other method is called, the Transformer assumes an
      empty input tree, with a default root node."

        This bug is found in the builds jdk1.4.0-beta3-b83, jaxp-1.1.3 and affects a new JCK1.4
      test

      api/javax_xml/transform/sax/SAXSource/index.html#Ctor[Ctor002]

      ------------------------------------test.java-----------------------------
      import javax.xml.transform.sax.SAXSource;
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.stream.StreamResult;


      public class test {

          public static void main(String[] args) {
              try {
                  Transformer transformer =
                          TransformerFactory.newInstance().newTransformer();
                  StreamResult result = new StreamResult(System.out);
                  SAXSource source = new SAXSource();
                  
                  transformer.transform(source, result);
              } catch (Exception e) {
                  System.out.println(e);
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -showversion test
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b83)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b83, mixed mode)

      javax.xml.transform.TransformerException: Cant transform a Source of type {0}
      ---------------------------------------------------------------------------


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

      Integreated the fix as part of Sept 12, 2003 JAXP integration into Tiger build 20

      ###@###.### 2003-09-12

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ayadavsunw Arun Yadav (Inactive)
              Reporter:
              evgsunw Evg Evg (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: