0

<<thread split from here>>

You'd compare an object to null with == . I think you want one of the following. It's hard to determine the exact behavior you're looking for from your code.

if (child == null)
    child = new Lista(c, null);

// Or:

if (child.getData() == null)
    child = new Lista(c, null);

Hi. I have a similar problem where the test works fine if its the 2nd time a user tries to select an account.

if the user types in an incorrect account number the first time it should go back to the homepage.

if ((user.getSelectedSoldTo().equals(null)) && (user.getSelectedShipTo().equals(null)))
				{
					String address=MyAccountConstants.MYACCOUNT_HOMEPAGE;
					//"??????????????"; 	//some failure page
					gotoPage(address,request,response); 
				} else {
					String address=MyAccountConstants.USER_SAVE; 
					gotoPage(address,request,response);
				}

It does HomePage only if selected as incorrect account the 2nd time. first time it throws the NullPointerException.

Any help is appreciated.

Edited by Nick Evan: Added code-tags, split thread

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by javaAddict
0

If it throws NullPointerException then something is null. Look at the error message to find the line that this happens. Then try to print the values of the objects used to see what is null.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.