Skip to Content
avatar image
Former Member

null pointer exception when message box code is called.

Hi Experts, using NWDS 7.0.18

I'm really stuck and wondering if someone can help me?

I have an application that invokes a Java Bean model. The java bean invokes a web service and fetches some data.

In my web dynpro app, in the onActionSearch method, I have a message box that informs the user if no results are returned and then they have other options via button actions from the message box that they can take.

Here is when the error occurs,

1) The user types in search parameters in the input fields and enters search, a valid result set is returned and displayed in the table

2) The user changes the input parameters in the input fields that returns no results so the message box should be displayed

Instead of the message box the following error is returned:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TextViewAdapter.getSelection(TextViewAdapter.java:1215)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:424)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.SapTableCellRenderer.renderSapTableGenericCellFragment(SapTableCellRenderer.java:1211)

at com.sap.tc.ur.renderer.ie6.SapTableCellRenderer.renderSapTableCellFragment(SapTableCellRenderer.java:209)

at com.sap.tc.ur.renderer.ie6.SapTableCellRenderer.render(SapTableCellRenderer.java:84)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.SapTableRowRenderer.renderSapTableRowFragment(SapTableRowRenderer.java:126)

at com.sap.tc.ur.renderer.ie6.SapTableRowRenderer.render(SapTableRowRenderer.java:54)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.SapTableDefaultBodyRenderer.renderSapTableDefaultBodyFragment(SapTableDefaultBodyRenderer.java:214)

at com.sap.tc.ur.renderer.ie6.SapTableDefaultBodyRenderer.render(SapTableDefaultBodyRenderer.java:44)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.SapTableRenderer.renderSapTableFragment(SapTableRenderer.java:795)

at com.sap.tc.ur.renderer.ie6.SapTableRenderer.render(SapTableRenderer.java:84)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutItemFragment(FlowLayoutRenderer.java:288)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutFragment(FlowLayoutRenderer.java:244)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.render(FlowLayoutRenderer.java:49)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.ScrollContainerRenderer.renderScrollContainerFragment(ScrollContainerRenderer.java:512)

at com.sap.tc.ur.renderer.ie6.ScrollContainerRenderer.render(ScrollContainerRenderer.java:74)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutItemFragment(FlowLayoutRenderer.java:288)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutFragment(FlowLayoutRenderer.java:244)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.render(FlowLayoutRenderer.java:49)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.GroupRenderer.renderGroupFragment(GroupRenderer.java:1194)

at com.sap.tc.ur.renderer.ie6.GroupRenderer.render(GroupRenderer.java:74)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.GridLayoutRenderer.renderGridLayoutCellFragment(GridLayoutRenderer.java:826)

at com.sap.tc.ur.renderer.ie6.GridLayoutRenderer.renderGridLayoutRowFragment(GridLayoutRenderer.java:424)

at com.sap.tc.ur.renderer.ie6.GridLayoutRenderer.renderGridLayoutFragment(GridLayoutRenderer.java:336)

at com.sap.tc.ur.renderer.ie6.GridLayoutRenderer.render(GridLayoutRenderer.java:79)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.GroupRenderer.renderGroupFragment(GroupRenderer.java:1194)

at com.sap.tc.ur.renderer.ie6.GroupRenderer.render(GroupRenderer.java:74)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutItemFragment(FlowLayoutRenderer.java:288)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.renderFlowLayoutFragment(FlowLayoutRenderer.java:244)

at com.sap.tc.ur.renderer.ie6.FlowLayoutRenderer.render(FlowLayoutRenderer.java:49)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.ur.renderer.ie6.ScrollContainerRenderer.renderScrollContainerFragment(ScrollContainerRenderer.java:619)

at com.sap.tc.ur.renderer.ie6.ScrollContainerRenderer.render(ScrollContainerRenderer.java:74)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.UiWindowRenderer.render(UiWindowRenderer.java:52)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:133)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendHtml(HtmlClient.java:1058)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.fillDynamicTemplateContext(HtmlClient.java:458)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.sendResponse(HtmlClient.java:1247)

at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.retrieveData(HtmlClient.java:253)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doRetrieveData(WindowPhaseModel.java:595)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:156)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processPhaseLoop(WebDynproWindow.java:345)

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

at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)

at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)

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

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

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:401)

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

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

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

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

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

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

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

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(AccessController.java:219)

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

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

But if I do the search the first time around using input parameters that I know won't return a result, the message box appears fine!!!

Any thoughts or suggestions?

MM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Sep 02, 2009 at 11:44 PM

    Here is the code in my onActionSearch method:

    public void onActionSearch(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
      {
        //@@begin onActionSearch(ServerEvent)
        try
        {
    	if(  null == wdContext.currentInputElement().getFName() ||
    	     null == wdContext.currentInputElement().getLName() ||
    	    "".equalsIgnoreCase(wdContext.currentInputElement().getFName().trim()) ||
    	    "".equalsIgnoreCase(wdContext.currentInputElement().getLName().trim()) )
    	{
    		IWDControllerInfo contInfo = wdControllerAPI.getViewInfo().getViewController();
    		IWDConfirmationDialog dialog = wdComponentAPI.getWindowManager()
    		  .createConfirmationWindow
    		("Required fields cannot be empty!", contInfo.findInEventHandlers("ok"), "OK");
    		dialog.setTitle("Error:");
    		dialog.show();
    	}
    	else
    	{
    		wdThis.wdGetCompController().invalidateDataNodes();
    		wdThis.wdGetCompController().getIndData();
    		if(wdContext.nodeTable().size() == 0)
    	                    {
    			String msg = "Did not find any records matching the supplied criteria," +
    			 " would you like to request one to be created?";
    			IWDControllerInfo contInfo = wdControllerAPI.getViewInfo().getViewController();
    			IWDConfirmationDialog dialog = 
    				wdComponentAPI.getWindowManager()
    				  .createConfirmationWindow
    				(msg, contInfo.findInEventHandlers("yes"), "Yes");
    			dialog.addChoice(contInfo.findInEventHandlers("no"), "No");
    			dialog.setTitle("Confirmation message.");
    			dialog.show();
    		}
    	}
        }
        catch(Exception e)
        {
        	wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
    	wdComponentAPI.getMessageManager().reportException(""+e.getCause(), true);
    	e.printStackTrace();
        }
       	
        //@@end
      }
    

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Satyajit,

      Thanks for the tip, my only concern with removeElement is having to loop through 100,000 - 1,000,000 records deleting each one, 1 by 1. It can be costly.

      I did step thru the code in the debugger, and the message box code does get called, but never renders as the web dynpro runtime tries to render the table first, and the null pointer is thrown before the render code for the mssage box is called.

      Here is what I had to do as a work around, if the table context is null, i just create and add an empty element to the context.

      MM

  • Sep 03, 2009 at 06:01 AM

    Hi Marshall

    Please put your question in consice and clean way It is just a very common Nullpointer exception.

    Problem could be when query returns no result and you try to display some message which is either coming from backend or

    null sistuation is not handled properly.

    Check it through debug or by simply print hardcoded string.

    Best Regards

    Satish Kumar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 10, 2009 at 02:24 PM

    Closing thread...not answered...workaround in place.

    Add comment
    10|10000 characters needed characters exceeded