cancel
Showing results for 
Search instead for 
Did you mean: 

Clear wdcontext

Former Member
0 Kudos

Hi

I am trying to clear t he context by using

wdContext.invalidate().

However if no information is avaiable yet, I get null pointer exception. How do I check if a null object exists

before running wdContext.invalidate()?

thanks

yuval

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please note that NullPointerException is thrown when an object is not instantiated, so you need to check for that object variable.

if (wdContext != null)
     wdContext.invalidate();

@Sudhir and Ayyapparj

You will get NullPointerException even if you write this:

if(!wdContext.isEmpty())

because wdContext is not instantiated.

Jawed Ali

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Just see if this fulfill your requirement:

wdContext.getContext().reset(true);

Regards,

Murtuza

Former Member
0 Kudos

Hi,

use as follows



 if(!wdContext.isEmpty())
 wdContext.invalidate();

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

post the stack trace of the error.

Thanks,

ramesh

Former Member
0 Kudos

Hi,

You can check wdContext.isEmpty();