Yes, that is the interestingly ambiguous message I recieved today while developing on a particularly large CFC. In this particular component there was a function that was excessively long, so I decided to be cool and break it apart a little bit. To start I took out a 523 line query and moved it to a new function. When I then ran the code I recieved the following error: “Branch target offset too large for short”.

JVM Error

Ok… I’ve not quite heard of this one before, so I turned to the ever trusty Google. Turns out that there is a limitation in the JVM where branch statements (like GOTO) cannot reach an address (or offset) in the code past 32,767 bytes, or a SHORT integer. In short (pun intended) one of my functions, or some branch condition in an IF or SWITCH statement, cannot be reached because it is at an offset that exceeds 32,767 bytes. Code is too big!!

UPDATE: To fix this issue I moved a large branch of code that contained a large number of IF/ELSE statements to a new function. This apparently solved the issue and the code ran happily along again.

Related Posts

No related posts.

  1. Dale Severin says:

    I upgraded to CF9.0.1 and now I get Branch target offset too large for short on my login screens that worked fine in CF9.

  2. Adam Presley says:

    That seems odd. I wonder if there are changes made in CF that could have caused it? Most times I’ve encountered this the solution almost always involved breaking down large IF/ELSE, SWITCH statements, or large functions with IF or SWITCHES in them.