kinman 01/10/03 16:43:22
Modified: jasper/src/share/org/apache/jasper/compiler JspCompiler.java
Log:
PR: Bugzilla 3892
If the name of the .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
1.8 +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.8
diff -u -r1.7 -r1.8
--- JspCompiler.java 2001/09/07 22:51:26 1.7
+++ JspCompiler.java 2001/10/03 23:43:22 1.8
@@ -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))