avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <david.g...@hic.gov.au>
Subject Re: Logkit: NullPointerException in JMSQueueTarget constructor
Date Wed, 27 Feb 2002 08:57:48 GMT


Doh! I was actually suprised to see this as well. The other possibility to
solve the problem is to check for the m_errorhandler as null but this would
get tedious and impose an additional overhead every time you call the error
handler and again is not elegant. Does not look OO either.

Incidentally, even if we initialize it to the DefaultErrorHandler, as
AbstractJMSTarget does not call super in the constructor would it get
instantiated?





Peter Donald <peter@apache.org> on 27/02/2002 19:41:56

Please respond to "Avalon Developers List" <avalon-dev@jakarta.apache.org>

To:    "Avalon Developers List" <avalon-dev@jakarta.apache.org>
cc:

Subject:    Re: Logkit: NullPointerException in JMSQueueTarget constructor

On Wed, 27 Feb 2002 18:24, david.gray@hic.gov.au wrote:
> I think that it fails in createQueueConnection(), the code catches the
> exception runs getErrorHandler()  which then throws the NPE because the
> error handler is not defined!

doh!

> If you track through the code, the private variable ErrorHandler
> m_errorHandler in AbstractTarget is never initialized.

It is initialized as soon as the target is associated with a
Hierarchy/Logger. See something like Logger.setupErrorHandlers()

> I suspect the only way to resolve this sort of problem is to initialize
the
> field thus:
>
>     private ErrorHandler m_errorHandler = new
> org.apache.log.util.DefaultErrorHandler();
>
...

Anyone got any better ideas?

--
Cheers,

Pete

---------------------------------------------------------------
The difference between genius, and stupidity? Genius has limits
---------------------------------------------------------------

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org
>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org
>










****************************************************************
NOTICE - This message is intended only for the use of the 
addressee named above and may contain privileged and 
confidential information.  If you are not the intended recipient
of this message you are hereby notified that you must not 
disseminate, copy or take any action based upon it.  If you 
received this message in error please notify HIC immediately.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of HIC.
****************************************************************

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message