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

String.getBytes behavior shouldn't change in 1.1.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.7
    • core-libs
    • x86
    • windows_95



      Name: dbT83986 Date: 02/10/99


      The behavior of String.getBytes changed
      between 1.1.6 and 1.1.7. In 1.1.6 and below,
      it simply returned the low byte of each
      character. In 1.1.7, many of the characters
      (128..159?) are converted to 63 (a question
      mark).

      I understand that getBytes is supposed to
      convert characters to bytes based on the
      default character encoding. But I think
      the larger issue is whether methods like this
      should change behavior within the 1.1.x
      line of Java api's. I don't think they should.
      If using just the low byte was a bug, you
      should have fixed it in 1.1.1, or documented
      the 'bug' and left it unchanged. Otherwise,
      I think you should hold off making changes
      until 1.2, if ever. I don't think the behavior
      of a method should ever change. If you want
      different behavior, make a new method
      (for example, getBytesEnc()?). Otherwise,
      you will just keep breaking programs.

      More and more, I find myself writing my own
      versions of Java methods to improve performance
      and insulate my programs from changes and
      bug in Java's methods. Otherwise, I can't
      write programs that can be used by clients
      with 1.1.6 and 1.1.7.

      Please set a policy regarding this issue
      within JavaSoft.
      (Review ID: 47847)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: