harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "spark shen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1187) [classlib][text] unexpected MissingResourceException for new DecimalFormat("#######0.0000")
Date Wed, 27 Sep 2006 02:56:51 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1187?page=comments#action_12438003 ] 
            
spark shen commented on HARMONY-1187:
-------------------------------------

Hi Vladimir:

The reason of the bug on harmony is as below:
1. On harmony, java.util.DecimalFormat wraps ICU DecimalFormat.
2. ICU DecimalFormat loads resource file using URLAppClassLoader(a kernel class) which is
Harmony specific.
3. URLAppClassLoader uses a URLStreamHandler to load the resource file as an InputStream.
                      URLStreamHandler.openConnection(URL).getInputStream();
4. In this case, the absolute path of the resource file is used as URL, and MyURLStreamHandler
is used as the StreamHandler. And apparently this mocked streamHandler could not open the
resource file as an inputStream. So on harmony, a MissingResourceException was thrown out.

Since this bug is caused by this mocked streamhandler, and Harmony uses different classloader
as RI does, I suggest to tag this JIRA as a non-bug difference.

On DRLVM, I am not sure :-)

Best regards

> [classlib][text] unexpected MissingResourceException for new DecimalFormat("#######0.0000")
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1187
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1187
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Vladimir Ivanov
>
> The method java.text.DecimalFormat("#######0.0000") throws MissingResourceException on
Harmony and works fine on RI.
> ================== test.java ============================
> import java.net.*;
> import java.text.DecimalFormat;
> import java.io.IOException;
> public class test  {
>     public static void main(String[] args) {
>         URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
>             public URLStreamHandler createURLStreamHandler(String protocol) {
>                 return new MyURLStreamHandler();
>             }
>         });
>         System.out.println("res = " + new DecimalFormat("#######0.0000"));
>     }
> }
> class MyURLConnection extends URLConnection {
>     public MyURLConnection(URL u) {
>         super(u);
>     }
>     public void connect() {
>     }
> }
> class MyURLStreamHandler extends URLStreamHandler {
>     protected MyURLStreamHandler() {
>         super();
>     }
>     protected URLConnection openConnection(URL u) throws IOException {
>         return new MyURLConnection(u);
>     }
>     protected void parseURL(URL u, String spec, int start, int limit) {
>         super.parseURL(u, spec, start, limit);
>     }
>     protected void setURL(URL u, String protocol, String host, int port, String file,
String ref) {
>         super.setURL(u, protocol, host, port, file, ref);
>     }
>     protected void setURL(URL u, String protocol, String host, int port, String authority,
String userInfo, String path, String query, String ref) {
>         super.setURL(u, protocol, host, port, authority, userInfo, path, query, ref);
>     }
> }
> =====================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test

> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System
optimized over throughput (initial strategy singleparpar))
> res = java.text.DecimalFormat@674dc
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion
test 
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> Exception in thread "main" java.util.MissingResourceException: Could not find the bundle
com/ibm/icu/impl/data/icudt34b/en_US
> 	at com.ibm.icu.impl.ResourceBundleWrapper.getBundleInstance(ResourceBundleWrapper.java:17)
> 	at com.ibm.icu.util.UResourceBundle.instantiateBundle(UResourceBundle.java:511)
> 	at com.ibm.icu.util.UResourceBundle.getBundleInstance(UResourceBundle.java:127)
> 	at com.ibm.icu.util.UResourceBundle.getBundleInstance(UResourceBundle.java:18)
> 	at com.ibm.icu.util.UResourceBundle.getBundleInstance(UResourceBundle.java:195)
> 	at com.ibm.icu.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols.java:555)
> 	at com.ibm.icu.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:58)
> 	at java.text.DecimalFormat.<init>(DecimalFormat.java:88)
> 	at java.text.DecimalFormat.<init>(DecimalFormat.java:70)
> 	at test.main(test.java:12)
> C:\tmp\tmp17>C:\harmony\drlvm1.5\build\win_ia32_msvc_debug\deploy\jre\bin\java -Dvm.assert_dialog=false
-cp . -showversion test 
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r431487, (Aug 15 2006), Windows/ia32/msvc 1310, debug build
> http://incubator.apache.org/harmony
> java.lang.ClassCastException
> 	at java.net.URLClassLoader.findResourceImpl(URLClassLoader.java:708)
> 	at java.net.URLClassLoader$5.run(URLClassLoader.java:665)
> 	at java.net.URLClassLoader$5.run(URLClassLoader.java:664)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.net.URLClassLoader.findResource(URLClassLoader.java:663)
> 	at java.lang.ClassLoader$BootstrapLoader.findResource()
> 	at java.lang.ClassLoader.getResource()
> 	at java.lang.ClassLoader.getResourceAsStream()
> 	at java.lang.ClassLoader.getSystemResourceAsStream()
> 	at java.util.ResourceBundle$1.run(ResourceBundle.java:277)
> 	at java.util.ResourceBundle$1.run(ResourceBundle.java:276)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.util.ResourceBundle.handleGetBundle(ResourceBundle.java:275)
> 	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:158)
> 	at java.util.ResourceBundle.getBundle(ResourceBundle.java:100)
> 	at java.util.Locale$3.run(Locale.java:732)
> 	at java.util.Locale$3.run(Locale.java:731)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.util.Locale.getBundle(Locale.java:730)
> 	at java.util.Currency.getInstance(Currency.java:95)
> 	at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:72)
> 	at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:55)
> 	at java.text.DecimalFormat.<init>(DecimalFormat.java:70)
> 	at test.main(test.java:12)
> C:\tmp\tmp17>C:\harmony\drlvm1.5\build\win_ia32_msvc_release\deploy\jre\bin\java -Dvm.assert_dialog=false
-cp . -showversion test 
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r431487, (Aug 15 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> java.lang.ClassCastException
> 	at java.net.URLClassLoader.findResourceImpl(URLClassLoader.java:708)
> 	at java.net.URLClassLoader$5.run(URLClassLoader.java:665)
> 	at java.net.URLClassLoader$5.run(URLClassLoader.java:664)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.net.URLClassLoader.findResource(URLClassLoader.java:663)
> 	at java.lang.ClassLoader$BootstrapLoader.findResource()
> 	at java.lang.ClassLoader.getResource()
> 	at java.lang.ClassLoader.getResourceAsStream()
> 	at java.lang.ClassLoader.getSystemResourceAsStream()
> 	at java.util.ResourceBundle$1.run(ResourceBundle.java:277)
> 	at java.util.ResourceBundle$1.run(ResourceBundle.java:276)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.util.ResourceBundle.handleGetBundle(ResourceBundle.java:275)
> 	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:158)
> 	at java.util.ResourceBundle.getBundle(ResourceBundle.java:100)
> 	at java.util.Locale$3.run(Locale.java:732)
> 	at java.util.Locale$3.run(Locale.java:731)
> 	at java.security.AccessController.doPrivilegedImpl()
> 	at java.security.AccessController.doPrivileged()
> 	at java.util.Locale.getBundle(Locale.java:730)
> 	at java.util.Currency.getInstance(Currency.java:95)
> 	at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:72)
> 	at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:55)
> 	at java.text.DecimalFormat.<init>(DecimalFormat.java:70)
> 	at test.main(test.java:12)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message