Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 33535 invoked from network); 18 Jan 2001 20:08:08 -0000 Received: from proxy2.ba.best.com (root@206.184.139.14) by h31.sny.collab.net with SMTP; 18 Jan 2001 20:08:08 -0000 Received: from gurba (c84725-a.stcla1.sfba.home.com [24.12.52.82]) by proxy2.ba.best.com (8.9.3/8.9.2/best.out) with SMTP id MAA07220; Thu, 18 Jan 2001 12:05:35 -0800 (PST) From: "Tal Dayan" To: Cc: Subject: Patch for bug 330 Date: Thu, 18 Jan 2001 12:05:34 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hi Costin, Here is our patch for bug 330, Priority: high, Severity serious.(http://znutar.cortexity.com/BugRatViewer/ShowReport/330). Having this patch included the official release of 3.X.X will make Tomcat usable for us since we could not port our application from WebSphere to Tomcat 3.2.1 because of this problem. To apply the patch, all you need to do is to replace the method mangleChar() in JspCompiler.java with the new code that is included at the end of this message. BTW, the file CommandLineCompiler also has a similar mangleChar() method. I am not sure when this is used but you may want to consolidate the two. The new encoding has two forms, a short one and a general one. The short one is used for few common chars such as '_' and '/' and '/'. This encoding maps into a two char string of the form '_' where is a non hex char (g-z) (e.g. '_' --> '__', '.' --> '_p' etc). It is a more compact, 'readable' (e.g. the 'p' in '.'-->'_p' stands for 'period') and is more efficient since it does not create any object. The general form is used for the rest of the chars, including Unicode's. It is of variable length and for most of the common chars (e.g. ASCII) it will result in a shorter encoding than the one currently used. This encoding uses the form '_' 'x' where is a variable length hex representation of the numeric value of the char (e.g. "_f4x", "_123ax"). Please review the patch and 'squeeze' it to the next maintenance release of 3.X.X. Thanks, Tal -------- new code ------ /* * Encode special chars using a representation that contains only * simple chars that can be used in class names (digits, letters, * and '_'). */ private static final String mangleChar(char ch) { if(ch == File.separatorChar) { ch = '/'; } /* * Use a compact and more readable encoding for few common chars. * * Note: the char we append after the '_' should not be hex digit * to avoid ambiguity with the general encoding we perform for the rest of * the chars. */ if (ch == '_') { return "__"; // underscore } if (ch == '-') { return "_m"; // minus } if (ch == '.') { return "_p"; // period } if (ch == '/') { return "_s"; // seperator } /* * Encode the general case. We encode the char as follows * * '_' 'x' * * Where h is is a variable length Hexadecimal * represnetation of the numeric value * of the char as returned by IntegertoHexString(). */ return "_" + Integer.toHexString(ch) + "x"; } -------- old code private static final String mangleChar(char ch) { if(ch == File.separatorChar) { ch = '/'; } String s = Integer.toHexString(ch); int nzeros = 5 - s.length(); char[] result = new char[6]; result[0] = '_'; for (int i = 1; i <= nzeros; i++) result[i] = '0'; for (int i = nzeros+1, j = 0; i < 6; i++, j++) result[i] = s.charAt(j); return new String(result); } > -----Original Message----- > From: cmanolache@yahoo.com [mailto:cmanolache@yahoo.com] > Sent: Tuesday, January 16, 2001 11:40 AM > To: tomcat-dev@jakarta.apache.org > Subject: Re: Proposed name encoding patch > > > It's worth to mention that both JSP encoding and work dir encoding are > resolved/improved in 3.3 - and the code can be easily ported back / > reused. > > I'll take a look at both patches and try to integrate them into 3.3 also ( > what is not covered already ) > > -- > Costin > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org > For additional commands, email: tomcat-dev-help@jakarta.apache.org > >