harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Molotkov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3823) [classlib][luni] Wrong implementation of strategy for instantiating resource bundles in java.util.ResourceBundle
Date Tue, 08 May 2007 15:28:15 GMT
[classlib][luni] Wrong implementation of strategy for instantiating resource bundles in java.util.ResourceBundle
----------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-3823
                 URL: https://issues.apache.org/jira/browse/HARMONY-3823
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: all
            Reporter: Vladimir Molotkov
            Priority: Critical


The spec says:
"...
First, it attempts to load a class using the candidate bundle name. If such a class can be
found and loaded using the specified class loader, is assignment compatible with ResourceBundle,
is accessible from ResourceBundle, and can be instantiated, getBundle creates a new instance
of this class and uses it as the result resource bundle."

The following is corresponding code fragment from ResourceBundle:
...
        try {
            Class<?> bundleClass = Class.forName(bundleName, true, loader);
            bundle = (ResourceBundle) bundleClass.newInstance();
            bundle.setLocale(locale);
        } catch (LinkageError e) {
        } catch (Exception e) {
        }
...

As we can see "bundle" class instance may be created even if specified instantiation conditions
are not satisfied.

The bug causes 'Struts test' (http://issues.apache.org/jira/browse/HARMONY-3597) failure.

Attached archive contains simplified test which reproduces struts test situation. Just unzip
and execute:

  javac *.java
  java b

RI test output:
------------------
$ java b
p: set class to 'b'
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle,
key nonexistent
java.util.MissingResourceException: Can't find bundle for base name a, locale en_US
java.util.MissingResourceException: Can't find bundle for base name java.lang.Object, locale
en_US
p: found string 'Name' using key 'name'
PASSED


DRLVM test output:
-------------------------
$ java b
p: set class to 'b'
p: set class to 'b'
java.util.MissingResourceException
p: set class to 'a'
java.util.MissingResourceException
java.util.MissingResourceException
java.util.MissingResourceException
java.util.MissingResourceException
FAILED


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message