Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3878 > unrolled thread

Re: Avoiding NPEs caused

Started by"Lew" <lew@THRWHITE.remove-dii-this>
First post2011-04-27 15:47 +0000
Last post2011-04-27 15:47 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Avoiding NPEs caused "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000

#3878 — Re: Avoiding NPEs caused

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:47 +0000
SubjectRe: Avoiding NPEs caused
Message-ID<V-ednaFymLYdYAjVnZ2dnUVZ_o-dnZ2d@comcast.com>
  To: comp.lang.java.programmer
Royan wrote:
> There is not much sense in stack trace, it's classic problem, i'm [sic] only
> looking for the best solution. If stack really matters here's slightly

And I was only asking for enough information so that people can try to help you.

"Classic problems" have classic solutions, such as having enough information 
to solve the "classic problem", say by examining the error message for clues. 
  Just for example.

> improved example that you can even run yourself and stack trace:

Now that is an SSCCE, thank you.  "Can even run yourself" is the minimum, not 
some generous bonus.

The whole stack trace is not necessary, nor was it what I asked for:
>> ... (copy and paste) the exception message.

> Exception in thread "main" java.lang.NullPointerException
> 	at test.Model.firePropertyChange(Model.java:20)

Is this line 20?
> propertyChangeSupport.firePropertyChange(propertyName,
> oldValue, newValue);

Which one is null, 'propertyChangeSupport', 'propertyName', 'oldValue' or 
'newValue'?

Have you run this in a debugger?

You will note that you are running an overridden method from the superclass 
constructor, always a no-no.  The constructor for the subclass has not yet 
run, so nothing is initialized.

Do not run overridable methods from a constructor.

-- 
Lew
There are two questions for you in this post.  One indication of whether you 
have answered them is whether you have provided two answers.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web