cancel
Showing results for 
Search instead for 
Did you mean: 

null pointer exception

Former Member
0 Kudos

Hi,

I am trying to create one application to display messages on the input field according to the input given.

But when i am giving value in name field then first time it is working fine but next time when i erase the value of the name field and press submit button then istead of giving internal error message it is showing 500 internal error in which it is showing null pointer excetion error.

Can anybody help it out.

Thanku.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

try the following code:

the node struvture is :

Node

--Id

--Name



  String val1 = wdContext.currentUserElement().getId();
    
   int length = (val1==null)?0:val1.length();       
		
 if(length==0)
    {
               //raise message
    	    	msg1.raiseMessage(IMessageCompNullpoint.ID,new Object[] {""},true);
    }

regards,

pinki

Answers (1)

Answers (1)

nikhil_bose
Active Contributor
0 Kudos

If you are accepting the input value (from inputField) to an attribute under a node, check the cardinality of that node (node properties).

Once you execute it, the node becomes invalidated. i.e. it contains no instance during runtime. Thats is why the null pointer exceptions is.

You have create the node element before executing it for the second time.

e.g.

code:

IPrivate<your>View.I<node>Element element =

wdContext.create<node>Element();

wdContext.node<node>.add(element);

[/code]

give this code where you want to refresh current node.

regards,

nikhil