Skip to: Site menu | Main content

Email LinkedIn


Branch target offset too large for short null in ColdFusion

When working with complex logic functions in ColdFusion (i.e. lots of code) I've encountered this error numerous times

Branch target offset too large for short null

This error essentially means your method length exceeds what the JVM allows.

To correct the error break the logic up into multiple smaller functions.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
In a FW/1 Application what would the recommended way to break up a controller cfc into smaller functions. Any Suggestions?
# Posted By Graham Pearson | 1/1/18 10:15 AM
@Graham I'm not very familiar with the FW/1 framework. However, just taking a quick look it appears that it should be no different than any other CFC. Typically what I do is name my smaller functions based on the "main" function I'm attempting to break up.

So something like:
<cffunction name="smallerfunction1_mainfunction" access="private"></cffunction>

Then your main function would look like:
<cffunction name="mainfunction" access="public">
<cfset smallerfunction1_mainfunction(arg1,arg2,...)>
<cfset smallerfunction2_mainfunction(arg1,arg2,...)>

If you need to pass values around to each smaller function the best way I've found is to return the variable from your smaller function to your main function where it can then be manipulated and/or passed on to the next smaller function.

All that said if the logic is getting this complicated in a page controller you may want to consider moving the logic completely out of the controller and into it's own class or classes.

I'm happy to look at your code if you want to PM me.
# Posted By Jason Holden | 1/1/18 11:23 AM