Compound Theory

v2.0

Categories

  1. Transfer
  2. ColdFusion
  3. JRuby
  4. Java
  5. ColdSpring
  6. Squabble
  7. JavaLoader
  8. ColdDoc
  9. 2ddu
  10. AsyncHTTP
  11. OO Analysis and Design
  12. Flex
  13. Railo
  14. XML / XSL
  15. Hibernate
  16. ColdFusion Builder
  17. Fall
  18. Ubuntu
  19. XHTML / CSS
  20. Eclipse
  21. Git
  22. Oracle Database
  23. Usability / UI Design
  24. webDU
  25. cf.Objective()
  26. LWJGL
  27. cf.Objective(ANZ)
  28. Captcha
  29. MAX
  30. Melbourne CFUG
  31. Martial Arts
  32. Random Things
  33. Conduit

Recent Posts

Projects

Recent Comments

28 February 2007 11:18 AM 0 Comments

My Presentations Listed at cfObjective.com

If you take a wander over to the cf.Objective() site, you'll see that my two presentations on Transfer are listed on the session page.

I'm going to be doing a general introduction to Transfer, as well as an extended 'Advanced Transfer Techniques' presentation that will go into some of the extra features of Transfer that aid in managing your model, like caching, TQL, Decorators and Observable Events.

The session list is shaping up really nicely, and I've already earmarked several presentations that I definitely want to be at.

So far, my schedule looks tentatively like -
Of course, I say this not knowing what times what presentations are, or even if I'm speaking during them. ;o)

cf.Objective() 2007 looks to be an amazing conference, so if you're on the fence about attending, I would highly recommend you come down.
27 February 2007 09:21 PM 7 Comments

Got ColdFusion?

Rey Bango has come up with a fantastic idea for promoting ColdFusion around the web

www.GotCFM.com

First stage of this project is a list of ColdFusion powered websites, that he wants to make sure is up to date, and highly visible.

To help power the site, have a wander over, and put in all the ColdFusion sites that you are aware of. Lets see how big we can make this list.

Apparently this is only step one in Rey's attempt to evangelise ColdFusion on the web, and more power to him.

Keep up the good work Rey, I like what you're doing.

21 February 2007 05:08 PM 5 Comments

CFFrameworks Interview on Transfer ORM

The interview I did with Nick Tong as just been put up on CFFramworks.com .  I'm really happy with how it came out, so I hope you enjoy listening to it.

We had a good chat, mostly about Transfer , but also about frameworks in general.  

Let me know if you have trouble understanding my Australian accent. ;o)
20 February 2007 09:46 AM 2 Comments

I got my Flash Face!

When I was a boy, all I ever wanted was my very own Flash Face .  I can't believe it has finally come true.

 

10 February 2007 06:34 PM 3 Comments

Issue with cfcatch and JavaLoader

This is an issue I came across yesterday while doing some work on Transfer that affects JavaLoader , and generally anything that uses an URLClassLoader to load any external class/jar files.

The issue lies with catching Java exception with <cfcatch>.  The documentation states, that to catch a thrown Java exception you can specify the type in the 'type' attribute of the <cfcatch> tag.  So if we wanted to catch a java.io.IOException, we would do so this way:

<cftry>
   <!--- do some stuff that may throw an exception --->
    <cfcatch type="java.io.IOException">
        <!--- do something with it --->
    </cfcatch>
</cftry>

Now the issue comes when you are using JavaLoader (or anything that utilises any sort of URLClassLoader) and the loaded Java code throws an exception that hasn't been loaded with ColdFusion at start up -

<cfcatch> can't catch the Java Exception by it's specific type!
 
To show you what I mean, I created a simple test bed.

I create a new Java Exception object, 'com.compoundtheory.test.myException', and a class called 'MyThrower' who's sole job was to throw this exception.

Just to note 'jl' is the JavaLoader instance that has loaded my classes.

My test bed looked like this:

<cftry>
    <cfscript>
        myThrower = jl.create("com.compoundtheory.test.MyThrower").init();

        myThrower.myThrow();
    </cfscript>
    <cfcatch type="com.compoundtheory.test.myException">
        full
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="java.lang.Exception">
        java.lang.Exception
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="any">
        any
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>

The result that came from this was that 'java.lang.Exception' was output onto the screen.  This means that the ColdFusion <cfcatch> statement bypassed the 'com.compoundtheory.test.myException' type (which is its real type) and caught it at the 'java.lang.Exception' level, which is what 'myException' extends.

This led me to believe that the ColdFusion <cfcatch> can only catch exceptions that are loaded in its class path on start up.  To this effect I had two more test beds.

The first test was to get my JavaLoader loaded class to throw a 'java.io.IOException' - an exception that is native to Java 1.4, which comes with ColdFusion, and is loaded when ColdFusion starts.

The test bed looked like this:

<cftry>
    <cfscript>
        myThrower = jl.create("com.compoundtheory.test.MyThrower").init();

        myThrower.myThrowIOException();
    </cfscript>
    <cfcatch type="java.io.IOException">
        full
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="java.lang.Exception">
        java.lang.Exception
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="any">
        any
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>

In this case, 'full' was output, that meaning that the <cfcatch> was able to the exception with the type 'java.lang.IOException', just as it was meant to do.

The final test was when I moved my created classes into the ColdFusion class path, restarted the server, and ran my tests again.

The test bed now looked like this:

<cftry>
    <cfscript>
        myThrower = createObject("java", "com.compoundtheory.test.MyThrower").init();

        myThrower.myThrow();
    </cfscript>
    <cfcatch type="com.compoundtheory.test.myException">
        full
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="java.lang.Exception">
        java.lang.Exception
        <cfdump var="#cfcatch#">
    </cfcatch>
    <cfcatch type="any">
        any
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>

In this case, the output was 'full', that meaning that the <cfcatch> could catch the custom exception, as it had been loaded with the ColdFusion library at start up.

So what does this all mean? Does it mean you can't use libraries with custom exceptions in them? No it does not.  But it does mean you need to handle them in a slightly different way when using JavaLoader.

The solution to this problem is to write code that looks like this:

<cfcatch type="java.lang.Exception">
    <cfswitch expression="#cfcatch.Type#">
    <cfcase value="com.compoundtheory.test.myException">
        <!--- do something with it --->
    </cfcase>
    <cfdefaultcase>
        <cfrethrow>
    </cfdefaultcase>
    </cfswitch>
</cfcatch>

The nice thing is that the 'type' attribute on the cfcatch variable will be set properly to the type of the Java Exception, so we can use it as a sort of 'filter' to weed out the Exceptions we wish to handle, and rethrow the ones that we don't.  It's not the prettiest thing in the world, but it works.

I'm not sure if I classify this as a bug in ColdFusion, but it definitely is an issue if you're not sure how to resolve it.
06 February 2007 01:22 PM 1 Comment

Presenting at cf.Objective!

I'm really excited that I am presenting at cf.Objective this year.  It was a bit of a last minute arrangement, but the tickets are almost all booked, and I'm looking forward to a long journey from my home in Australia all the way to Minneapolis in May.

I'm going to be doing a couple of presentations on Transfer , which is going to be good fun, one of which will cover an introduction to Transfer and ORMs in general, and the other will cover some more 'advanced' Transfer development options.

It's also going to be fantastic to finally put some faces to names of people I've met through the community.  I'm really looking forward to it.

See you all there!