NullPointerException debugging from XCode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NullPointerException debugging from XCode

Stackman317
I am working on a plugin for registration of stacks of tomography images for which I am making use of a great 3rd party plugin that can do the job excellently for pairs of images - my plugin essentially handles the stack and the other plugin to enable pairwise registration of a whole stack.

This external plugin is constructed as a control class which utilizes a whole package of subordinate utility classes. Since I want to modify the control class somewhat, I'm including a version of it as my own class file, and importing the package of utility methods for it to use. (I'm coding in XCode and adding this plugin's jar to my build path in my ant .xml file.)

Now, my problem comes when I try to run my plugin in ImageJ. At some point one of the utility methods throws a NullPointerException (My plugin is AutobUnJ, the modified control class is bUnwarpJx, and the imported utility package is bunwarpj - sorry about the confusing names):

java.lang.NullPointerException
        at bunwarpj.bUnwarpJTransformation.<init>(bUnwarpJTransformation.java:332)
        at AutobUnJ.bUnwarpJx.alignImagesCommandLine(bUnwarpJx.java:407)
        at AutobUnJ.bUnwarpJx.main(bUnwarpJx.java:209)
        at AutobUnJ.AutobUnJ1_4.alignPair(AutobUnJ1_4.java:450)
        at AutobUnJ.AutobUnJ1_4.run(AutobUnJ1_4.java:102)
        at ij.IJ.runUserPlugIn(IJ.java:176)
        at ij.IJ.runPlugIn(IJ.java:142)
        at ij.Executer.runCommand(Executer.java:119)
        at ij.Executer.run(Executer.java:58)
        at java.lang.Thread.run(Thread.java:637)

There are a lot of objects being passed around at the point where this seems to occur, so most likely one of them has been passed or declared wrongly (although everything builds in XCode without error). Unfortunately, the line references are clearly inaccurate relative to the .java files open in XCode.

So after all of that, my actual question is whether anyone has advice for figuring out exactly where the error is coming from... It ought to be in either the AutobUnJ1_4 code or the bUnwarpJx code, since I haven't modified the utility methods at all, and they work fine in the unmodified bUnwarpJ plugin.

Thanks to anyone who's taken the time to read through all this!
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException debugging from XCode

dscho
Hi,

On Fri, 23 Jan 2009, Stackman317 wrote:

> java.lang.NullPointerException
> at bunwarpj.bUnwarpJTransformation.<init>(bUnwarpJTransformation.java:332)
> at AutobUnJ.bUnwarpJx.alignImagesCommandLine(bUnwarpJx.java:407)
> at AutobUnJ.bUnwarpJx.main(bUnwarpJx.java:209)
> at AutobUnJ.AutobUnJ1_4.alignPair(AutobUnJ1_4.java:450)
> at AutobUnJ.AutobUnJ1_4.run(AutobUnJ1_4.java:102)
> at ij.IJ.runUserPlugIn(IJ.java:176)
> at ij.IJ.runPlugIn(IJ.java:142)
> at ij.Executer.runCommand(Executer.java:119)
> at ij.Executer.run(Executer.java:58)
> at java.lang.Thread.run(Thread.java:637)

You have two options now.  Either you set a breakpoint at line 332 of
bUnwarpTransformation.java, if XCode allows you to do that, or you have to
instrument that code (read: insert debug print statements) to find out
what object is null that is not supposed to be null.

Ciao,
Dscho