tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26400] New: - JspC.java can produce invalid package names
Date Sat, 24 Jan 2004 20:27:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26400>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26400

JspC.java can produce invalid package names

           Summary: JspC.java can produce invalid package names
           Product: Tomcat 4
           Version: 4.1.29
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: rainer.jung@kippdata.de


If a jsp lies inside a path, where a directory name e.g. starts with a digit,
then /org/apache/jasper/JspC.java produces an invalid package name. I provide a
small patch following.

*** JspC.java.orig      Wed Mar 19 10:20:58 2003
--- JspC.java   Sun Jun 15 19:22:48 2003
***************
*** 998,1006 ****
--- 998,1011 ----
          int iSep = jspUri.lastIndexOf('/');
        // Start after the first slash
          int nameStart = 1;
+         int firstIdentifierChar = 1;
        for (int i = 1; i < iSep; i++) {
            char ch = jspUri.charAt(i);
            if (Character.isJavaIdentifierPart(ch)) {
+               if ( ( firstIdentifierChar == 1 ) && ( !
Character.isJavaIdentifierStart(ch) ) ) {
+                   modifiedPackageName.append('_');
+                   firstIdentifierChar=0;
+               }
                modifiedPackageName.append(ch);
            }
            else if (ch == '/') {
***************
*** 1009,1014 ****
--- 1014,1020 ----
                  }
                  nameStart = i+1;
                modifiedPackageName.append('.');
+               firstIdentifierChar=1;
            } else {
                modifiedPackageName.append(mangleChar(ch));
            }

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


Mime
View raw message