Strange behaviour with ResourceBundle - SUN vs GCJ?

Bryce McKinlay mckinlay@redhat.com
Wed Mar 9 15:35:00 GMT 2005


Martin,
This is fixed in gcj 4.0. Any chance you could make a mauve test from 
your test case? It would be nice to have test coverage for this.
Cheers
Bryce
Martin Egholm Nielsen wrote:
> Hi there,
>> I don't know if this may have been addressed before - or maybe even 
> "solved" in newer GCJ releases.
> I've seen it with both gcj 3.3.3 and 3.4.1. I have the 
> class/application listed below. With SUNs VM I get the "expected" output:
>> 0
> 1
> Missing!
> DONE!
>> Whereas when I run with GCJ (not GIJ) I get:
>> 0
> 1
> 1
> 1
> ... continues, until the app is killed.
>> I know that the ResourceBundle class tries to load/find the given 
> resource-bundle in the class "UserLog", but as the constructor is 
> hidden, I don't see why it should be allowed for it to construct an 
> instance?
>> I know how to work around it, but I just wondered...
>> // Martin
>> =============================
> package men.log;
>> import java.util.MissingResourceException;
> import java.util.ResourceBundle;
>> public final class UserLog
> {
> /**
> * Hidden constructor!
> */
> private UserLog()
> {
> try
> {
> System.out.println("1");
> // Try to find (non-existing) "men.log.UserLog.properties"
> ResourceBundle.getBundle(UserLog.class.getName());
> System.out.println("2");
> } // try
> catch (MissingResourceException mre)
> {
> System.out.println("Missing!");
> } // catch
> } // constr.
>> public static void main(String[] args)
> {
> System.out.println("0");
> UserLog ul = new UserLog();
> System.out.println("DONE!");
> } // main
> } // UserLog
> ==========================
>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /