Code of a method longer than 65535 bytes

Encountered the above while parsing an XML file in ColdFusion.

Root of the problem:

This is a limitation of Java. A classfile may not exceed 65535 bytes. ColdFusion compiles CFML into Java bytecode, and each method gets its own .class file. (Look in WEB-INF/cfclasses) There does not appear to be a way to increase this limit.

Why we saw this error:

For convenience, we have some pound-delimited variables scattered through the XML file. Before parsing, we call evaluate() a few times. If we evaluated a large enough XML file, we saw the error.

Our workaround

Without getting into the details, we avoid this limitation by evaluating smaller chunks of XML at a time. In our project, we were already including smaller XML into larger XML 'reports', and so we were able to perform the evaluation during this recursion.

We hope this helps you!

Happy coding!

Tags: xml-parsing coldfusion