Time.decode() throws NPE when no milliseconds present in input string
---------------------------------------------------------------------
Key: PIVOT-577
URL: https://issues.apache.org/jira/browse/PIVOT-577
Project: Pivot
Issue Type: Bug
Components: core-util
Affects Versions: 1.5
Environment: JDK 6 Update 21
Reporter: Ilian Pavlov
Priority: Minor
Time.decode("12:34:56.789");
works,
Time.decode("12:34:56")
throws a NullPointerException at
org.apache.pivot.util.Time.decode(Time.java:399)
I believe the problem is that matcher.groupCount() returns # of groups in
pattern, not # of matched, so it always ==5; thus when no milliseconds passed,
matcher.group(4) is null.
if (matcher.groupCount() == 5) {
millisecond = Integer.parseInt(matcher.group(4).substring(1));
} else {
millisecond = 0;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.