Merge pull request !226 from sunyaozu/master
This commit is contained in:
openharmony_ci
2022-09-26 04:33:23 +00:00
committed by Gitee
4 changed files with 15 additions and 13 deletions
@@ -367,7 +367,7 @@ public class Fetcher implements Runnable, Comparable<Fetcher> {
// 5. get plural data
private void getPluralRules(ConfigItem config) {
String str = PluralFetcher.getInstance().get(this.lan);
if (str.equals(null)) {
if (str == null) {
str = "";
}
this.datas.add(str);
@@ -375,7 +375,7 @@ public class Fetcher implements Runnable, Comparable<Fetcher> {
private void getDecimalPluralRules(ConfigItem config) {
String str = PluralFetcher.getInstance().getDecimal(this.lan);
if (str.equals(null)) {
if (str == null) {
str = "";
}
this.datas.add(str);
@@ -461,7 +461,7 @@ public class Fetcher implements Runnable, Comparable<Fetcher> {
// 16. get measure format pattern
private void getMeasureFormatPatterns(ConfigItem config) {
String str = MeasureFormatPatternFetcher.getInstance().get(this.languageTag);
if (str.equals(null)) {
if (str == null) {
str = "";
}
this.datas.add(str);
@@ -501,17 +501,19 @@ public class Fetcher implements Runnable, Comparable<Fetcher> {
String formatValue = formatter.format(-1);
NumberingSystem numberSystem = NumberingSystem.getInstance(locale);
String description = numberSystem.getDescription();
String temp = formatValue.substring(0, formatValue.indexOf(description.charAt(1)));
datas.add(temp);
if (formatValue.length() > 0) {
String temp = formatValue.substring(0, formatValue.indexOf(description.charAt(1)));
datas.add(temp);
}
}
public @Override int compareTo(Fetcher other) {
if (languageTag.equals(null) && other.languageTag.equals(null)) {
if (languageTag == null && other.languageTag == null) {
return 0;
}
if (languageTag.equals(null)) {
if (languageTag == null) {
return -1;
} else if (other.languageTag.equals(null)) {
} else if (other.languageTag == null) {
return 1;
} else {
return languageTag.compareTo(other.languageTag);
@@ -63,7 +63,7 @@ public class MeasureFormatPatternFetcher {
*/
public String get(String locale) {
String pattern = locale2Pattern.get(locale);
if (pattern.equals(null)) {
if (pattern == null) {
return "";
}
return pattern;
@@ -85,7 +85,7 @@ public class PluralFetcher {
*/
public String get(String lan) {
String out = map.get(lan);
if (out.equals(null)) {
if (out == null) {
out = "";
}
return out;
@@ -99,7 +99,7 @@ public class PluralFetcher {
*/
public String getDecimal(String lan) {
String out = decimalMap.get(lan);
if (out.equals(null)) {
if (out == null) {
out = "";
}
return out;
@@ -78,7 +78,7 @@ public class Utils {
* @return returns true if languageTag is valid, otherwise false.
*/
public static boolean isValidLanguageTag(String languageTag) {
if (languageTag.equals(null)) {
if (languageTag == null) {
return false;
}
String[] items = languageTag.split("-");
@@ -114,7 +114,7 @@ public class Utils {
}
private static boolean checkLanguage(String lan) {
if (lan.equals(null)) {
if (lan == null) {
return false;
}
int length = lan.length();