Depending on the context I call this I get a NullPointerException or not. This is the NPE, context info follows below:
Mar 25 11:13:49 ec_admin[13000] WARN NSLog - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
java.lang.NullPointerException
[2011-3-25 11:13:49 CET] <WorkerThread14> java.lang.NullPointerException
at com.webobjects.appserver._private.WOComponentReference._popComponentFromContext(WOComponentReference.java:108)
at com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:128)
at er.extensions.components._private.ERXSwitchComponent.invokeAction(ERXSwitchComponent.java:117)
at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at er.extensions.components._private.ERXWORepetition.invokeAction(ERXWORepetition.java:496)
at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at er.extensions.components.conditionals.ERXWOConditional.invokeChildrenAction(ERXWOConditional.java:113)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at er.extensions.components.conditionals.ERXWOConditional.invokeAction(ERXWOConditional.java:104)
at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079)
at com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:127)
at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponentContent.java:38)
at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079)
at com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:127)
at er.extensions.components._private.ERXSwitchComponent.invokeAction(ERXSwitchComponent.java:117)
at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079)
at er.directtoweb.pages.ERD2WPage.invokeAction(ERD2WPage.java:619)
at er.directtoweb.pages.ERD2WListPage.invokeAction(ERD2WListPage.java:479)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1357)
at com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1745)
at er.extensions.appserver.ajax.ERXAjaxApplication.invokeAction(ERXAjaxApplication.java:93)
at er.extensions.appserver.ERXApplication.invokeAction(ERXApplication.java:1863)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:206)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:369)
at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:442)
at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1978)
at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1943)
at com.dsm.ec_admin.Application.dispatchRequest(Application.java:289)
at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
at java.lang.Thread.run(Thread.java:680)
In some D2WInspectPages I have a nextPageDelegate. Calling from here everything works.
public WOComponent nextPage(WOComponent sender) {
if (!(sender instanceof ERD2WInspectPage)) {
return null;
}
// make sure that we are in Edit mode:
String task = (String)((ERD2WInspectPage)sender).d2wContext().valueForKey( "task" );
if (! "edit".equals( task )) {
return null;
}
// trap cancel
if (!((ERD2WInspectPage)sender).objectWasSaved()) {
return null;
}
EOEnterpriseObject object = (EOEnterpriseObject)sender.valueForKey( "object" );
if (object instanceof GeneratedDocument) {
((GeneratedDocument)object).generatePDF( sender );
}
return null;
}