CF10 REST Bug with Block Comments
I spent some time over the weekend working on a project using the new REST functionality in the ColdFusion 10 Public Beta, and I ended up discovering a bug.
I have become a hard and fast fan of script-only CFC's, so I was writing my REST API using them. Something went wrong somewhere, and I decided to comment out a method to see if that would fix it, and it did not. Long story short, the comment caused problems of its own!
Consider this code:
component
rest="true"
restpath="hello"
{
remote struct function hello()
httpmethod="GET"
produces="application/json,application/xml"
{
return { 'message' = 'hello world' };
}
/*
remote struct function echo(string input restargsource="path")
httpmethod="get"
restPath="echo/{input}"
produces="application/json,application/xml"
{
return { 'echo333' = input };
}
*/
}
Seems pretty innocuous, right? Trouble is, having the 2nd method commented out with the block comment that way causes the REST Refresher to fail:
I tried lots of different styles of block comments and here's what I found. These comments work without issue:
/* */
and
/* a b c */
...but these all cause the failure described above:
/**/
and
/* */
and
/* test */
and
/* a b c */
Note that this last one is the same as the last one that works, except that each line (a,b,c) has a space before the letter. With the space it fails, without the space, it works.
Lastly, I'll mention that none of these are illegal syntax for CFC's. I tried the CFC Explorer and calling the uncommented method as a SOAP service and both worked fine in each case.
I've filed this as bug #3119366. If you want to see it fixed, please vote for it!
in ColdFusion | Zeus Posted 2012-02-21 12:14







0 responses:
Leave a comment: