jtaylor     2002/06/18 17:43:56

  Modified:    src/java/org/apache/turbine DynamicURI.java
  Log:
  Prevent an ArrayIndexOutOfBounds when encoding unicode strings.
  The array of 'safe' characters is only checked for characters
  below 128, since no character above that is safe. Any other
  character will be encoded.
  
  Revision  Changes    Path
  1.9       +3 -3      jakarta-turbine-3/src/java/org/apache/turbine/DynamicURI.java
  
  Index: DynamicURI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/DynamicURI.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DynamicURI.java   16 Apr 2002 19:56:41 -0000      1.8
  +++ DynamicURI.java   19 Jun 2002 00:43:56 -0000      1.9
  @@ -1002,7 +1002,7 @@
           {
               char c = (char) bytes[i];
   
  -            if ( safe[ c ] )
  +            if ( c < 128 && safe[ c ] )
               {
                   out.append(c);
               }
  @@ -1054,7 +1054,7 @@
        * Characters that need not be encoded. This is much faster than using a
        * BitSet, and for such a small array the space cost seems justified.
        */
  -    private static boolean[] safe = new boolean[ 255 ];
  +    private static boolean[] safe = new boolean[ 128 ];
   
       /** Static initializer for {@link #safe} */
       static
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to