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

Inconsistent synchronization of ByteArrayOutputStream

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • core-libs
    • b29
    • generic
    • generic

      Bill Pugh writes:

      M IS2: Inconsistent synchronization of
      java.io.ByteArrayOutputStream.buf; locked 80% of time
      Unsynchronized access at ByteArrayOutputStream.java:[lines 160, 174 and
      200]

      The methods that convert a ByteArrayOutputStream to a String (all the
      toString) methods
      are not thread safe. In particular, since they access both the buf
      field and the count
      field and don't use locks, you could get stale data or an array access
      out of bounds
      error. The toString methods for ByteArrayOutputStream should be made
      synchronized.



      ###@###.### 2005-2-14 08:13:16 GMT

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: