* java/io/InputStreamReader.java (read): If length is 0, return
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 May 1999 12:33:07 +0000 (12:33 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 May 1999 12:33:07 +0000 (12:33 +0000)
0.  Reset `wpos' and `wcount' when buffer has been filled and
emptied.
* java/util/Properties.java (save): Removed `FIXME' comment.
(load): Invalid characters in \u now treated as terminators.
Make sure to append character resulting from `\' handling.
Cast to `char' when appending to key or value.
(skip_ws): Inverted test for whitespace.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26862 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/io/InputStreamReader.java
libjava/java/util/Properties.java

index ef1c6dd..7cd285e 100644 (file)
@@ -1,5 +1,15 @@
 1999-05-10  Tom Tromey  <tromey@cygnus.com>
 
+       * java/io/InputStreamReader.java (read): If length is 0, return
+       0.  Reset `wpos' and `wcount' when buffer has been filled and
+       emptied.
+
+       * java/util/Properties.java (save): Removed `FIXME' comment.
+       (load): Invalid characters in \u now treated as terminators.
+       Make sure to append character resulting from `\' handling.
+       Cast to `char' when appending to key or value.
+       (skip_ws): Inverted test for whitespace.
+
        * java/io/RandomAccessFile.java (RandomAccessFile): Removed
        `FIXME' comment.
        (readLine): Likewise.
index 5d37303..ae5e2c7 100644 (file)
@@ -111,6 +111,8 @@ public class InputStreamReader extends Reader
          }
        else
          {
+           if (length == 0)
+             return 0;
            for (;;)
              {
                in.mark(1);
@@ -141,6 +143,11 @@ public class InputStreamReader extends Reader
            wpos = 0;
            wcount = 0;
          }
+       else if (wavail == 0)
+         {
+           wpos = 0;
+           wcount = 0;
+         }
        int count = read(work, wpos, work.length-wpos);
        if (count <= 0)
          return -1;
index aac7214..2988e7b 100644 (file)
@@ -103,7 +103,7 @@ public class Properties extends Hashtable
          // FIXME: we use our own definition of whitespace.
          // Character.isWhitespace includes newlines, which we don't
          // want.  Character.isSpaceChar doesn't include \t.
-         if (c == ' ' || c == '\t')
+         if (c != ' ' && c != '\t')
            {
              reader.unread(c);
              return true;
@@ -166,12 +166,12 @@ public class Properties extends Hashtable
                  reader.unread(c);
                  break;
                }
-             // FIXME: again, our own definitino of whitespace.
+             // FIXME: again, our own definition of whitespace.
              if (c == ' ' || c == '\t' || c == ':' || c == '=')
                break;
 
              first_char = false;
-             key.append(c);
+             key.append((char) c);
            }
 
          // Found end of key.  Skip whitespace.  If the terminator
@@ -226,10 +226,14 @@ public class Properties extends Hashtable
                          if (x == -1)
                            return;
                          int d = Character.digit((char) x, 16);
-                         // FIXME: what to do here?  We call it an
-                         // error.
+                         // We follow JDK here: invalid characters
+                         // are treated as terminators.
                          if (d == -1)
-                           throw new IOException ();
+                           {
+                             value.append((char) c);
+                             c = x;
+                             break;
+                           }
                          c <<= 4;
                          c |= d;
                        }
@@ -238,8 +242,7 @@ public class Properties extends Hashtable
                      // Nothing.
                    }
                }
-             else
-               value.append(c);
+             value.append((char) c);
            }
 
          put (key.toString(), value.toString());
@@ -290,7 +293,8 @@ public class Properties extends Hashtable
        {
          if (comment != null)
            {
-             // FIXME: what if COMMENT contains newlines?
+             // We just lose if COMMENT contains a newline.  This is
+             // what JDK 1.1 does.
              output.write("#");
              output.write(comment);
              output.write(newline);
@@ -309,7 +313,7 @@ public class Properties extends Hashtable
              // characters.  But it also doesn't say we should encode
              // it in any way.
              // FIXME: if key contains ':', '=', or whitespace, must
-             // quote it here.
+             // quote it here.  Note that JDK 1.1 does not do this.
              output.write(key);
              output.write("=");