Caught a bug in internationalization of Java version "1.6.0-RC"

Source: Internet
Author: User
Import java. util. locale;
Import java. util. missingresourceexception;
Import java. util. resourcebundle;

Public class testi18n ...{
Private String title = gettitle ("title ");

Public static void main (string [] ARGs )...{
Testi18n testi18n = new testi18n ();
System. Out. Print ("title is" + testi18n. Title );
}

Private string gettitle (string key )...{
Resourcebundle = resourcebundle. getbundle (this. getclass (). getname (), locale. simplified_chinese );
String value = NULL;
Try ...{
Value = resourcebundle. getstring (key );
} Catch (missingresourceexception me )...{
Me. printstacktrace ();
}
Return value;
}
}

When initializing the testi18n constructor, we must first execute the initialization of the variable title. At this time, resourcebundle will be called to internationalize, And the bug will pop up. I also heard that Java 6 has added some new functions to the international market. We can see that the bug caused by the upgrade of Java 6 is fixed with the Java version of the local machine.

C:/Documents and Settings/New> JAVA-version
Java version "1.6.0-RC"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b66)
Java hotspot (TM) Client VM (build 1.6.0-rc-b66, mixed mode, sharing)

I checked the newest version is the jdk-6u2-ea of megal 12,200 7, I don't know if this bug has been fixed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.