costin      01/06/21 14:22:12

  Modified:    util/java/org/apache/tomcat/util/buf MessageBytes.java
  Log:
  Fix for the mod_jserv bug, reported by Larry.
  
  The reset in MessageBytes will clean the cached String value only if
  the string value is indeed a cached value, not the primary value.
  
  The MessageBytes can be used as a holder for byte[], char[] and Strings,
  with delayed conversion from byte[] to String ( to allow the container to
  detect the encoding - it can happen very late, especially in 2.3 ). It is
  possible that toString() has been called before ( for example in parameters
  we need to detect jsp_precompile - that will happen before the "right"
  encoding is known ).
  
  Revision  Changes    Path
  1.5       +6 -2      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java
  
  Index: MessageBytes.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MessageBytes.java 2001/06/16 21:40:59     1.4
  +++ MessageBytes.java 2001/06/21 21:22:09     1.5
  @@ -165,8 +165,12 @@
        byte[] or after the encoding is changed
       */
       public void resetStringValue() {
  -     hasStrValue=false;
  -     strValue=null;
  +     if( type != T_STR ) {
  +         // If this was cread as a byte[] or char[], we remove
  +         // the old string value
  +         hasStrValue=false;
  +         strValue=null;
  +     }
       }
   
       public void setString( String s ) {
  
  
  

Reply via email to