Running into the error “Branch target offset too large for short” with a Coldfusion CFC? Sounds like you have a function that is too long!
I have run into this error a couple of time now working on legacy code that is using CFC’s to output loads of HTML. “Icky” as my two year old would say.
Why does this happen?
This is caused because the method length exceeds the size supported by the JVM. In other words a function in your CFC is too darn long. Got a 3000 line function in there? Yep that’s probably it.
How do we fix it?
As we know we cant always drop everything and rewrite the entire application so the short fix is to refactor. Moving sections of code out of the main function and into their own function will solve the issue. Another issue that could be causing the error is “cfdump”. If you are dumping queries into your function this could also likely be the culprit. But remember, adding any additional code back to the original function down the line will eventually cause the error to pop back up. This is probably a situation worth taking the time to make a little comment <!– so you don’t forget —>