ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Jack" <aj...@TrySybase.com>
Subject Caught exception (java.lang.NullPointerException) while expanding...
Date Wed, 18 Jun 2003 15:37:21 GMT
I have a custom task that creates FileSets, and adds references to them.
When it does this it gets this warning message:

	Caught exception (java.lang.NullPointerException) while expanding
lib.checkstyle-	antlib.fileset.export.jars: null

(Note: I am running against a recent nightly, and I have the ant code
checked out of CVS for reference...)

It doesn't seem to do any harm, just puts out an annoying message. Even
with -debug we get no stack trace. Digging in, I see the problem appears to
be when I attempt to register a reference to this FileSet. The addReference
code attempts to call toString() on the FileSet I am attempting to
reference. I think that code crashes (see stack trace below, I called it
direct) and this output would seem to show that.

	FileSet: Setup scanner in dir F:\Ant\tools\jars with patternSet{ includes:
[checkstyle/jars/checkstyle-2.4.jar] excludes: [] }
	[ruperDepend] Included File Entry (0) -> checkstyle\jars\checkstyle-2.4.jar
	Caught exception (java.lang.NullPointerException) while expanding
lib.checkstyle-	antlib.fileset.export.jars: null
	Adding reference: lib.checkstyle-antlib.fileset.export.jars ->

... the reference get's added to "" not my FileSet.

Am I doing something wrong? Ought I be calling a different method in order
to register this FileSet?

Hmm, looking closer at the code, it seems "p" (project) must be null. As
such, I set the project FileSet.setProject(getProject()) from my tasks
project, and low ... the message goes away.

So, is this worth reporting as a bug in toString() [unpleasant behaviour
when project not set] or not worth it?

BTW: I am glad I wrote this mail, it helped me find it, thanks...

regards,

Adam
----------------------------------------------------------------------------
------


Caused by: java.lang.NullPointerException
        at
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFil
eSet.java:404
)
        at
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileS
et.java:380)
        at
org.apache.tools.ant.types.AbstractFileSet.toString(AbstractFileSet.java:666
)
        ... 9 more
--- Nested Exception ---
java.lang.NullPointerException
        at
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFil
eSet.java:404
)
        at
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileS
et.java:380)
        at
org.apache.tools.ant.types.AbstractFileSet.toString(AbstractFileSet.java:666
)
        at org.krysalis.centipede.ant.RuperDependTask.execute(Unknown
Source)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:270)
        at org.apache.tools.ant.Task.perform(Task.java:399)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:128)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:117)
        at org.apache.tools.ant.Main.runBuild(Main.java:596)
        at org.apache.tools.ant.Main.start(Main.java:198)
        at org.apache.tools.ant.Main.main(Main.java:245)

Total time: 7 seconds
--
<http://www.try.sybase.com>
Experience Sybase Technology ...


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


Mime
View raw message