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

results from String.getBytes(s, "UnicodeBig") are in-consistent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.0
    • 1.2.0, 1.3.0
    • core-libs
    • kestrel
    • generic, sparc
    • generic, solaris_2.6



      Name: dbT83986 Date: 03/15/99


      When String's getBytes() method is called repeatedly
      with the same string, the byte arrary returned by
      this method is different on subsequent calls.

      Given:

         String s = new String("a");
         String encoding = "UnicodeBig";
         byte [] b = null;

      When the following is execute, the length of array b is 4
      (the first two bytes contain the FE and FF):

         b = s.getBytes(encoding);
         System.out.println("LEN = " + b.length);

      If the above two lines are re-executed, the length of
      array b is two (the FE and FF bytes are NOT present):

         b = s.getBytes(encoding);
         System.out.println("LEN = " + b.length);
      (Review ID: 55461)
      ======================================================================

            mr Mark Reinhold
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: