cancel
Showing results for 
Search instead for 
Did you mean: 

Null pointer exception

Former Member
0 Kudos

Hi Experts,

I'm Getting null pointer exception while setting some value to the the text box UI elemnt which is binded to model attribute. Suggest me in this.

Regards,

Suman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suman

Null pointer exception means that u have tried to access a parameter while it is still null.

If u post the code it will be easier to help u.

Nitsan

Former Member
0 Kudos

public void wdDoInit()

{

//@@begin wdDoInit()

int month=0,year=0,day=0;

String month1,day1,year1;

IWDMessageManager manager = wdComponentAPI.getMessageManager();

IWDClientUser user = WDClientUser.getLoggedInClientUser();

String logUser = user.getSAPUser().getUniqueName();

// manager.reportSuccess(logUser);

wdContext.currentContextElement().setUserid(logUser);

wdThis.wdGetAPPController().executeBapi_Employee_Getdata_Input();

if(wdContext.nodeNominee().size()==0)

{

Calendar cal=Calendar.getInstance();

month=cal.get(Calendar.MONTH)+1;

if(month==1||month==2||month==3||month==4||month==5||month==6||month==7||month==8||month==9)

{

month1="0"+month;

}

else

{

month1=""+month;

}

manager.reportSuccess(month1);

day = cal.get(Calendar.DAY_OF_MONTH);

if(day==1||day==2||day==3||day==4||day==5||day==6||day==7||day==8||day==9)

{

day1= "0"+day;

}

else

{

day1=""+day;

}

year = cal.get(Calendar.YEAR);

year1=""+year;

String strFormat=day1"."month1"."year1;

manager.reportSuccess(strFormat);

wdContext.currentOutput_NomineeElement().setBegda(strFormat);

wdContext.currentOutput_NomineeElement().setEndda("31.12.2008");

wdThis.wdGetAPPController().executeZ_Hrfm_Nominee_Disp_Input();

Note:-Both Begda and Endda are string parameters in the backend

Edited by: sumankumar kurimilla on Dec 9, 2008 11:43 AM

former_member192434
Active Contributor
0 Kudos

i think you need to correct this line of code, comparing node Size(which is 0) with 0

if(wdContext.nodeNominee().size()==0)

Former Member
0 Kudos

I have changed the code as you said but still i'm facing the issue.

I'm passing the correct arguments to the model attributes. Also i Have tested the output for those attributes,which is proper .

int month=0,year=0,day=0;

String month1,day1,year1;

IWDMessageManager manager = wdComponentAPI.getMessageManager();

IWDClientUser user = WDClientUser.getLoggedInClientUser();

String logUser = user.getSAPUser().getUniqueName();

// manager.reportSuccess(logUser);

wdContext.currentContextElement().setUserid(logUser);

wdThis.wdGetAPPController().executeBapi_Employee_Getdata_Input();

if(wdContext.nodeNominee().isEmpty())

{

Calendar cal=Calendar.getInstance();

month=cal.get(Calendar.MONTH)+1;

if(month==1||month==2||month==3||month==4||month==5||month==6||month==7||month==8||month==9)

{

month1="0"+month;

}

else

{

month1=""+month;

}

manager.reportSuccess(month1);

day = cal.get(Calendar.DAY_OF_MONTH);

if(day==1||day==2||day==3||day==4||day==5||day==6||day==7||day==8||day==9)

{

day1= "0"+day;

}

else

{

day1=""+day;

}

year = cal.get(Calendar.YEAR);

year1=""+year;

String strFormat=day1"."month1"."year1;

manager.reportSuccess(strFormat);

wdContext.currentOutput_NomineeElement().setBegda(strFormat);

wdContext.currentOutput_NomineeElement().setEndda("31.12.2008");

Former Member
0 Kudos

Please post the exception stack trace. Probably the expression

wdContext.currentOutput_NomineeElement()

is null.

You might also consider to use a SimpleDateFormat for the date formatting.

Armin

Former Member
0 Kudos

HI amin,

Here the Begda and Endda both are String type attributes.So need of converting it to date format from string types.

Regards,

Suman.

Edited by: sumankumar kurimilla on Dec 9, 2008 12:57 PM

Former Member
0 Kudos

That's not what I asked for.

Armin

Former Member
0 Kudos

Thanks alot issue resolved that is because wrong setting of arguments to the import parameters.

Regards,

Suman

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks alot for the support.

Former Member
0 Kudos

Hi

I guess your problem is in this condition:

wdContext.nodeNominee().size()==0

U can not ask for size when the parameter is null.

U should change the condition to something like :

wdContext.nodeNominee().isEmpty()

Hope it helps

Nitsan

Former Member
0 Kudos

Hi,

post the complete error trace ?

Regards,

ramesh