ICU-19 Ignore bogus locale names.

X-SVN-Rev: 6253
This commit is contained in:
Ram Viswanadha 2001-10-16 00:18:28 +00:00
parent 1e60753217
commit 584d033067
4 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}