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)
Just curious. How do you have that date format ? Did you patch your cvs server to have ISO8601 date ?
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.
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"); ... }
Also BUG 30576 looks like a duplicate of this one (or vice versa.)
*** This bug has been marked as a duplicate of 30576 ***