kinman 01/10/03 16:45:02
Modified: jasper/src/share/org/apache/jasper/compiler Tag:
tomcat_40_branch JspCompiler.java
Log:
PR: Bugzilla 3892
If the name of a .jsp file does not start with a legal Java identifier
letter, prepend the generated class name with a '$' to make it a legal
Java id name.
Revision Changes Path
No revision
No revision
1.7.2.1 +5 -0
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java
Index: JspCompiler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- JspCompiler.java 2001/09/07 22:51:26 1.7
+++ JspCompiler.java 2001/10/03 23:45:02 1.7.2.1
@@ -132,6 +132,11 @@
int iSep = jsp.lastIndexOf('/') + 1;
int iEnd = jsp.length();
StringBuffer modifiedClassName = new StringBuffer(jsp.length() - iSep);
+ if (!Character.isJavaIdentifierStart(jsp.charAt(iSep))) {
+ // If the first char is not a legal Java letter or digit,
+ // prepend a '$'.
+ modifiedClassName.append('$');
+ }
for (int i = iSep; i < iEnd; i++) {
char ch = jsp.charAt(i);
if (Character.isLetterOrDigit(ch))