You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Sandro Martini (JIRA)" <ji...@apache.org> on 2010/07/22 14:05:50 UTC

[jira] Updated: (PIVOT-577) Time.decode() throws NPE when no milliseconds present in input string

     [ https://issues.apache.org/jira/browse/PIVOT-577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandro Martini updated PIVOT-577:
---------------------------------

         Assignee: Sandro Martini
    Fix Version/s: 1.5.1

> 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
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 1.5.1
>
>
> 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.