Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4177581

java.io.ByteArray{Input,Output}Stream,StringWriter: Wrong exception if closed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.2.0
    • 1.2.0
    • core-libs
    • None
    • 1.2fcs
    • generic
    • generic
    • Not verified

      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?

            mr Mark Reinhold
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: