cancel
Showing results for 
Search instead for 
Did you mean: 

null pointer exception while creating a confirmation dialog box

Former Member
0 Kudos

Hi All,

While creating a confirmation dialog window i am getting 'Null pointer exception' error. But when the ear is deployed it works fine for a certain period of time and later on throws this exception.

And as soon as it is again deployed even without making changes it starts working.

The code used for creating a confirmation window is as below:

confirmDialogWin = wdComponentAPI.getWindowManager().createConfirmationWindow("Do you want to cancel the order ?",wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("ok"),"Yes");

confirmDialogWin.addChoice(wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("cancel"),"No");

confirmDialogWin.setTitle("Order Cancellation Confirmation :");

confirmDialogWin.open();

confirmDialogWin.setWindowPosition(WDWindowPos.CENTER);

The event ok and cancel has been defined in the view.

//@@begin others

public static IWDConfirmationDialog confirmDialogWin = null;

//@@end

Help me on this as soon as possible.

Thanks in advance,

Murtuza

Accepted Solutions (0)

Answers (5)

Answers (5)

monalisa_biswal
Contributor
0 Kudos

Is Event handler name correct?

"ok","cancel" are name of actions.Event handler name would be onAction<actionname>.Check it once again.

Former Member
0 Kudos

Hi,

I have created the evenhandlers from the method tab. I also mentioned before that the code works fine for sometime but it gives the error mentioned above only after certain period of time.

Thanks

Former Member
0 Kudos

Murtuza,

First of all, make variable confirmDialogWin non-static, i.e. remove word static from declaration.

Second, it seems that you creating your window in wdDoModifyView -- otherwise why you need static? Don't do this -- create and close popup windows only from action handlers or event handlers or controller methods these are not invoked from wdDoModifyView.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi,

I mentioned before that i have even intantiated the object locally within the action without making it static still it gives me the same problem. I am not opening a window in the wdDoModify instead i am creating a window on the action of a button.

Thanks

Former Member
0 Kudos

Hi,

i am also giving you the error that i get

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientserver.window.ConfirmationDialogDelegate.<init>(ConfirmationDialogDelegate.java:58)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createConfirmationWindow(ClientComponent.java:927)

at com.chep.portfolio.dynpro.DetailedOrderView.doConfirmationDialog1(DetailedOrderView.java:445)

at com.chep.portfolio.dynpro.DetailedOrderView.onActionDoCancel(DetailedOrderView.java:234)

at com.chep.portfolio.dynpro.wdp.InternalDetailedOrderView.wdInvokeEventHandler(InternalDetailedOrderView.java:233)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:659)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

Thanks

monalisa_biswal
Contributor
0 Kudos

Where is it exactly throwing the error? Check Line No in the error trace.

The problem is due to static declaration of variable.There will be one instance of confirmation window for all running applications.So while creating it if somebody closes that window it will throw exception.Remove static declaration

Former Member
0 Kudos

Hi,

I have even tried instantiating the window object locally without making it static and the line on which the error occurs is the line createConfirmationWindow. This is the point where it throws null pointer exception.

Thanks

Former Member
0 Kudos

Sorry, i made a mistake in the message above. I have already created the event handlers ok and cancel in the view.

Former Member
0 Kudos

Hi,

This is the standard code for craeting the Confirmation dialog with ok and new Email.....

And it is always works.

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

String dialogText = "The email was successfully sent!";

IWDConfirmationDialog dialog =

wdComponentAPI.getWindowManager().createConfirmationWindow(

dialogText,

controllerInfo.findInEventHandlers("ok"),

"ok");

dialog.addChoice(controllerInfo.findInEventHandlers("newEmail"), "new email");

dialog.open();

Thanks,

Lohi.

Former Member
0 Kudos

Hi Lohi,

The way you have mentioned is the same as i provided earlier except an abject being created at the start. I don't think that should make a difference. The reason i m asking for a confirm solution because i need to wait for about a day to see does that code give the same null pointer exception or not and as i mentioned earlier if i write the code which i mentioned then a confirmation window is created succesfully and there are no issues in that but after a certain period of time i gives me null pointer exception and if i again redeploy the same code without making any changes then it works fine. So as per my understanding there is no issue in the code as it creates a window successfully.

Former Member
0 Kudos

hi,

Go to methods of your View and create the eventHandler method name ok and cancel

Then try to deploy once again.

It should come.

Thanks,

Lohi.