• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NullPointerException
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NullPointerException


  • Subject: Re: NullPointerException
  • From: Paul D Yu <email@hidden>
  • Date: Sun, 04 Dec 2011 05:48:32 -0500

Kevin

This is a java or may be even programming issue, NOT a WebObjects one.

Because of the || or operator, the runtime has to evaluate the second portion of the condition.  Since errorMessage is null, length() of errorMessage will throw the exception...

Paul

Sent from my iPad

On Dec 4, 2011, at 3:22 AM, Philippe Rabier <email@hidden> wrote:

Hi Kevin

You have to use a && operator when you test if your string is not null and length > 0. ;-)

Bad copy/paste I guess. 

Your code is clean.  

Philippe

Sent from my iPhone

On 4 déc. 2011, at 09:01, Kevin Spake <email@hidden> wrote:

Still working on the WebObjects, WOlips and Wonder tutorial, part 2...

Getting a null pointer exception. I've spent hours trying to figure out the issue, but I just don't have the experience to properly trouble shoot it. The stack trace is below, and below that is the code for my DirectAction.  The console says the error occurs on line 55, which is "if (errorMessage != null || errorMessage.length() != 0) { "

The thing is, errorMessage is null at this point. I've entered in valid user credentials, the session object has been created. The currentUser and nextPage objects are not null.  nextPage is set to "AdminPage".   As soon as I try to step into the "if (errorMessage != null || errorMessage.length() != 0) {"    line the exception occurs.  Is this a scope issue? 

Thanks.


Application: SooperSeekrit Error: java.lang.NullPointerException Reason: Stack trace: Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NullPointerException
      • From: Kevin Spake <email@hidden>
File Line# Method Package

DirectAction.java 55 loginAction com.sooperseekrit.app
NativeMethodAccessorImpl.java NA invoke0 sun.reflect
NativeMethodAccessorImpl.java 39 invoke sun.reflect
DelegatingMethodAccessorImpl.java 25 invoke sun.reflect
Method.java 597 invoke java.lang.reflect
WODirectAction.java 144 performActionNamed com.webobjects.appserver
ERXDirectAction.java 401 performActionNamed er.extensions.appserver
WOActionRequestHandler.java 259 _handleRequest com.webobjects.appserver._private
WOActionRequestHandler.java 158 handleRequest com.webobjects.appserver._private
ERXDirectActionRequestHandler.java 126 handleRequest er.extensions.appserver
WOApplication.java 1687 dispatchRequest com.webobjects.appserver
ERXApplication.java 2021 dispatchRequestImmediately er.extensions.appserver
ERXApplication.java 1986 dispatchRequest er.extensions.appserver
WOWorkerThread.java 144 runOnce com.webobjects.appserver._private
WOWorkerThread.java 226 run com.webobjects.appserver._private
Thread.java 680 run java.lang

References: 
 >NullPointerException (From: Kevin Spake <email@hidden>)
 >Re: NullPointerException (From: Philippe Rabier <email@hidden>)

  • Prev by Date: Re: NullPointerException
  • Next by Date: Re: Best way to remove a component?
  • Previous by thread: Re: NullPointerException
  • Next by thread: Re: NullPointerException
  • Index(es):
    • Date
    • Thread