You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Markov (JIRA)" <ji...@apache.org> on 2007/05/18 14:20:16 UTC
[jira] Commented: (HARMONY-3823) [classlib][luni] Wrong
implementation of strategy for instantiating resource bundles in
java.util.ResourceBundle
[ https://issues.apache.org/jira/browse/HARMONY-3823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496860 ]
Mikhail Markov commented on HARMONY-3823:
-----------------------------------------
Thanks, Alexei! Applied as expected.
> [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
> Assigned To: Alexei Zakharov
> Priority: Critical
> Attachments: H-3823.patch, H-3823_test.patch, test.zip
>
>
> 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.