Lucee 6.2.2.91 Bad access to protected data in invokevirtual

I’ve run into a persistent VerifyError when trying to call clone() on a jSoup (1.21.2) Element from CFML. This happens on a fresh Lucee 6.2.2.91 install (Tomcat 11.0.9, Java 21.0.8 Eclipse Adoptium 64-bit) using Windows installer.

The same code works as expected in the previously installed Lucee 5.4 (Tomcat/9.0.98, Eclipse 11.0.25), but fails inside Lucee 6.2.

I’ve worked around the issue using a custom function, but I’d rather use the native methods provided by the component. Thoughts?

Example:

 <cfset element = createObject("java","org.jsoup.Jsoup")
        .parseBodyFragment("<p><b>x</b></p>")
        .selectFirst("p")>

    <!--- This line throws the VerifyError --->
    <cfset dup = element.clone()>

Result:

Bad access to protected data in invokevirtual Exception Details: Location: lucee/invoc/wrap/v4/org/jsoup/nodes/Element/clone.apply(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @1: invokevirtual Reason: Type ‘java/lang/Object’ (current frame, stack[0]) is not assignable to ‘lucee/invoc/wrap/v4/org/jsoup/nodes/Element/clone’

Stack Excerpt:

Caused by: java.lang.VerifyError: Bad access to protected data in invokevirtual
Location: lucee/invoc/wrap/v4/org/jsoup/nodes/Element/clone.apply…

@sgauthier Thanks for identifying and reporting this — really appreciate the detailed reproduction steps. The VerifyError issue with Element.clone() in jsoup (v1.21.2) on Lucee 6.2 is indeed valid, and it’s great to see that Zac has created the official ticket LDEV-5862 to track it. This will definitely help ensure better Java compatibility and stability in upcoming Lucee releases.

1 Like

Fantastic! Thanks All