8027930: ResourceBundle test failures in fr locale
Reviewed-by: smarks
This commit is contained in:
parent
7950bec46c
commit
e6f691aeb2
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@test
|
@test
|
||||||
@bug 4049325 4073127 4083270 4106034 4108126
|
@bug 4049325 4073127 4083270 4106034 4108126 8027930
|
||||||
@summary test Resource Bundle
|
@summary test Resource Bundle
|
||||||
@build TestResource TestResource_de TestResource_fr TestResource_fr_CH
|
@build TestResource TestResource_de TestResource_fr TestResource_fr_CH
|
||||||
@build TestResource_it FakeTestResource
|
@build TestResource_it FakeTestResource
|
||||||
@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.ResourceBundle.Control;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class ResourceBundleTest extends RBTestFmwk {
|
public class ResourceBundleTest extends RBTestFmwk {
|
||||||
@ -134,7 +135,8 @@ public class ResourceBundleTest extends RBTestFmwk {
|
|||||||
// load up the resource and check to make sure we got the right class
|
// load up the resource and check to make sure we got the right class
|
||||||
// (we don't define be_BY or be, so we fall back on the root default)
|
// (we don't define be_BY or be, so we fall back on the root default)
|
||||||
ResourceBundle bundle = ResourceBundle.getBundle("TestResource",
|
ResourceBundle bundle = ResourceBundle.getBundle("TestResource",
|
||||||
new Locale("be", "BY"));
|
new Locale("be", "BY"),
|
||||||
|
Control.getNoFallbackControl(Control.FORMAT_DEFAULT));
|
||||||
if (!bundle.getClass().getName().equals("TestResource"))
|
if (!bundle.getClass().getName().equals("TestResource"))
|
||||||
errln("Expected TestResource, got " + bundle.getClass().getName());
|
errln("Expected TestResource, got " + bundle.getClass().getName());
|
||||||
|
|
||||||
@ -268,7 +270,8 @@ public class ResourceBundleTest extends RBTestFmwk {
|
|||||||
// try to find TestResource_iw_IL, which doesn't exist. Should get root locale
|
// try to find TestResource_iw_IL, which doesn't exist. Should get root locale
|
||||||
// as its locale
|
// as its locale
|
||||||
test = ResourceBundle.getBundle("TestResource",
|
test = ResourceBundle.getBundle("TestResource",
|
||||||
new Locale("iw", "IL", ""));
|
new Locale("iw", "IL", ""),
|
||||||
|
Control.getNoFallbackControl(Control.FORMAT_DEFAULT));
|
||||||
locale = test.getLocale();
|
locale = test.getLocale();
|
||||||
if (!(locale.getLanguage().equals("")) || !(locale.getCountry().equals("")))
|
if (!(locale.getLanguage().equals("")) || !(locale.getCountry().equals("")))
|
||||||
errln("Actual locale for TestResource_iw_IL should have been the root locale, got "
|
errln("Actual locale for TestResource_iw_IL should have been the root locale, got "
|
||||||
|
@ -29,7 +29,7 @@ import java.util.ResourceBundle;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 4814565
|
* @bug 4814565 8027930
|
||||||
* @summary tests ResourceBundle.getBaseBundleName();
|
* @summary tests ResourceBundle.getBaseBundleName();
|
||||||
* @build TestGetBaseBundleName resources.ListBundle resources.ListBundle_fr
|
* @build TestGetBaseBundleName resources.ListBundle resources.ListBundle_fr
|
||||||
* @run main TestGetBaseBundleName
|
* @run main TestGetBaseBundleName
|
||||||
@ -52,18 +52,20 @@ public class TestGetBaseBundleName {
|
|||||||
PROPERTY_BUNDLE_NAME,
|
PROPERTY_BUNDLE_NAME,
|
||||||
LIST_BUNDLE_NAME
|
LIST_BUNDLE_NAME
|
||||||
}) {
|
}) {
|
||||||
ResourceBundle bundle = ResourceBundle.getBundle(baseName);
|
|
||||||
System.out.println(getBaseName(bundle));
|
|
||||||
if (!Locale.ROOT.equals(bundle.getLocale())) {
|
|
||||||
throw new RuntimeException("Unexpected locale: "
|
|
||||||
+ bundle.getLocale());
|
|
||||||
}
|
|
||||||
if (!baseName.equals(getBaseName(bundle))) {
|
|
||||||
throw new RuntimeException("Unexpected base name: "
|
|
||||||
+ getBaseName(bundle));
|
|
||||||
}
|
|
||||||
Locale.setDefault(Locale.FRENCH);
|
|
||||||
try {
|
try {
|
||||||
|
Locale.setDefault(Locale.US);
|
||||||
|
ResourceBundle bundle = ResourceBundle.getBundle(baseName);
|
||||||
|
System.out.println(getBaseName(bundle));
|
||||||
|
if (!Locale.ROOT.equals(bundle.getLocale())) {
|
||||||
|
throw new RuntimeException("Unexpected locale: "
|
||||||
|
+ bundle.getLocale());
|
||||||
|
}
|
||||||
|
if (!baseName.equals(getBaseName(bundle))) {
|
||||||
|
throw new RuntimeException("Unexpected base name: "
|
||||||
|
+ getBaseName(bundle));
|
||||||
|
}
|
||||||
|
|
||||||
|
Locale.setDefault(Locale.FRENCH);
|
||||||
ResourceBundle bundle_fr = ResourceBundle.getBundle(baseName);
|
ResourceBundle bundle_fr = ResourceBundle.getBundle(baseName);
|
||||||
if (!Locale.FRENCH.equals(bundle_fr.getLocale())) {
|
if (!Locale.FRENCH.equals(bundle_fr.getLocale())) {
|
||||||
throw new RuntimeException("Unexpected locale: "
|
throw new RuntimeException("Unexpected locale: "
|
||||||
|
Loading…
Reference in New Issue
Block a user