You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/02/19 20:01:03 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ParserController.java PageInfo.java

luehe       2003/02/19 11:01:02

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        ParserController.java PageInfo.java
  Log:
  Fixed NPE in encoding determination logic
  
  Revision  Changes    Path
  1.33      +9 -12     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ParserController.java	12 Feb 2003 23:44:23 -0000	1.32
  +++ ParserController.java	19 Feb 2003 19:00:59 -0000	1.33
  @@ -222,7 +222,7 @@
   	    compiler.getPageInfo().addDependant(absFileName);
   	}
   
  -	// Dispatch to the proper parser
  +	// Dispatch to the appropriate parser
   	if (isXml) {
   	    // JSP document (XML syntax)
   	    InputStream inStream = null;
  @@ -325,16 +325,14 @@
   	}
   	
   	if (isExternal && !isXml) {
  -	    // JSP (standard) syntax
  -	    if (pageInfo.getConfigEncoding() != null) {
  -		// Encoding specified in jsp-config (used by standard syntax
  -		// only)
  -		sourceEnc = pageInfo.getPageEncoding();
  +	    // JSP (standard) syntax. Use encoding specified in jsp-config
  +	    // if provided.
  +	    sourceEnc = pageInfo.getConfigEncoding();
  +	    if (sourceEnc != null) {
   		return;
  -	    } else {
  -		// We don't know the encoding
  -		sourceEnc = "ISO-8859-1";
   	    }
  +	    // We don't know the encoding
  +	    sourceEnc = "ISO-8859-1";
   	} else {
   	    // XML syntax or unknown, (auto)detect encoding ...
   	    Object[] ret = XMLEncodingDetector.getEncoding(fname, jarFile,
  @@ -409,9 +407,8 @@
   	 * Determine the page encoding from the page directive, unless it's
   	 * specified via JSP config.
   	 */
  -	if (pageInfo.getPageEncoding() != null) {
  -	    sourceEnc = pageInfo.getPageEncoding();
  -	} else {
  +	sourceEnc = pageInfo.getConfigEncoding();
  +	if (sourceEnc == null) {
   	    sourceEnc = getSourceEncodingForJspSyntax(jspReader, startMark);
   	}
   
  
  
  
  1.21      +11 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java
  
  Index: PageInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PageInfo.java	13 Feb 2003 19:46:11 -0000	1.20
  +++ PageInfo.java	19 Feb 2003 19:00:59 -0000	1.21
  @@ -263,10 +263,18 @@
   	return this.isEncodingSpecifiedInProlog;
       }
   
  +    /*
  +     * Sets the encoding specified in the JSP config element whose URL pattern
  +     * matches this page.
  +     */
       public void setConfigEncoding(String enc) {
   	this.configEncoding = enc;
       }
   
  +    /*
  +     * Gets the encoding specified in the JSP config element whose URL pattern
  +     * matches this page.
  +     */
       public String getConfigEncoding() {
   	return this.configEncoding;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org