Posted At : April 5, 2008 9:08 AM
| Posted By : todd sharp
Related Categories:
Java,
ColdFusion
Yesterday I posted a demo of a UDF that I had been working on to convert HTML (via a URL or raw HTML) to an image. The UDF works OK, but to be honest it's not all that great. Let me quickly explain the process (as some had guessed in the comments on that post yesterday).
[More]
Posted At : December 15, 2007 11:06 AM
| Posted By : todd sharp
Related Categories:
Java,
ColdFusion
I'm putting the finishing touches on my PowerPoint utils component when I came across a weird Java error. I've seen it before and it may very well be my lack of Java experience that is causing my lack of understanding here.
Say you have a Java method getFoo() that is expected to return a string. I've found that sometimes ColdFusion doesn't properly handle Java nulls so when you try to set a value you'll get something like so when trying to reference it:
Element foo is undefined in a CFML structure referenced as part of an expression.
ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.
It seems that ColdFusion simply chokes on it. I came up with a hacky fix by passing the value to another method which properly returns an empty string:
<cffunction name="fixNull" access="private">
<cfargument name="valueToFix" default="" />
<cfset rStr = "" />
<cfif isDefined("arguments.valueToFix")>
<cfset rStr = arguments.valueToFix />
</cfif>
<cfreturn rStr />
</cffunction>
Seems a bit hacky but it works. If someone can shed a little more light on the subject I'd appreciate it.