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

Transformer doesn't transform an empty SAXSource

    XMLWordPrintable

    Details

      Description



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

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: