wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Levy <jel...@gmail.com>
Subject Re: Mysterious NullPointerException
Date Wed, 01 Jul 2009 16:41:09 GMT
I'm trying this, what do you think?
        if (e == null) {
            log.error("The exception was null, dumping Stack");
            Thread.dumpStack();
        }

            StackTraceElement[] out = e.getStackTrace();
            StringBuffer sb = new StringBuffer();

            for (StackTraceElement ex : out) {
                sb.append(ex.toString() + "\n");
            }

            if (out.length == 0) {
                log.error("The exception had a length of 0, dumping Stack");
                Thread.dumpStack();
            }


What I have seen so far is that e.getStackTrace() has a length of 0, so I
added the thread dump...

Jeremy
On Mon, Jun 29, 2009 at 4:26 PM, Igor Vaynberg <igor.vaynberg@gmail.com>wrote:

> even if the exception was not being chained it should have still had
> some sort of a stacktrace.
>
> -igor
>
> On Mon, Jun 29, 2009 at 11:39 AM, Martijn
> Reuvers<martijn.reuvers@gmail.com> wrote:
> > Likely the message or stacktrace(s) (the actual cause) is throwing the
> > nullpointer, in which case that is all you can see when logging. You
> > might wanna try: log.error("whatever here",e.getCause()), generally
> > the latter is what you're interested in anyway. You might also try:
> >
> >
> >  @Override
> >  protected void logRuntimeException(RuntimeException e) {
> >        //super.logRuntimeException(e); // Turn this one off as
> > somewhere the error seems to occur
> >        log.error("whatever, but NOT the message",e);
> >   }
> >
> > Finally, I'd personally attempt to write it all to a custom file to
> > see if you can get anything useful into it.
> >
> > On Mon, Jun 29, 2009 at 6:49 PM, Igor Vaynberg<igor.vaynberg@gmail.com>
> wrote:
> >> log.runtimeexception is already doing log.error(e.getMessage(), e);
> >> and he is still not seeing the stacktrace...
> >>
> >> -igor
> >>
> >> On Mon, Jun 29, 2009 at 9:41 AM, mbrictson<matt@55minutes.com> wrote:
> >>>
> >>> If you simply call log.error(e), your log will only contain
> e.toString(),
> >>> which does not include the stack trace. You need to use the 2-arg
> version of
> >>> log.error() if you want the full trace.
> >>>
> >>> Try this:
> >>>
> >>> log.error("An uncaught runtime exception occurred", e);
> >>>
> >>>
> >>> jelevy wrote:
> >>>>
> >>>> Igor,
> >>>> Can you give me some direction on how to go about getting the "e".
> >>>>
> >>>> In my own RequestCycle I've done the following:
> >>>>
> >>>>  @Override
> >>>>     protected void logRuntimeException(RuntimeException e) {
> >>>>         super.logRuntimeException(e);
> >>>>         log.error(e);
> >>>>     }
> >>>>
> >>>>
> >>> --
> >>> View this message in context:
> http://www.nabble.com/Mysterious-NullPointerException-tp24094116p24257631.html
> >>> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Levy

See my location in real-time:
http://seemywhere.com/jeremy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message