To: ###@###.###
Cc: ###@###.###, ken.arnold@east
Subject: java.io.ByteArrayInputStream.read() not throwing IOException
Date: Mon, 28 Sep 1998 10:12:07 -0400
From: Charlie Lamb <###@###.###>
ObjectStore PSE uses a javacc generated parser generator. javacc
generates code which uses ByteArrayInputStream.read and catches the
IOException which it throws. That is, the read and the catch are
javacc generated code. Unfortunately, this generated code no longer
works because of the following change in beta 4.2:
ByteArrayInputStream:
/** Check to make sure that the stream has not been closed */
private void ensureOpen() {
/* Should be changed to an IOException eventually. */
if (isClosed)
throw new RuntimeException("Stream closed");
}
Instead of throwing IOException, you're throwing RuntimeException
(which is a change in the InputStream.read contract which throws
IOException). Our guess is that you didn't have time to do the full
surgery to propagate the "throws IOException" clauses all the way
through the code.
We can work around this by creating a subclass of ByteArrayInputStream
which does its own "isClosed checking", but we'd obviously rather not.
Can I count on this getting fixed before the beta 4.3 or GA or should
I go ahead and make the change to our code?
Cc: ###@###.###, ken.arnold@east
Subject: java.io.ByteArrayInputStream.read() not throwing IOException
Date: Mon, 28 Sep 1998 10:12:07 -0400
From: Charlie Lamb <###@###.###>
ObjectStore PSE uses a javacc generated parser generator. javacc
generates code which uses ByteArrayInputStream.read and catches the
IOException which it throws. That is, the read and the catch are
javacc generated code. Unfortunately, this generated code no longer
works because of the following change in beta 4.2:
ByteArrayInputStream:
/** Check to make sure that the stream has not been closed */
private void ensureOpen() {
/* Should be changed to an IOException eventually. */
if (isClosed)
throw new RuntimeException("Stream closed");
}
Instead of throwing IOException, you're throwing RuntimeException
(which is a change in the InputStream.read contract which throws
IOException). Our guess is that you didn't have time to do the full
surgery to propagate the "throws IOException" clauses all the way
through the code.
We can work around this by creating a subclass of ByteArrayInputStream
which does its own "isClosed checking", but we'd obviously rather not.
Can I count on this getting fixed before the beta 4.3 or GA or should
I go ahead and make the change to our code?
- relates to
-
JDK-4153007 java.io.ByteArrayOutputStream allows writes after close
-
- Resolved
-
-
JDK-4174670 java.io.ByteArrayOutputStream: write on closed stream throws RuntimeException
-
- Closed
-