You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2003/06/17 21:07:16 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/io ASCIIReader.java

mrglavas    2003/06/17 12:07:16

  Modified:    java/src/org/apache/xerces/impl/io ASCIIReader.java
  Log:
  Based on Glenn's suggestion, fixing a bug which allowed invalid ASCII bytes to slip through the reader.
  
  Bugzilla #15538: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15538
  
  Revision  Changes    Path
  1.5       +4 -4      xml-xerces/java/src/org/apache/xerces/impl/io/ASCIIReader.java
  
  Index: ASCIIReader.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/io/ASCIIReader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ASCIIReader.java	17 Jul 2002 21:30:12 -0000	1.4
  +++ ASCIIReader.java	17 Jun 2003 19:07:16 -0000	1.5
  @@ -151,7 +151,7 @@
        */
       public int read() throws IOException {
           int b0 = fInputStream.read();
  -        if (b0 > 0x80) {
  +        if (b0 >= 0x80) {
               throw new IOException(fFormatter.formatMessage(fLocale, "InvalidASCII", new Object [] {Integer.toString(b0)}));
           }
           return b0;
  @@ -178,8 +178,8 @@
           int count = fInputStream.read(fBuffer, 0, length);
           for (int i = 0; i < count; i++) {
               int b0 = fBuffer[i];
  -            if (b0 > 0x80) {
  -                throw new IOException(fFormatter.formatMessage(fLocale, "InvalidASCII", new Object [] {Integer.toString(b0)}));
  +            if (b0 < 0) {
  +                throw new IOException(fFormatter.formatMessage(fLocale, "InvalidASCII", new Object [] {Integer.toString(b0 & 0x0FF)}));
               }
               ch[offset + i] = (char)b0;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org