ICU-12611 Fix some issues found through static analysis.
X-SVN-Rev: 38939
This commit is contained in:
parent
b592f5bfb7
commit
1234c9e54d
@ -670,15 +670,19 @@ public class ICUResourceBundle extends UResourceBundle {
|
||||
InputStream s = root.getResourceAsStream(bn + FULL_LOCALE_NAMES_LIST);
|
||||
if (s != null) {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(s, "ASCII"));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.length() != 0 && !line.startsWith("#")) {
|
||||
locales.add(line);
|
||||
try {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.length() != 0 && !line.startsWith("#")) {
|
||||
locales.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
finally {
|
||||
br.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
// swallow it
|
||||
}
|
||||
}
|
||||
|
@ -596,10 +596,21 @@ public class TimeZoneGenericNames implements Serializable, Freezable<TimeZoneGen
|
||||
* {@link TimeZoneGenericNames#find(String, int, EnumSet)}.
|
||||
*/
|
||||
public static class GenericMatchInfo {
|
||||
GenericNameType nameType;
|
||||
String tzID;
|
||||
int matchLength;
|
||||
TimeType timeType = TimeType.UNKNOWN;
|
||||
final GenericNameType nameType;
|
||||
final String tzID;
|
||||
final int matchLength;
|
||||
final TimeType timeType;
|
||||
|
||||
private GenericMatchInfo(GenericNameType nameType, String tzID, int matchLength) {
|
||||
this(nameType, tzID, matchLength, TimeType.UNKNOWN);
|
||||
}
|
||||
|
||||
private GenericMatchInfo(GenericNameType nameType, String tzID, int matchLength, TimeType timeType) {
|
||||
this.nameType = nameType;
|
||||
this.tzID = tzID;
|
||||
this.matchLength = matchLength;
|
||||
this.timeType = timeType;
|
||||
}
|
||||
|
||||
public GenericNameType nameType() {
|
||||
return nameType;
|
||||
@ -640,11 +651,7 @@ public class TimeZoneGenericNames implements Serializable, Freezable<TimeZoneGen
|
||||
if (_types != null && !_types.contains(info.type)) {
|
||||
continue;
|
||||
}
|
||||
GenericMatchInfo matchInfo = new GenericMatchInfo();
|
||||
matchInfo.tzID = info.tzID;
|
||||
matchInfo.nameType = info.type;
|
||||
matchInfo.matchLength = matchLength;
|
||||
//matchInfo.timeType = TimeType.UNKNOWN;
|
||||
GenericMatchInfo matchInfo = new GenericMatchInfo(info.type, info.tzID, matchLength);
|
||||
if (_matches == null) {
|
||||
_matches = new LinkedList<GenericMatchInfo>();
|
||||
}
|
||||
@ -811,11 +818,7 @@ public class TimeZoneGenericNames implements Serializable, Freezable<TimeZoneGen
|
||||
}
|
||||
assert(tzID != null);
|
||||
|
||||
GenericMatchInfo gmatch = new GenericMatchInfo();
|
||||
gmatch.nameType = nameType;
|
||||
gmatch.tzID = tzID;
|
||||
gmatch.matchLength = matchInfo.matchLength();
|
||||
gmatch.timeType = timeType;
|
||||
GenericMatchInfo gmatch = new GenericMatchInfo(nameType, tzID, matchInfo.matchLength(), timeType);
|
||||
|
||||
return gmatch;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class UnicodeSetStringSpan {
|
||||
private short[] spanLengths;
|
||||
|
||||
/** Maximum lengths of relevant strings. */
|
||||
private int maxLength16;
|
||||
private final int maxLength16;
|
||||
|
||||
/** Are there strings that are not fully contained in the code point set? */
|
||||
private boolean someRelevant;
|
||||
@ -108,6 +108,7 @@ public class UnicodeSetStringSpan {
|
||||
int stringsLength = strings.size();
|
||||
|
||||
int i, spanLength;
|
||||
int maxLength16 = 0;
|
||||
someRelevant = false;
|
||||
for (i = 0; i < stringsLength; ++i) {
|
||||
String string = strings.get(i);
|
||||
@ -120,6 +121,7 @@ public class UnicodeSetStringSpan {
|
||||
maxLength16 = length16;
|
||||
}
|
||||
}
|
||||
this.maxLength16 = maxLength16;
|
||||
if (!someRelevant && (which & WITH_COUNT) == 0) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user