Bug 22657 - LineNumberReader incorrect use of PushbackReader
Summary: LineNumberReader incorrect use of PushbackReader
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-11 21:33 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2002-12-11 21:33:45 UTC
This bug was originally filed against SableVM 1.0.5.

I was trying to run an app and got an exception that looked like this:

    java.io.IOException: Pushback buffer is full
            at java.io.PushbackReader.unread(PushbackReader.java:319)
            at java.io.LineNumberReader.read(LineNumberReader.java:246)
            ...

This appears to be a bug in LineNumberReader.java, which the
patch below seems to fix.


--- work/sablevm-class-library-1.0.5/src/java/io/LineNumberReader.java.orig
Mon Dec  9 19:12:35 2002
+++ work/sablevm-class-library-1.0.5/src/java/io/LineNumberReader.java  Mon Dec 
 9 19:12:02 2002
@@ -115,7 +115,7 @@
   public
   LineNumberReader(Reader in, int size)
   {
-    super(new PushbackReader(in), size);
+    super(in, size);
   }
 
   /*************************************************************************/
@@ -243,7 +243,7 @@
         int extra_char_read = super.read();
 
         if ((extra_char_read != '
') && (extra_char_read != -1))
-          ((PushbackReader)in).unread(extra_char_read);
+          pos--;
 
         char_read = '
';
         ++line_number;

Comment 1 from-classpath 2002-12-12 14:51:58 UTC
Thanks. I have added a Mauve test for this and will check in your fix.