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

Can't change locale providers under Web Start

    XMLWordPrintable

Details

    • x86_64
    • windows_7
    • Verified

    Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+124)
      Java HotSpot(TM) Client VM (build 9-ea+124, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Since the default locale providers changed (JDK-8043554) it is important for compatibility reasons to be able to change the order of locale providers.
      Unfortunately, under Web Start the system property java.locale.providers seems to have no effect.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached code as a signed web start app

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The application should print
      COMPAT,CLDR
      and exit normally.
      ACTUAL -
      The application prints
      COMPAT,CLDR
      but crashes with an exception.

      Note that the same application runs OK if run as a normal (non-Web Start) application with
      java -Djava.locale.providers=COMPAT,CLDR Toto

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.text.ParseException: Unparseable date: "3/20/15 10:59:00 PM"
      at java.text.DateFormat.parse(java.base@9-ea/DateFormat.java:366)
      at Toto.main(Toto.java:16)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:533)
      at com.sun.javaws.Launcher.executeApplication(jdk.javaws@9-ea/Launcher.java:1736)
      at com.sun.javaws.Launcher.executeMainClass(jdk.javaws@9-ea/Launcher.java:1671)
      at com.sun.javaws.Launcher.doLaunchApp(jdk.javaws@9-ea/Launcher.java:1519)
      at com.sun.javaws.Launcher.run(jdk.javaws@9-ea/Launcher.java:156)
      at java.lang.Thread.run(java.base@9-ea/Thread.java:843)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Toto.java
      =========

      import java.text.*;
      import java.util.*;

      public class Toto {
        private static final String TXT = "3/20/15 10:59:00 PM";

        public static void main(String... argv) throws Exception {
              DateFormat dateformat=
              DateFormat.getDateTimeInstance(DateFormat.SHORT,
                      DateFormat.MEDIUM,
                      Locale.US);
              dateformat.setTimeZone(TimeZone.getTimeZone("GMT"));
              System.out.println(System.getProperty("java.locale.providers"));
              try {
                      Date date = dateformat.parse(TXT);
              } catch(Exception e) {
                      e.printStackTrace(System.err);
              }
        }
      }


      test.jnlp
      ===========

      <?xml version="1.0" encoding="utf-8"?>
       <jnlp spec="6.0+" codebase="http://www.example.com/webstart" href="test.jnlp">
         <information>
           <title>Test app</title>
           <vendor>Anon</vendor>
           <offline-allowed/>
         </information>
         <security>
             <all-permissions/>
         </security>
         <update check="always" policy="always" />
         <resources>
           <j2se version="1.6+"/>
           <jar href="test.jar" main="true"/>
           <property name="java.locale.providers" value="COMPAT,CLDR"/>
         </resources>

         <application-desc main-class="Toto"/>
       </jnlp>


      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              herrick Andy Herrick (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: