You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mk...@apache.org on 2005/05/31 17:12:59 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax SmartTransformerFactoryImpl.java TransformerFactoryImpl.java

mkwan       2005/05/31 08:12:59

  Modified:    java/src/org/apache/xalan Version.java
               java/src/org/apache/xalan/processor
                        TransformerFactoryImpl.java
               java/src/org/apache/xalan/res XSLTErrorResources.java
               java/src/org/apache/xalan/xsltc/compiler/util
                        ErrorMessages.java ErrorMsg.java
               java/src/org/apache/xalan/xsltc/trax
                        SmartTransformerFactoryImpl.java
                        TransformerFactoryImpl.java
  Log:
  Patch for XALANJ-2123.
  Move hard-coded messages for JAXP 1.3 into resource bundles.
  
  Revision  Changes    Path
  1.17      +0 -0      xml-xalan/java/src/org/apache/xalan/Version.java
  
  
  
  
  1.60      +10 -12    xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- TransformerFactoryImpl.java	17 May 2005 17:22:14 -0000	1.59
  +++ TransformerFactoryImpl.java	31 May 2005 15:12:59 -0000	1.60
  @@ -386,10 +386,9 @@
   
   	// feature name cannot be null
   	if (name == null) {
  -		throw new NullPointerException(
  -			"Trying to set a feature with a null name: "
  -			+ CLASS_NAME + "#setFeature(null, " + value + ")"
  -			);
  +	    throw new NullPointerException(
  +                XSLMessages.createMessage(
  +                    XSLTErrorResources.ER_SET_FEATURE_NULL_NAME, null));    
   	}
   		
   	// secure processing?
  @@ -400,10 +399,10 @@
   	}
   	
   	// unknown feature
  -	throw new TransformerConfigurationException(
  -		"Trying to set the unknown feature \"" + name + "\": "
  -		+ CLASS_NAME + "#setFeature(" + name + ", " + value + ")"
  -		);			
  +        throw new TransformerConfigurationException(
  +            XSLMessages.createMessage(
  +              XSLTErrorResources.ER_UNSUPPORTED_FEATURE, 
  +              new Object[] {name}));
     }
   
     /**
  @@ -423,9 +422,8 @@
       // feature name cannot be null
       if (name == null) {
   	throw new NullPointerException(
  -		"Trying to get a feature with a null name: "
  -		+ CLASS_NAME
  -		+ "#getFeature(null)");
  +            XSLMessages.createMessage(
  +                XSLTErrorResources.ER_GET_FEATURE_NULL_NAME, null));    
       }
   	  	
       // Try first with identity comparison, which 
  
  
  
  1.49      +16 -1     xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- XSLTErrorResources.java	30 May 2005 17:40:51 -0000	1.48
  +++ XSLTErrorResources.java	31 May 2005 15:12:59 -0000	1.49
  @@ -412,6 +412,12 @@
     public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = 
        "ER_CANT_HAVE_CONTENT_AND_SELECT";
     public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE";    
  +  public static final String ER_SET_FEATURE_NULL_NAME =
  +  	"ER_SET_FEATURE_NULL_NAME";
  +  public static final String ER_GET_FEATURE_NULL_NAME =
  +  	"ER_GET_FEATURE_NULL_NAME";
  +  public static final String ER_UNSUPPORTED_FEATURE =
  +  	"ER_UNSUPPORTED_FEATURE";
        
     public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE";
     public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = 
  @@ -2156,6 +2162,15 @@
       { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX,
         "The result-prefix attribute of an xsl:namespace-alias element has the value ''{0}'', but there is no namespace declaration for the prefix ''{0}'' in scope for the element."},
   
  +    { ER_SET_FEATURE_NULL_NAME,
  +      "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."},
  +    
  +    { ER_GET_FEATURE_NULL_NAME,
  +      "The feature name cannot be null in TransformerFactory.getFeature(String name)."},
  +    
  +    { ER_UNSUPPORTED_FEATURE,
  +      "Cannot set the feature ''{0}'' on this TransformerFactory."},
  +    
       { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, 		
         "Cannot get the prefix for a null namespace uri."},
   
  
  
  
  1.26      +12 -3     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java
  
  Index: ErrorMessages.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ErrorMessages.java	15 Dec 2004 17:35:40 -0000	1.25
  +++ ErrorMessages.java	31 May 2005 15:12:59 -0000	1.26
  @@ -931,8 +931,17 @@
            * attribute.
            */
           {ErrorMsg.INVALID_METHOD_IN_OUTPUT,
  -        "The method attribute of an <xsl:output> element had the value ''{0}''.  The value must be one of 'xml', 'html', 'text', or qname-but-not-ncname"}
  +        "The method attribute of an <xsl:output> element had the value ''{0}''.  The value must be one of 'xml', 'html', 'text', or qname-but-not-ncname"},
  +        
  +        {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME,
  +        "The feature name cannot be null in TransformerFactory.getFeature(String name)."},
  +        
  +        {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME,
  +        "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."},
  +
  +        {ErrorMsg.JAXP_UNSUPPORTED_FEATURE,
  +        "Cannot set the feature ''{0}'' on this TransformerFactory."}
  +
       };
       }
  -
   }
  
  
  
  1.26      +4 -1      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
  
  Index: ErrorMsg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ErrorMsg.java	24 Feb 2004 03:55:48 -0000	1.25
  +++ ErrorMsg.java	31 May 2005 15:12:59 -0000	1.26
  @@ -117,6 +117,9 @@
       public static final String XSLTC_SOURCE_ERR = "XSLTC_SOURCE_ERR";
       public static final String ER_RESULT_NULL = "ER_RESULT_NULL";
       public static final String JAXP_INVALID_SET_PARAM_VALUE = "JAXP_INVALID_SET_PARAM_VALUE";        
  +    public static final String JAXP_SET_FEATURE_NULL_NAME = "JAXP_SET_FEATURE_NULL_NAME";
  +    public static final String JAXP_GET_FEATURE_NULL_NAME = "JAXP_GET_FEATURE_NULL_NAME";
  +    public static final String JAXP_UNSUPPORTED_FEATURE = "JAXP_UNSUPPORTED_FEATURE";
   
       // Command-line error messages
       public static final String COMPILE_STDIN_ERR = "COMPILE_STDIN_ERR";
  
  
  
  1.13      +12 -17    xml-xalan/java/src/org/apache/xalan/xsltc/trax/SmartTransformerFactoryImpl.java
  
  Index: SmartTransformerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/SmartTransformerFactoryImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SmartTransformerFactoryImpl.java	17 May 2005 17:22:14 -0000	1.12
  +++ SmartTransformerFactoryImpl.java	31 May 2005 15:12:59 -0000	1.13
  @@ -38,6 +38,7 @@
   import javax.xml.transform.stream.StreamResult;
   import javax.xml.transform.stream.StreamSource;
   
  +import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   import org.xml.sax.XMLFilter;
   
   /**
  @@ -175,24 +176,20 @@
   
   	// feature name cannot be null
   	if (name == null) {
  -	    throw new NullPointerException(
  -		"Trying to set a feature with a null name: "
  -		+ CLASS_NAME + "#setFeature(null, " + value + ")"
  -		);
  +            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
  +    	    throw new NullPointerException(err.toString());
   	}
  -		
   	// secure processing?
  -	if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
  +	else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
   	    featureSecureProcessing = value;		
   	    // all done processing feature
   	    return;
   	}
  -		
  -	// unknown feature
  -	throw new TransformerConfigurationException(
  -		"Trying to set the unknown feature \"" + name + "\": "
  -		+ CLASS_NAME + "#setFeature(" + name + ", " + value + ")"
  -		);			
  +	else {	
  +	    // unknown feature
  +            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
  +            throw new TransformerConfigurationException(err.toString());
  +        }
       }
   
       /**
  @@ -217,10 +214,8 @@
   		
   	// feature name cannot be null
   	if (name == null) {
  -	    throw new NullPointerException(
  -		"Trying to get a feature with a null name: "
  -		+ CLASS_NAME
  -		+ "#getFeature(null)");
  +    	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
  +    	    throw new NullPointerException(err.toString());
   	}
   
   	// Inefficient, but it really does not matter in a function like this
  
  
  
  1.77      +12 -18    xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- TransformerFactoryImpl.java	17 May 2005 17:22:14 -0000	1.76
  +++ TransformerFactoryImpl.java	31 May 2005 15:12:59 -0000	1.77
  @@ -399,24 +399,20 @@
   
   	// feature name cannot be null
   	if (name == null) {
  -	    throw new NullPointerException(
  -		"Trying to set a feature with a null name: "
  -		+ CLASS_NAME + "#setFeature(null, " + value + ")"
  -		);
  -	}
  -		
  +            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
  +    	    throw new NullPointerException(err.toString());
  +	}		
   	// secure processing?
  -	if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
  +	else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
   	    featureSecureProcessing = value;		
   	    // all done processing feature
   	    return;
   	}
  -		
  -	// unknown feature
  -	throw new TransformerConfigurationException(
  -		"Trying to set the unknown feature \"" + name + "\": "
  -		+ CLASS_NAME + "#setFeature(" + name + ", " + value + ")"
  -		);			
  +	else {	
  +	    // unknown feature
  +            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
  +            throw new TransformerConfigurationException(err.toString());
  +        }
       }
   
       /**
  @@ -443,10 +439,8 @@
   
   	// feature name cannot be null
   	if (name == null) {
  -		throw new NullPointerException(
  -			"Trying to get a feature with a null name: "
  -				+ CLASS_NAME
  -				+ "#getFeature(null)");
  +    	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
  +    	    throw new NullPointerException(err.toString());
   	}
   
   	// Inefficient, but array is small
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org