Title:
Inline literal struct notation causes a Hibernate-related NPE when used as a named argument inside a non-braced if statement.
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Peter Boughton / Peter Boughton (Peter Boughton)
Created: 07/15/2013
Components: Core Runtime
Versions: 10.0
Failure Type: Non Functioning
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / Most users will encounter
Locale/System: English / Platforms All
Vote Count: 2
Not using braces for a single-line if statement containing an function with an inline struct literal as an argument will, when OrmReload() is run, causes the compiler to fall over with a NullPointerError while Hibernate is scanning CFCs (even though the CFC isn't ORM related).
java.lang.NullPointerException at coldfusion.compiler.Treewalker.postorder(Treewalker.java:36) at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
Full stack trace in attached file.
This code, inside a Coldbox handler, causes the java.lang.NullPointerException:
if ( StructKeyExists(rc,'PersonTypeId') )
rc.PersonType = PersonTypeService.findAllWhere( Criteria={PersonTypeId:rc.PersonTypeId} );
This doesn't:
if ( StructKeyExists(rc,'PersonTypeId') )
rc.PersonType = PersonTypeService.get( rc.PersonTypeId );
Causes NPE:
if ( StructKeyExists(rc,'PersonTypeId') )
rc.PersonType = PersonTypeService.get( A={id:rc.PersonTypeId} );
Doesn't cause NPE:
if ( StructKeyExists(rc,'PersonTypeId') )
{
rc.PersonType = PersonTypeService.get( A={id:rc.PersonTypeId} );
}
Doesn't cause NPE:
// if ( StructKeyExists(rc,'PersonTypeId') )
rc.PersonType = PersonTypeService.get( A={id:rc.PersonTypeId} );
(I've wasted enough time tracking down this problem; I don't feel like writing a self-contained demonstration.)
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3595245
External Customer Info:
External Company:
External Customer Name: boughtonp
External Customer Email:
External Test Config: 10,0,11,285437
Attachments:
- July 15, 2013 00:00:00: 1_cf_npe_stacktrace.txt
Comments: