Copy link to clipboard
Copied
I have a page with a somewhat large cfswitch--20 or so different cases. Whenever one of these cases does a cfinclude (which is almost all of them), I get an error along the lines of:
org.apache.bcel.generic.ClassGenException: Invalid branch target position offset for jsr[168](3):-1: -1: astore[58](2) 27 at cfindex2ecfm581352809._factor4(/Users/dlaughland/Workspace/abcapp/surveymanager/surveys/survey/index.cfm:34) at cfindex2ecfm581352809._factor28(/Users/dlaughland/Workspace/abcapp/surveymanager/surveys/survey/index.cfm:33) at cfindex2ecfm581352809.runPage(/Users/dlaughland/Workspace/abcapp/surveymanager/surveys/survey/index.cfm:1) at cfApplication2ecfc1705547767$funcONREQUEST.runFunction(/Users/dlaughland/Workspace/abcapp/Application.cfc:215)
I have googled extensively, and the best explanation I can find is a JDK error that was supposedly fixed in MX7! What is causing this? How do I fix it?
Copy link to clipboard
Copied
How large is your application.cfc file (which looks to be the file that your CFSWITCH is in)? Starting with CF8 the maximum size of a CFC file dropped from what it was in CF7, and the error that began occuring on those large CFC files was the same as the one you are seeing. We had a large CFC that ran fien in CF7, and when we upgraded to CF8 if failed. I ended up having to break up the single CFC into multiple CFCs. In your case it could be that a recent edit pushed it over that maximum size.
-reed
Copy link to clipboard
Copied
The cfswitch isn't in the Application.cfc file. It's in the error message because everything originates from the onRequest() method there. (App.cfc is only 16K.) The cfswitch is in the /surveymanager/surveys/survey/index.cfm file, which is 8K.
Copy link to clipboard
Copied
Its probally to late for your case, but just in case anyone runs into this in the future... I had the same error, the root case was having a <cfsetting /> inside a switch statment. So the module was using an old fuse box methodology where <cfinlcudes> were called based on a switch statment, inside of a switch case there was an addtitional if statment to load an error page or some other dsp page.. The template that was included was using <cfsetting> once i removed that it worked just fine. This seems to be an issue with CF9 the same code on CF8 did not throw an error for me.
Hope that helps somebody.....
Here is the code if you want to recreate it.
<cfinclude template="app_locals.cfm">
<cfsetting requesttimeout="120">
<cf_bodycontent>
<cfswitch expression="#Attributes.action#">
<cfcase value="cover">
<cfinclude template="qry_eventcats.cfm">
<cfinclude template="dsp_cover.cfm">
</cfcase>
<cfcase value="upload">
<cfinclude template="qry_eventcats.cfm">
<cfinclude template="act_import.cfm"><!----having a cfsetting inside this template caused an error ---->
<cfif arraylen(errors) AND attributes.failOnError>
<cfinclude template="dsp_errors.cfm">
<cfelse>
<cfinclude template="act_insert.cfm">
<cfinclude template="dsp_Results.cfm">
</cfif>
</cfcase>
<cfdefaultcase>
<cfinclude template="qry_events.cfm">
<cfinclude template="dsp_events.cfm">
</cfdefaultcase>
</cfswitch>
</cf_bodycontent>
<cfinclude template="#attributes.fuse_root#/app_layout.cfm">
Copy link to clipboard
Copied
Hit this problem today, but from a different cause. Thought I'd share in case anyone else finds it useful.
We happened to have something similar to the following deep inside a custom tag:
<cfloop ....>
...
<cfscript>
if ( .... ) {
...
} else {
break;
}
</cfscript>
</cfloop>
The cfscript break inside the CFML cfloop caused an "Invalid branch target position offset ...." error. The simple fix was to CFML the cfscript so we had a cfbreak rather than a break.
Seems obvious now, but it had never caused problems from CF6-8 and worked OK on Railo too.