Details about the known misuse from the MUBench dataset.
Description: | The Zone constructor in org.joda.time.tz.ZoneInfoCompiler.java does not
check the number of elements in the StringTokenizer obtained from parsing
the timezone file. There is an assumption that the input TimeZone file
will always be valid, leading to runtime exceptions with no good error
message when the file is invalid. This pull request adds a potential fix
and a test for this issue. |
Fix Description: |
(see diff) |
Violation Types: |
- missing/condition/value_or_state
|
In File: | org/joda/time/tz/ZoneInfoCompiler.java |
In Method: | Zone(String, StringTokenizer) |
Code with Misuse: |
class ZoneInfoCompiler.Zone {
private Zone(String name, StringTokenizer st) {
iName = name.intern();
iOffsetMillis = parseTime(st.nextToken());
iRules = parseOptional(st.nextToken());
iFormat = st.nextToken().intern();
int year = Integer.MAX_VALUE;
DateTimeOfYear dtOfYear = getStartOfYear();
if (st.hasMoreTokens()) {
year = Integer.parseInt(st.nextToken());
if (st.hasMoreTokens()) {
dtOfYear = new DateTimeOfYear(st);
}
}
iUntilYear = year;
iUntilDateTimeOfYear = dtOfYear;
}
}
|