on 11-21-2007 8:32 AM
Hi Forum,
In the code below I am getting null pointer exception, as such my functionality is working fine but at the end of function my control goes into catch block can someone suggest me why its so.
public void additionalValidations( )
{
//@@begin additionalValidations()
boolean blnLRequiredFieldFlag=true;
boolean blnLEmailIdFlag=true;
boolean blnLEmailIdFormatFlag=true;
MessageManager msgMgr = null;
try
{
msgMgr = (MessageManager)wdThis.wdGetAPI().getComponent().getMessageManager();
blnLEmailIdFlag= wdThis.wdGetAgency_AddUserController().validateEmptyString(wdContext.currentVn_AddNewUserParametersElement().getVa_EmailAddress());
if(blnLEmailIdFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("emailflag false"+blnLEmailIdFlag);
blnLRequiredFieldFlag=wdThis.wdGetAgency_AddUserController().validateEmptyString(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactEmailId());
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("1");
if(blnLRequiredFieldFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("2");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__REQUIRED_CONTACT_EMAIL_ID,null,false);
}
if(blnLRequiredFieldFlag==true)
{
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("3");
blnLEmailIdFlag= wdThis.wdGetAgency_AddUserController().validateEmailAddress(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactEmailId());
if(blnLEmailIdFlag==false)
{
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("4");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__IMPROPER_CONTACT_EMAIL_ID,null,false);
}
if(blnLEmailIdFlag==true)
{
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("5");
blnLRequiredFieldFlag=wdThis.wdGetAgency_AddUserController().validateEmptyString(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactPhNo());
if(blnLRequiredFieldFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("6");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__REQUIRED_CONTACT_PH_NO,null,false);
}
if(blnLRequiredFieldFlag==true)
{
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("7");
wdThis.addNewUserConfirmation();
//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("7end");
}
}
}
}
if(blnLEmailIdFlag==true)
{
blnLEmailIdFormatFlag=wdThis.wdGetAgency_AddUserController().validateEmailAddress(wdContext.currentVn_AddNewUserParametersElement().getVa_EmailAddress());
if(blnLEmailIdFormatFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("8");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__IMPROPER_EMAIL_ID,null,false);
}
if(blnLEmailIdFormatFlag==true)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("9");
blnLRequiredFieldFlag=wdThis.wdGetAgency_AddUserController().validateEmptyString(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactEmailId());
if(blnLRequiredFieldFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("10");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__REQUIRED_CONTACT_EMAIL_ID,null,false);
}
if(blnLRequiredFieldFlag==true)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("11");
blnLEmailIdFlag= wdThis.wdGetAgency_AddUserController().validateEmailAddress(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactEmailId());
if(blnLEmailIdFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("12");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__IMPROPER_CONTACT_EMAIL_ID,null,false);
}
if(blnLEmailIdFlag==true)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("13");
blnLRequiredFieldFlag=wdThis.wdGetAgency_AddUserController().validateEmptyString(wdContext.currentVn_AddNewUserParametersElement().getVa_ContactPhNo());
if(blnLRequiredFieldFlag==false)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("14");
msgMgr.reportMessage(IMessageAgency_AddUser.WARNING__REQUIRED_CONTACT_PH_NO,null,false);
}
if(blnLRequiredFieldFlag==true)
{//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("15");
wdThis.addNewUserConfirmation();
}
}
}
}
}
}
catch(Exception e)
{
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Error in the method additionalvalidation, please consult the administrator"+e);
}
//@@end
}
it is also goin into this method wdThis.addNewUserConfirmation(); but its also goin to catch block.
Thanks & Regards
Jaspreet Kaur
Hi,
Remove all try/catch blocks and run your application.
Then post the stack.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I removed the try catch from this function. Now wut is happening is as follows:
There is no affect on functionality.
My onactioncontinue calls this function ie additionalvalidation then in this fuction i am calling confirmation dialog box as soon as my confirmation dialog box appears i get null ptr exception if i dont provide the email address. Now its still functioning fine but goin into the catch of onactioncontinue.
Thanks & Regards
Jaspreet Kaur
hi,
Check in side the following functions
validateEmptyString
validateEmailAddress
that the parameter passed is not null
and
before accessing any values check the currentElement exists.
Ex :wdContext.currentVn_AddNewUserParametersElement().getVa_EmailAddress() before this call check wdContext.currentVn_AddNewUserParametersElement() is not null.
Regards
Ayyapparaj
Hi,
Which line is error ,Please paste error message.....
Regards
Karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no error in any of the lines as i have checked by placing report success msgs...only thing is if i keep email adress as empty it gives tht exception although the code is stilll running successfully my data is goin into the backend n the this particular view navigates to my success view n everything but i guess aftr executing the whole method it display the exception.The thing is this exception is not affection my modules functionality, but as it is cummin i need to get rid of it..
Thanks & Regards
Jaspreet Kaur
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.