You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/09/06 22:24:46 UTC

DO NOT REPLY [Bug 12379] New: - TCK: Transformer.setOutputProperties() should throw IllegalArgumentException

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=12379>.
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=12379

TCK: Transformer.setOutputProperties() should throw IllegalArgumentException

           Summary: TCK: Transformer.setOutputProperties() should throw
                    IllegalArgumentException
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: mkwan@ca.ibm.com


The Javadoc for Transformer.setOutputProperties() says that it should throw an 
IllegalArgumentException if any of the argument keys are not recognized and are 
not namespace qualified. The current implementation in 
org.apache.xalan.transformer.TransformerImpl does not throw any exception.

Demonstration code:

import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.util.*;
import java.io.*;

public class SetOutputPropertiesTest
{
   private static String XSL1 =  "<?xml version='1.0'?>"
                       + "<xsl:stylesheet"
                       + " version='1.0'"
                       + " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>\n"
                       + "   <xsl:template match='/'>\n"
                       + "     Hello World! \n"
                       + "   </xsl:template>\n"
                       + "</xsl:stylesheet>";
                               
   public static void main(String[] args)
   {
        StreamSource source = new StreamSource(new StringReader(XSL1));
        
        try {
         Transformer transformer = TransformerFactory.newInstance
().newTransformer(source);
        
         Properties properties = new Properties();
         properties.setProperty("xyz", "123");
         transformer.setOutputProperties(properties);
         
         System.out.println("Error: IllegalArgumentException not thrown"); 
        }
        catch (IllegalArgumentException e) {
         System.out.println("OK: IllegalArgumentException is thrown"); 
        }
        catch (TransformerException e) {
		 System.out.println("Error: TransformerException is thrown");
		}
    }
}

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

Expected output:
OK: IllegalArgumentException is thrown

Current output:
Error: IllegalArgumentException not thrown