DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12380>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12380

TCK: Error transforming no argument DOMSource

           Summary: TCK: Error transforming no argument DOMSource
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


>From the Javadoc for the no argument DOMSource() constructor:

Zero-argument default constructor. If this is used, and no DOM source is set, 
then the Transformer will create an empty source Document using 
DocumentBuilder.newDocument().

The current implementation throws an exception instead of creating an empty 
Document. There is a similar problem with the no argument SAXSource and 
StreamSource.

Code:

import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;

public class DOMSourceTest
{
   public static void main(String[] args)
   {
        try {
            Transformer transformer = TransformerFactory.newInstance
().newTransformer();
            StreamResult result = new StreamResult(System.out);
            DOMSource source = new DOMSource();
            transformer.transform(source, result);
    
            System.out.println("Passed");
        } 
        catch (TransformerException e) {
            System.out.println("Failed: TransformerException is thrown");
        }
    }
}
=======================================================================
Expected output:
Passed

Current output:
Exception in thread "main" java.lang.IllegalArgumentException: The input node ca
n not be null for a DOMSource for newTemplates!
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:346)
        at DOMSourceTest.main(DOMSourceTest.java:13)

Reply via email to