Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-213

Unsafe code in FromNetASCIIInputStream.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0
    • None
    • None

    Description

      The constructors in FromNetASCIIInputStream.java assign a value to a static field:

      _lineSeparatorBytes = _lineSeparator.getBytes(encoding);

      This is not thread-safe, indeed it is thread-hostile if the value can ever be different for different encodings.
      (Two different instances wanting to use two different values of the same static field)

      The field should be initialised in the static initialiser (and should probably be made final as a hint not to change it - though this won't stop the contents being changed).

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: