Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0514cf

Browse files
author
zhourenjian
committed
Modify so it could be compiled under JDK 6
1 parent d81be5b commit b0514cf

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

sources/net.sf.j2s.java.core/src/java/util/Locale.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
package java.util;
2424

2525
import java.io.*;
26-
import java.security.AccessController;
26+
// import java.security.AccessController;
2727
import java.text.MessageFormat;
28-
import sun.security.action.GetPropertyAction;
29-
import sun.text.resources.LocaleData;
28+
// import sun.security.action.GetPropertyAction;
29+
// import sun.text.resources.LocaleData;
3030

3131
/**
3232
*
@@ -325,11 +325,11 @@ public static Locale getDefault() {
325325
*/
326326
{
327327
String language, region, country, variant;
328-
language = (String) AccessController.doPrivileged(
329-
new GetPropertyAction("user.language", "en"));
328+
language = null; /* (String) AccessController.doPrivileged(
329+
new GetPropertyAction("user.language", "en")); */
330330
// for compatibility, check for old user.region property
331-
region = (String) AccessController.doPrivileged(
332-
new GetPropertyAction("user.region"));
331+
region = null; /* (String) AccessController.doPrivileged(
332+
new GetPropertyAction("user.region")); */
333333
if (region != null) {
334334
// region can be of form country, country_variant, or _variant
335335
int i = region.indexOf('_');
@@ -341,10 +341,10 @@ public static Locale getDefault() {
341341
variant = "";
342342
}
343343
} else {
344-
country = (String) AccessController.doPrivileged(
345-
new GetPropertyAction("user.country", ""));
346-
variant = (String) AccessController.doPrivileged(
347-
new GetPropertyAction("user.variant", ""));
344+
country = null; /* (String) AccessController.doPrivileged(
345+
new GetPropertyAction("user.country", "")); */
346+
variant = null; /* (String) AccessController.doPrivileged(
347+
new GetPropertyAction("user.variant", "")); */
348348
}
349349
defaultLocale = new Locale(language, country, variant);
350350
}
@@ -421,7 +421,7 @@ public static synchronized void setDefault(Locale newLocale) {
421421
];
422422
*/
423423
public static Locale[] getAvailableLocales() {
424-
return LocaleData.getAvailableLocales("LocaleString");
424+
return null; // LocaleData.getAvailableLocales("LocaleString");
425425
}
426426

427427
/**
@@ -623,7 +623,7 @@ public String getDisplayLanguage(Locale inLocale) {
623623

624624
while (!done) {
625625
try {
626-
ResourceBundle bundle = LocaleData.getLocaleElements(workingLocale);
626+
ResourceBundle bundle = null; // LocaleData.getLocaleElements(workingLocale);
627627
result = findStringMatch((String[][])bundle.getObject("Languages"),
628628
langCode, langCode);
629629
if (result.length() != 0)
@@ -709,7 +709,7 @@ public String getDisplayCountry(Locale inLocale) {
709709

710710
while (!done) {
711711
try {
712-
ResourceBundle bundle = LocaleData.getLocaleElements(workingLocale);
712+
ResourceBundle bundle = null; // LocaleData.getLocaleElements(workingLocale);
713713
result = findStringMatch((String[][])bundle.getObject("Countries"),
714714
ctryCode, ctryCode);
715715
if (result.length() != 0)
@@ -767,7 +767,7 @@ public String getDisplayVariant(Locale inLocale) {
767767
if (variant.length() == 0)
768768
return "";
769769

770-
ResourceBundle bundle = LocaleData.getLocaleElements(inLocale);
770+
ResourceBundle bundle = null; // LocaleData.getLocaleElements(inLocale);
771771

772772
String names[] = getDisplayVariantArray(bundle);
773773

@@ -827,7 +827,7 @@ public final String getDisplayName() {
827827
* }
828828
*/
829829
public String getDisplayName(Locale inLocale) {
830-
ResourceBundle bundle = LocaleData.getLocaleElements(inLocale);
830+
ResourceBundle bundle = null; // LocaleData.getLocaleElements(inLocale);
831831

832832
String languageName = getDisplayLanguage(inLocale);
833833
String countryName = getDisplayCountry(inLocale);
@@ -1198,26 +1198,30 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
11981198
* avoid circularity problems between Locale and String.
11991199
* The most straightforward algorithm is used. Look at optimizations later.
12001200
*/
1201+
/*
12011202
private String toLowerCase(String str) {
12021203
char[] buf = str.toCharArray();
12031204
for (int i = 0; i < buf.length; i++) {
12041205
buf[i] = Character.toLowerCase( buf[i] );
12051206
}
12061207
return new String( buf );
12071208
}
1209+
*/
12081210

12091211
/*
12101212
* Locale needs its own, locale insensitive version of toUpperCase to
12111213
* avoid circularity problems between Locale and String.
12121214
* The most straightforward algorithm is used. Look at optimizations later.
12131215
*/
1216+
/*
12141217
private String toUpperCase(String str) {
12151218
char[] buf = str.toCharArray();
12161219
for (int i = 0; i < buf.length; i++) {
12171220
buf[i] = Character.toUpperCase( buf[i] );
12181221
}
12191222
return new String( buf );
12201223
}
1224+
*/
12211225

12221226
/**
12231227
* @j2sIgnore

0 commit comments

Comments
 (0)