You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/10/17 08:30:31 UTC

DO NOT REPLY [Bug 37112] New: - NullPointerException with cvschangelog task

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37112>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37112

           Summary: NullPointerException with cvschangelog task
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: rgeimer@ptc.com


I was running the CVS change log task on my repository, and got a rather 
uninforming NullPointerException:


BUILD FAILED
/home/geimer/projects/aoms_build/build.xml:30: 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.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.NullPointerException
        at java.util.Date.after(Date.java:871)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.filterEntrySet
(ChangeLogTask.java:334)
        at org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask.execute
(ChangeLogTask.java:263)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        ... 10 more


I went to the ant source and added some debugging code, and was able to track 
the problem down to the following place in 
org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser:

    private Date parseDate(final String date) {
        try {
            return c_inputDate.parse(date);
        } catch (ParseException e) {
            //final String message = REZ.getString( "changelog.bat-
date.error", date );
            //getContext().error( message );
            return null;
        }
    }

When I printed the stack trace for the ParserException, I found out it was 
complaining about the date format it encountered, which was "yyyy-MM-dd 
HH:mm:ss" instead of the "yyyy/MM/dd HH:mm:ss" format that it was expecting. I 
fixed this by adding the following code:


    /** alternate input format for dates read in from cvs log */
    private static final SimpleDateFormat alt_c_inputDate
        = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private Date parseDate(final String date) {
        try {
            return c_inputDate.parse(date);
        } catch (ParseException e) {
            //final String message = REZ.getString( "changelog.bat-
date.error", date );
            //getContext().error( message );
            if (date != null){
            	try {
					return alt_c_inputDate.parse(date);
				} catch (ParseException e1){
					e.printStackTrace();
					return null;
				}
			}
            return null;
        }
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org