cziegeler    01/05/11 03:16:24

  Modified:    src/org/apache/cocoon/components/sax
                        XMLByteStreamInterpreter.java
  Log:
  Fixed handling of attribute values. Sometimes a null byte was added
  
  Revision  Changes    Path
  1.2       +12 -2     
xml-cocoon2/src/org/apache/cocoon/components/sax/XMLByteStreamInterpreter.java
  
  Index: XMLByteStreamInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/sax/XMLByteStreamInterpreter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLByteStreamInterpreter.java     2001/05/09 20:49:59     1.1
  +++ XMLByteStreamInterpreter.java     2001/05/11 10:16:20     1.2
  @@ -21,7 +21,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:59 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/05/11 10:16:20 $
    */
   
   public final class XMLByteStreamInterpreter
  @@ -141,7 +141,17 @@
           if (length >= 0x00008000) {
               return (String) list.get(index);
           } else {
  -            String str = new String(this.readChars(index));
  +            char[] chars = this.readChars(index);
  +            int len = chars.length;
  +            if (len > 0) {
  +                while (chars[len-1]==0) len--;
  +            }
  +            String str;
  +            if (len == 0) {
  +                str = "";
  +            } else {
  +                str = new String(chars, 0, len);
  +            }
               list.add(str);
               return str;
           }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to