ColdFusion 9 and missing variables while using the line debugger

While working on a project that deals with serialization of objects, I discovered something very weird while using the line debugger. And it took me a fair few hours to work out that this was a bug with ColdFusion Builder rather than ColdFusion, or at least with the debugging of ColdFusion anyway.

So to get a feel of this problem lets look at the offending code in question, this is inside a function written in ColdFusion 9 script and whether that has anything to do with it will have to further investigate.

local.fileIn = CreateObject("java", "java.io.FileInputStream");
local.fileIn.init(local.serComponent);
local.objIn = CreateObject("java", "java.io.ObjectInputStream");
local.objIn.init(local.fileIn);
local.object = local.objIn.readObject();
local.fileIn.close();
local.objIn.close();

What you can't see here is that this is inside of a try/catch block of code, so that if the serialized object doesn't exist it is then loaded normally.

But take extra not of the variable I have called local.object, this is the variable that will contain the the loaded object. While running the line debugger over this code, for a few hours tonight looking for a problem with a thread I had running. I discovered that the local.object when viewed in the line debugger actually doesn't exist.

However ColdFusion doesn't throw an error on the line, and the function this is in returns the local.object and still doesn't throw an error. I thought this was weird, so to test this out some more I began looking at another option that I can do in the debugger, and view the output that is being sent back to the client request.

So I modified the above code to include a writeDump(local.object) right after it was declared, and low and behold there was the object viewable in the server output buffer. So it seems that in this example the line debugger just refuse to see it, but ColdFusion is happy to know about it and work happily.