This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Strange behaviour with ResourceBundle - SUN vs GCJ?
- From: Martin Egholm Nielsen <martin at egholm-nielsen dot dk>
- To: java at gcc dot gnu dot org
- Date: Wed, 09 Mar 2005 10:44:19 +0100
- Subject: Strange behaviour with ResourceBundle - SUN vs GCJ?
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
==========================