[coldbox-4.3.0+188] java.lang.NullPointerException on evaluate environment function

39 views
Skip to first unread message

aswin prasanth

unread,
Dec 12, 2017, 4:42:52 PM12/12/17
to ColdBox Platform
Hello 

I am seeing the below error when coldbox loads. 

 "The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code. Null Pointers are another name for undefined values."

This is something that happens mostly on production after a cf update or restarts and didn't see it happen in a staging environment till today ( I did a restart of CF service yesterday ) to debug. Another restart fixes the issue.


The application loads correctly up to \coldbox\system\web\config\ApplicationLoader.cfc -  // call environment method if exists

if( structKeyExists(arguments.oConfig,configStruct.environment) ){
evaluate("arguments.oConfig.#configStruct.environment#()" );
}

To debug I updated the code like below 

if( structKeyExists(arguments.oConfig,configStruct.environment) ){
try {
evaluate("arguments.oConfig.#configStruct.environment#()" );
}
catch(any e) {
writeDump("failed!");
writeDump(e);
writeDump(configStruct.environment);
writeDump(arguments.oConfig.staging());
writeDump(arguments.oConfig);
}
abort;
}

with below results

failed!

struct
Message[empty string]
StackTracejava.lang.NullPointerException
Suppressed
array [empty]
TagContext
array [empty]
Typejava.lang.NullPointerException

staging //configStruct.environment
hello //arguments.oConfig.staging()

STAGING
function staging
Arguments:none
ReturnType:Any
Roles: 
Access:public
Output: 
DisplayName: 
Hint:staging environment
Description: 


body of staging function in coldbox.cfc 

function staging() { // it is an empty function - just used a return string to get an output for dump.
    return "hello";
}


writeDump(arguments.oConfig.staging()); //works
writeDump(arguments.oConfig.STAGING()); //works
writeDump(evaluate("arguments.oConfig.STAGING()")); //works
writeDump(evaluate("arguments.oConfig.staging()")); //fails 


My questions : 

1. Why is evaluate being picky on case of the function name - but not always? If I do a fwreinit many times after the app loads once - its fine.
2. Change the detectenvironment() function to return upper case string? I did do evaluate( "arguments.oConfig.#UCase(configStruct.environment)#()" ); and it worked. 

Thanks,

Aswin

Ancient Programmer

unread,
Dec 12, 2017, 7:12:12 PM12/12/17
to ColdBox Platform
Never seen this issue before. 

What's your O/S, Web server, and ColdFusion version?

aswin prasanth

unread,
Dec 12, 2017, 9:01:48 PM12/12/17
to ColdBox Platform
ColdFusion 11,0,13,303668 Enterprise 
Windows Server 2012 IIS

Brad Wood

unread,
Dec 13, 2017, 11:15:26 AM12/13/17
to ColdBox Platform
That's very odd.  Seems like a surprising bug in Adobe CF 11.  Can you create a repro case with a simple CFC that has a single method and a page that calls that method with evaluate() using the wrong case.  If that still errors, I'd say put in a ticket for Adobe to fix it.  You might want to test it on 2016 as well in case it's a bug they've already fixed on newer versions.  

aswin prasanth

unread,
Dec 17, 2017, 10:41:17 AM12/17/17
to ColdBox Platform
No - I am not able to recreate it in CF11 or CF2016 with a simple CFC. The issues doesn't happen after first getting the issues and then restarting the server to fix it. So I am not sure how to recreate that situation either.

I have updated detect env. function to return upper case - will see if it happens again.

Thanks,
Aswin
Reply all
Reply to author
Forward
0 new messages