More Thoughts on HTML To Image (Plus Code)

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]

Handling Java Nulls In 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.

cfunited08

cfunited08

Calendar

Sun Mon Tue Wed Thu Fri Sat
    123
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex misc model-glue off topic personal project learn sql

Recent Comments

Hosting Advice Needed
todd sharp said: Must have been on a box that I'm not on. Thank goodness too, because all of my sites (this blog, cf... [More]

Hosting Advice Needed
Oğuz Demirkapı said: No. And the tickets are still open in support system. :) I think they had a big outage and still ... [More]

Hosting Advice Needed
todd sharp said: Did they say what caused such a long outage? [More]

Hosting Advice Needed
Oğuz Demirkapı said: VPS is back after 13 hours. :) [More]

Hosting Advice Needed
Oğuz Demirkapı said: 12 hours now since the server is down. :( [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com