Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

NULL POINTER error when using ObjectLoad(ObjectSave())

New Here ,
Apr 19, 2013 Apr 19, 2013

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.cfc
component
{
   
public NullError function init() {
        variables
.uuid = CreateUUID();
       
return this;
   
}
   
public string function getUUID() {
       
return uuid;
   
}
}

and associated unit test

// NullErrorTest.cfc
component
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));
   
}
}

472
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2013 Apr 22, 2013
LATEST

I have now submitted this as a bug, https://bugbase.adobe.com/index.cfm?event=bug&id=3546237

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources