tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Crawford <lee.crawf...@trintech.com>
Subject BUG: org.apache.jasper.compiler.JspReader.skipUntil(String).
Date Thu, 29 Nov 2001 21:24:57 GMT
All, 

There is a bug in org.apache.jasper.compiler.JspReader.skipUntil(String): 

    public Mark skipUntil(String limit)
    throws ParseException {
	Mark ret = null;
	int limlen = limit.length();
	int ch;
	
    skip:
	for (ret = mark(), ch = nextChar() ; ch != -1 ; ret = mark(), ch =
nextChar()) {
	    
	    if ( ch == limit.charAt(0) ) {
		for (int i = 1 ; i < limlen ; i++) {
		    if (Character.toLowerCase((char) nextChar()) !=
limit.charAt(i))
			continue skip;
		}
		return ret;
	    }
	}
	return null;
    }

The problem is that the inner loop cycles through the string to be skipped
but when it falls out because the wrong character was encountered it needs
to have saved the state it entered the inner loop with and restart just one
character past the point at which it entered the last time. 

This causes it to fail to recognize things like: 

  <%-- this comment ends with an invisible tag (3-hyphens) ---%>

Cheers. 

--lee 

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


Mime
View raw message