Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Null poiner exception when trying to store extension data in existing BO

Hi All,

When I am trying to store extension data to existing 'basket' business object using the code below, I am getting a null pointer exception.

public ActionForward doPerform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

try {

UserSessionData userSessionData = UserSessionData.getUserSessionData(request.getSession());

BusinessObjectManager isaBOM = (BusinessObjectManager)userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);

Basket basket = isaBOM.getBasket();

//String quantity1 = request.getParameter("quantityofweek");

String quantity1 = "1";

basket.addExtensionData("ZEXTENSION",quantity1);

//String test = (String) basket.getExtensionData("ZEXTENSION");

//if (test != null)

request.setAttribute("Z_quantity",quantity1);

}

catch (Exception e){

request.setAttribute ("Z_quantity",e);

}

return mapping.findForward("success");

}

I just followed the 'Examples in E-Commerce' document to do this . I face null pointer exception at the line

basket.addExtensionData("ZEXTENSION",quantity1);

I guess it is not able to retrieve instance of basket and so null is stored in basket object and getting null pointer exception by calling 'addextensiondata' method.

Is there anything that i need to add to the code so that I will be store additional data in existing business object?

Any pointers will be of great help.

Thanks,

Anasuya.

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question