billbarker    2004/08/22 14:46:20

  Modified:    util/java/org/apache/tomcat/util/buf MessageBytes.java
  Log:
  The type has to be changed after the call to toString, or conversion isn't done 
correctly.
  
  Revision  Changes    Path
  1.18      +4 -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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- MessageBytes.java 18 Aug 2004 20:42:25 -0000      1.17
  +++ MessageBytes.java 22 Aug 2004 21:46:19 -0000      1.18
  @@ -230,11 +230,12 @@
       /** Unimplemented yet. Do a char->byte conversion.
        */
       public void toBytes() {
  -        type=T_BYTES;
           if( ! byteC.isNull() ) {
  +            type=T_BYTES;
               return;
           }
           toString();
  +        type=T_BYTES;
           byte bb[] = strValue.getBytes();
           byteC.setBytes(bb, 0, bb.length);
       }
  @@ -243,12 +244,13 @@
        *  XXX Not optimized - it converts to String first.
        */
       public void toChars() {
  -        type=T_CHARS;
        if( ! charC.isNull() ) {
  +            type=T_CHARS;
            return;
        }
        // inefficient
        toString();
  +        type=T_CHARS;
        char cc[]=strValue.toCharArray();
        charC.setChars(cc, 0, cc.length);
       }
  
  
  

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

Reply via email to