The Fix or Coldfish Railo-fiedAs it turns out the problem wasn't too hard to fix. Apparently there are some slight differences in the way Coldfusion and Railo deal with underlying Java objects. When formatting the code Jason creates a java BufferedReader, and then
var reader = createObject("java","java.io.BufferedReader").init(IStream);
var line = reader.readLine();
He then passes the line (java object) to a format function and the line of code is then prettied up.
Here is where the trouble starts:
var character = "";
var i =0;
if (variables.isOneLineComment) endOneLineComment();
for (i=0; i LT thisLine.length(); i=i+1)
if (character EQ '<')
/*a bunch more code*/
The last line of code causes Railo to throw an error. The question is why? Well the problem it seems that the character variable is assigned a Java object and an object can not be compared to a simple string. Apparently CF automagically tags on the toString() function for you if you forget to. Railo isn't so forgiving.
By changing each instance of character to character.toString() the error went away and my code was beautified.
I tested the code change in CF8 and it works too. I don't have any younger versions of Coldfusion or Railo to test the changes on so it's probably better if you just upgrade :) I am including the CFC here if you want to download it for use with BlogCFC and Railo. Perhaps if someone has an older version of CF or Railo if they would like to test the code highlighting feature and let me know if it still works I would appreciate it.
No recent entries.