开发者

Strange coldfusion error: "0"

I have a page with some code that's repeated several times. I fact开发者_StackOverflowored out the code into a template file and included the template file to avoid repetition. However, I'm getting the strangest error - the regular debugging coldfusion error shows up with "The following information is meant for the website developer for debugging purposes." and "Error Occurred While Processing Request"... But the section that usually has the error message just says "0". (If I look in the stack trace section I see "java.lang.ArrayIndexOutOfBoundsException: 0"...) What does this mean?

Besides for the fact that I've never seen a coldfusion error like this and don't understand what it's referring to, I'm surprised that I'm getting an error in the first place. The page was working, I copied the code exactly into another file and included it using a "cfinclude"... And if I copy the code back it works just fine. I thought cfinclude just inserts the code in the file directly into the page - how can I get an error with the cfinclude that I don't get with the literal code? What am I missing about how cfinclude works?

Update: the problem seems to be with a nested cfoutput. I have something like:

<cfoutput group="myGroup">
   <cfoutput group="myNestedGroup">
      ... lots of code ...
   </cfoutput>
</cfoutput>

This is what's throwing the error. Any ideas why?

Update 2:

This seems to be a Coldfusion bug. Can anyone think of a workaround?


This might be something really obvious so my apologies but the cfouput also needs to include the query="".

I normally get an ArrayIndexOutOfBoundsException when using an array or structure when the key value doesn't actually exist i.e. anexample[keyValue].data1. I would suggest looking at the data you are pulling as the first port of call, either manually or put in a ctry/cfcatch to narrow down the row that might be causing it.


If your problem is that you can't do a cfinclude in the middle of a set of nested, grouped cfoutput tags, you have two choices (other than leaving the working code alone)...

One would be to write a function that takes the query as an argument and performs the entire set of cfoutput statements, etc.

The other is to declare some local variables that contain the bits of the query that your include needs before including it - includes have access to the same variables scope as the including page. Come to think of it, it sounds like you may not be using explicit references to the query variables, which could itself be the solution. So instead of: #foo# use: #variables.queryname.foo#.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜