You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/05/11 12:16:26 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/sax XMLByteStreamInterpreter.java

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:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:cziegeler@apache.org">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:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org