At  1:07 10 Oct 1999 -0500, James G. Stallings II wrote:

> I guess what I'm looking for is some solid suggestions for debugging.
> Should I write some kind of exception catcher for the null pointer
> exception? It happens early in the code execution; here's the dump:
> 
> Exception in thread "main" java.lang.NullPointerException:
>                   at java.awt.Container.addImpl(Container.java:316)
>                   at java.awt.Container.add(Container.java:245)
>                   at Tedit.<init>(Tedit.java:100)
>                   at Tedit.main(Tedit.java:557)
> 
> Are the numbers listed in the dump line numbers in the source code?
> bytecode offsets in the class file? Should I just stick to C and remain
> a dinosaur?   ;^)

Yes, they're line numbers.  I hardly ever have to use jdb to debug a java
app, all because of this lovely feature.

This looks to me like a peer problem.  If you recall, java.awt components
have a native (C code) peer that is 'actually' used to do the work of
interfacing to the OS.

It looks to me like you're doing something that requires a peer before it
is initialised.  A peer is created when you show() a window, or when you
call addNotify().

My suggestion: call addNotify() just before line 100 in Tedit.java.

Let me know if it works. :)

Paul


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to