Discussion:
Catching java.lang.NullPointerException with cftry/cfcatch?
(too old to reply)
EvolvedDSM
2009-03-30 16:08:45 UTC
Permalink
I'm getting a java.lang.NullPointerException returned on an update function in
a CFC:
"The cause of this output exception was that: java.lang.NullPointerException."

I want to find where it's generating this error so I can fix it. I've never
really used CFTRY and CFCATCH, but figured now would be a good time to learn if
this helped me track down the null. Can anyone provide an example of how to
use these tags with the above NPE and output a message that give info on where
it's faulting?

I'm using a standard update query,
<cfquery>
UPDATE table
SET columns = new values
WHERE columns = some ID
</cfquery>
EvolvedDSM
2009-03-30 18:05:40 UTC
Permalink
That was a great tip Dan. Helped me find the line. Apparently a datatype
"date" was given an incorrect null value. I figured the problem and the update
works now :)

Here's code incase someone wants to know:

<cfargument ... >
<cftry>
(working code goes here...)
<cfcatch type="any">
<cfmail to="..." from="..." subject="cfdump" type="text/html">
<cfdump var="#cfcatch#">
</cfmail>
</cfcatch>
</cftry>

Loading...