Bug 32583 - cvschangelog throes NullPointerException with some CVS server
Summary: cvschangelog throes NullPointerException with some CVS server
Status: RESOLVED DUPLICATE of bug 30576
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.2
Hardware: PC Windows 2000
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-08 12:07 UTC by Dmitry
Modified: 2008-02-22 12:18 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2004-12-08 12:07:02 UTC
We encountered with the NullPointerException in using cvschangelog task.

The full exception stack trace is below. In debugging we found that the problem 
in parsing dates. The pattern is "yyyy/MM/dd HH:mm:ss" (see c_inputDate field 
in org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser).

The CVS server we used logs dates in another format. Here is cites from command
cvs log -d ">=2004/11/08" :

<....>
revision 1.46
date: 2004-12-07 10:38:04 +0000;  author: user1;  state: Exp;  lines: +23 -21
comment1
----------------------------
revision 1.45
date: 2004-12-02 23:01:05 +0000;  author: user2;  state: Exp;  lines: +5 -2
commment2
----------------------------
<....>

I think the cvschangelog task should try to parse date with several formats.

Here is full exception stack trace:
D:\project\cvschangelog_ant.xml:3: java.lang.NullPointerException
        at org.apache.tools.ant.Task.perform(Task.java:373)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.lang.NullPointerException
        at java.util.Date.after(Date.java:871)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.filterEntrySet(Cha
ngeLogTask.java:333)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.execute(ChangeLogT
ask.java:262)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        ... 8 more
--- Nested Exception ---
java.lang.NullPointerException
        at java.util.Date.after(Date.java:871)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.filterEntrySet(Cha
ngeLogTask.java:333)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.execute(ChangeLogT
ask.java:262)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Comment 1 Stephane Bailliez 2004-12-08 19:30:51 UTC
Just curious. How do you have that date format ?
Did you patch your cvs server to have ISO8601 date ?
Comment 2 Dmitry 2004-12-08 20:07:08 UTC
The cvs server was installed by our customer. So I don't know about the patach mentioned. 

Also I'd like to add that the date which is tried to parse doesn't contain timezone information. I mean that our cvs server returns 2004-12-07 10:38:04 +0000, but only String 2004-12-07 10:38:04 is passed to parse into SimpleDateFormat. I think SimpleDateFormat will use default client time zone, which is not +0000 in our case.
Comment 3 Ian Adam 2005-05-27 04:03:08 UTC
We encountered this also after moveing from an old CVS server to a new one.  New
CVS versions supply ISO date format, eg from
http://jira.public.thoughtworks.org/browse/CC-38

In cvs 1.12.9, the output format of the cvs log command was changed. In
particular, the date: line now uses "-" as a date separator instead of "/", and
adds a new field ("+0000").

The code at issue is 
http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java?rev=1.29&view=markup

class ChangeLogParser {
...
/** input format for dates read in from cvs log */
    private static final SimpleDateFormat INPUT_DATE
        = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
...
}
Comment 4 Ian Adam 2005-05-27 04:09:51 UTC
Also BUG 30576 looks like a duplicate of this one (or vice versa.)
Comment 5 Matt Benson 2005-05-27 15:39:09 UTC

*** This bug has been marked as a duplicate of 30576 ***