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

(rb) ResourceBundle.getString() returns incorrect value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • 5.0
    • core-libs
    • b98
    • x86
    • linux

    Description

      FULL PRODUCT VERSION :
      java version "1.5.0_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
      Java HotSpot(TM) Server VM (build 1.5.0_04-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      RedHat EL 4

      Linux 2.6.9-5.ELhugemem #1 SMP Wed Jan 5 19:38:36 EST 2005 i686 i686 i386 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      both server and client mode

      A DESCRIPTION OF THE PROBLEM :
      When the value of a property ends with the character '\', ResourceBundle.getString()
      will return an incorrect value.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Here is a test program:

      import java.util.*;
                                                                                      
      public class TestRB {
                                                                                      
      public static void main(String[] args) {
        ResourceBundle rb = ResourceBundle.getBundle("test");
                                                                                      
        System.out.println();
        System.out.println(rb.getString("a"));
        System.out.println();
        System.out.println(rb.getString("b"));
      }
                                                                                      
      }


      Here is the content of test.properties:
      a=ABCDEFGHIJK
                                                                                      
      b=Network

      Running TestRB under JDK 1.4.2 produces the correct output:
      $ java -cp . TestRB
       
      ABCDEFGHIJK
       
      Network


      But running under JDK 1.5.0_01 produces incorrect output:
      $ java -server -cp . TestRB
       
      ABCDEFGHIJK
       
      NetworkI

      an extra character is returned. In this case there is an extra 'I' at the end.
      It looks like 1.5.0 picks that up from the other property, a, that is in the
      properties file.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ABCDEFGHIJK
       
      Network
      ACTUAL -
      ABCDEFGHIJK
       
      NetworkI

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.*;
                                                                                      
      public class TestRB {
                                                                                      
      public static void main(String[] args) {
        ResourceBundle rb = ResourceBundle.getBundle("test");
                                                                                      
        System.out.println();
        System.out.println(rb.getString("a"));
        System.out.println();
        System.out.println(rb.getString("b"));
      }
                                                                                      
      }

      Here is the content of test.properties:
      a=ABCDEFGHIJK
                                                                                      
      b=Network---------- END SOURCE ----------

      Attachments

        Activity

          People

            naoto Naoto Sato
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: