NULL POINTER error when using ObjectLoad(ObjectSave())
Copy link to clipboard
Copied
Hi there. I've already posted this up on stackoverflow, but thought it might be worth posting here too in case anyone here had some information. The SO link is http://stackoverflow.com/questions/16103089/null-pointer-error-when-using-objectloadobjectsave
I've been having a problem with CF9 and NULL POINTER errors that do not appear to be an issue within Railo. I created a simple CFC and associated mxunit unit test to confirm this with.
On Railo (4.0.4) both unit tests pass. On Coldfusion (9.0.1), the unit test getMetaDataBeforeMethodInvocation fails with NULL POINTER error on the GetMetaData call.
At present I can only surmise that CF9 does not have access to the full metadata following ObjectLoad until a method within that component is called. Is anyone able to shed more light on this problem, and/or offer a better solution than to ensure that a method within the object is called prior to doing getMetaData?
Here is the CFC
// NullError.cfccomponent { public NullError function init() { variables.uuid = CreateUUID(); return this; } public string function getUUID() { return uuid; }}
and associated unit test
// NullErrorTest.cfccomponent extends='mxunit.framework.TestCase' { private any function setupTheTests() { var o = new NullError(); debug(o.getUUID()); // Dump meta data debug(GetMetaData(o)); // Save and load it, and return return ObjectLoad(ObjectSave(o)); } public void function getMetaDataBeforeMethodInvocation() { var o = setupTheTests(); // Get meta data, and then get uuid, expecting this to ERROR (NULL POINTER) debug(GetMetaData(o)); // CF FAILS HERE, RAILO DOES NOT debug(o.getUUID()); } public void function getMetaDataAfterMethodInvocation() { var o = setupTheTests(); // Get uuid, and then get meta data, expecting this to be ok debug(o.getUUID()); debug(GetMetaData(o)); }}
Copy link to clipboard
Copied
I have now submitted this as a bug, https://bugbase.adobe.com/index.cfm?event=bug&id=3546237

