wolips/wolips — Issue #80: WOL-1194 Bundleless builds breaks ERXComponentUtilities.inheritTemplateFrom
Author: darkv
Created: 2012-01-13 15:36:45+00:00
State: open

Using the bundleless build the ERXComponentUtilities.inheritTemplateFrom starts to throw NPEs:

ERROR [...] er.extensions.appserver.ERXApplication (Application.java:100) - handleException
java.lang.NullPointerException
at ognl.helperfunction.WOHelperFunctionParser.parse(WOHelperFunctionParser.java:45)
at ognl.helperfunction.WOHelperFunctionParser54.parse(WOHelperFunctionParser54.java:25)
at com.webobjects.appserver.parser.WOComponentTemplateParser.templateWithHTMLAndDeclaration(WOComponentTemplateParser.java:438)
at com.webobjects.appserver.WOComponent.templateWithHTMLString(WOComponent.java:1494)
at com.webobjects.appserver.WOComponent.templateWithHTMLString(WOComponent.java:1441)
at er.extensions.components.ERXComponentUtilities.inheritTemplateFrom(ERXComponentUtilities.java:276)
at com.[...].template([...]:88)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1112)
at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver._private.WOComponentContent.appendToResponse(WOComponentContent.java:51)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver._private.WOComponentContent.appendToResponse(WOComponentContent.java:51)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
at er.extensions.components.ERXNonSynchronizingComponent.appendToResponse(ERXNonSynchronizingComponent.java:73)
at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
at er.extensions.components.ERXNonSynchronizingComponent.appendToResponse(ERXNonSynchronizingComponent.java:73)
at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
at com.[...].appendToResponse(DERDownloadList.java:34)
at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:1385)
at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:552)
at com.webobjects.appserver.WOApplication.appendToResponse(WOApplication.java:1794)
at er.extensions.appserver.ERXApplication.appendToResponse(ERXApplication.java:1880)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:242)
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.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)

By stepping through the (jadded) source I found the following difference between bundle and -less builds during the execution of ERXComponentUtilities.inheritTemplateFrom:

• For builds using bundles the resource URL of the inherited template is retrieved in WODeployedBundle.relativePathForResource on line 517

Object aRelativePath = _relativePaths.objectForKey(aResourceName);

where _relativePaths is an _NSThreadSafeMutableDictionary that contains an ivar _delegate that contains all the different resource file names in a dictionary. The class used for WODeployedBundle originates from javawebobjects.jar from the system framework JavaWebObjects (guessing by matching the line number shown in the debugger). The call stack is:

[...]
ERXResourceManager.pathURLForResourceNamed
WOProjectBundle.pathURLForResourceNamed
WOProjectBundle._absolutePathForResource(String, NSArray)
WOProjectBundle._absolutePathForResource(String, String, boolean)
WODeployedBundle. _absolutePathForResource
WODeployedBundle.relativePathForResource

• For bundle-less builds the debugger reaches the same code as above in WODeployedBundle.relativePathForResource on line 603. The different line number seems to point at that the used class for WODeployedBundle is taken from ERWebObjects.jar. But here the ivar _delegate of _relativePaths is an empty NSMutableDictionary and therefore returns null.