ICU-19 Ignore bogus locale names.
X-SVN-Rev: 6253
This commit is contained in:
parent
1e60753217
commit
584d033067
@ -28,6 +28,8 @@ public class TestUScript extends TestFmwk{
|
||||
new Locale("te","IN"),
|
||||
new Locale("hi",""),
|
||||
new Locale("he",""), new Locale("ar",""),
|
||||
new Locale("abcde",""),
|
||||
new Locale("abcde","cdef")
|
||||
};
|
||||
final int[] expected ={
|
||||
/* locales should return */
|
||||
@ -35,6 +37,7 @@ public class TestUScript extends TestFmwk{
|
||||
UScript.CYRILLIC, UScript.TAMIL,
|
||||
UScript.TELUGU,UScript.DEVANAGARI,
|
||||
UScript.HEBREW, UScript.ARABIC,
|
||||
UScript.INVALID_CODE,UScript.INVALID_CODE
|
||||
};
|
||||
int i =0;
|
||||
int numErrors =0;
|
||||
|
@ -762,7 +762,7 @@ public final class UScript {
|
||||
}
|
||||
|
||||
private static final String localeScript = "com.ibm.text.resources.LocaleScript";
|
||||
|
||||
|
||||
private static int findCodeFromLocale(Locale locale)
|
||||
throws MissingResourceException{
|
||||
//TODO: Currently we use a hacked fallback mechanism.
|
||||
@ -779,12 +779,13 @@ public final class UScript {
|
||||
code = scriptNameCodes[strIndex];
|
||||
}
|
||||
}catch(MissingResourceException e){
|
||||
|
||||
/* handle fallback */
|
||||
int index = temp.indexOf('_');
|
||||
if(index >0){
|
||||
temp = temp.substring(0,index);
|
||||
}else{
|
||||
temp = "root";
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ public class TestUScript extends TestFmwk{
|
||||
new Locale("te","IN"),
|
||||
new Locale("hi",""),
|
||||
new Locale("he",""), new Locale("ar",""),
|
||||
new Locale("abcde",""),
|
||||
new Locale("abcde","cdef")
|
||||
};
|
||||
final int[] expected ={
|
||||
/* locales should return */
|
||||
@ -35,6 +37,7 @@ public class TestUScript extends TestFmwk{
|
||||
UScript.CYRILLIC, UScript.TAMIL,
|
||||
UScript.TELUGU,UScript.DEVANAGARI,
|
||||
UScript.HEBREW, UScript.ARABIC,
|
||||
UScript.INVALID_CODE,UScript.INVALID_CODE
|
||||
};
|
||||
int i =0;
|
||||
int numErrors =0;
|
||||
|
@ -762,7 +762,7 @@ public final class UScript {
|
||||
}
|
||||
|
||||
private static final String localeScript = "com.ibm.text.resources.LocaleScript";
|
||||
|
||||
|
||||
private static int findCodeFromLocale(Locale locale)
|
||||
throws MissingResourceException{
|
||||
//TODO: Currently we use a hacked fallback mechanism.
|
||||
@ -779,12 +779,13 @@ public final class UScript {
|
||||
code = scriptNameCodes[strIndex];
|
||||
}
|
||||
}catch(MissingResourceException e){
|
||||
|
||||
/* handle fallback */
|
||||
int index = temp.indexOf('_');
|
||||
if(index >0){
|
||||
temp = temp.substring(0,index);
|
||||
}else{
|
||||
temp = "root";
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user