There is a bug in Lucee were a template that's hit with two different cases in the path or filename will throw a weird compilation error after code has changed in the file.
These steps must be followed exactly and will work on Lucee 4 with the java agent enabled or on Lucee 5.
Create a file foo.cfm
Add a few lines of CFML code setting variables
Hit the file as /foo.cfm in the browser
Now hit the file as Foo.cfm in the browser (upper case "F")
Now edit the file and add an additional line of CF code to the end
Refresh /Foo.cfm in the browser (still upper case "F")
Now load /foo.cfm in the browser (back to the original lower case "f")
You will receive a java.lang.ArrayIndexOutOfBoundsException
In Lucee 4 you can work around this by removing the java agent. In Lucee 5 there is no workaround.
Message 12
Cause java.lang.ArrayIndexOutOfBoundsException
lucee.runtime.exp.NativeException: 12
at foo_cfm$cf.call(C:\sandbox\case\foo.cfm:14)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:808)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:803)
at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:62)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2250)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2242)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2210)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:848)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 12
... 35 more
possible that this fix https://luceeserver.atlassian.net/browse/LDEV-638 solves also this ticket
i did a testcase based on your input (step by step)
https://github.com/lucee/Lucee/commit/ea26fb4e37401d7992d174edd36e669f4efc4747
But it works with current version and older versions as well (version before LDEV638 was fixed), so i cannot say if LDEV638 solves this issue or not.
thinking about it, lead me to the idea that this could be related to the template key table, and the variable keys i used in my test all came from the global constant table, so after adjusting the keys
https://github.com/lucee/Lucee/commit/1a4552fa127f5cf90a584ecdcd05e7b81d1ed8ba
i could reproduce the issue with the affected version and because of that find out that LDEV638 solves it.
issue appears again!