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

Can not create any RowSet implementation class under JDK 1.4 with non-US locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.4.2
    • core-libs
    • None
    • generic
    • generic

      The following example fails to create the new instance of com.sun.rowset.CachedRowSetImpl class under non-US locale with JDK 1.4.2.

      package test;

      import java.util.Locale;

      public class Test {

          public static void main(String[] args) {
              try {
                  Locale locale = Locale.getDefault();
                  String suffix = locale.getCountry();
                               
                  System.out.println(locale + " " + suffix );
                              
                  Class clazz = Class.forName("com.sun.rowset.CachedRowSetImpl");
                  System.out.println(clazz.newInstance());
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          
      }

      This code does not work under non-US locale with JDK 1.4:

      > LANG=ru_RU /set/java/jdk1.4.2/linux-i586/bin/java -cp classes:/set/java-sqe/promotions/rowset1_0_1/rowset.jar test.Test
      ru_RU RU
      java.lang.NullPointerException
              at java.io.Reader.<init>(Reader.java:61)
              at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
              at java.util.Properties.load(Properties.java:266)
              at java.util.PropertyResourceBundle.<init>(PropertyResourceBundle.java:96)
              at com.sun.rowset.JdbcRowSetResourceBundle.<init>(Unknown Source)
              at com.sun.rowset.JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(Unknown Source)
              at com.sun.rowset.CachedRowSetImpl.<init>(Unknown Source)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
              at java.lang.Class.newInstance0(Class.java:308)
              at java.lang.Class.newInstance(Class.java:261)
              at test.Test.main(Test.java:37)

      It works under US locale:

      > LANG=C /set/java/jdk1.4.2/linux-i586/bin/java -cp classes:/set/java-sqe/promotions/rowset1_0_1/rowset.jar test.Test
      en_US US
      com.sun.rowset.CachedRowSetImpl@1d1acd3

      It works under JDK 1.5:

      >LANG=ru_RU /set/java/jdk1.5.0/linux-i586/bin/java -cp classes:/set/java-sqe/promotions/rowset1_0_1/rowset.jar test.Test
      ru_RU RU
      com.sun.rowset.CachedRowSetImpl@150bd4d

            ahandasunw Amit Handa (Inactive)
            agavrilosunw Alexey Gavrilov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: