You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/05/17 17:36:16 UTC

[jira] Resolved: (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:all-tabpanel ]

Alexei Zakharov resolved HARMONY-3823.
--------------------------------------

    Resolution: Fixed

Thanks guys. Slightly modified version of the patch was committed at the revision 538967. Please verify that everything is fine.

> [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
>         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.