java.lang.ArrayIndexOutOfBoundsException when adding new application scoped variable

Hi folks,

I get a java.lang.ArrayIndexOutOfBoundsException when I add a new
application variable.

Message
18 Cause java.lang.ArrayIndexOutOfBoundsExceptionThe stacktrace highlights
the new application variable.

I have a list of application variables that I set depending on what
environment the application is running.

When a “reset=true” is added to the url I do a applicationStop() in the
onRequestStart, so I can set the variables again. This works fine when I
change a variable, but when I add a new one I get this error. Also using
StructClear does not work.

However when I restart Lucee, it just works fine. Obviously Lucee holds an
array of application variables that does not seem to get resized to the
right index (in this case index 18).

In ACF this works fine though.

I appreciate your ideas on how I could fix this without restarting Lucee.

Marcel Dix

Hi Marcel, old colleague,

The simplest thing you could do to fix this, is not using applicationStop, but doing structClear(application).
Still, that might mess up other concurrent requests, which rely on variables in the application scope. But it should fix your problem.

Kind regards,

Paul KlinkenbergOp 13 nov. 2015, om 21:48 heeft Marcel Dix <@Marcel_Dix> het volgende geschreven:

Hi folks,

I get a java.lang.ArrayIndexOutOfBoundsException when I add a new application variable.

Message
18
Cause java.lang.ArrayIndexOutOfBoundsException
The stacktrace highlights the new application variable.

I have a list of application variables that I set depending on what environment the application is running.

When a “reset=true” is added to the url I do a applicationStop() in the onRequestStart, so I can set the variables again. This works fine when I change a variable, but when I add a new one I get this error. Also using StructClear does not work.

However when I restart Lucee, it just works fine. Obviously Lucee holds an array of application variables that does not seem to get resized to the right index (in this case index 18).

In ACF this works fine though.

I appreciate your ideas on how I could fix this without restarting Lucee.

Marcel Dix


Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com mailto:lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/4e095c52-926f-4418-a469-9bc54f3d7922%40googlegroups.com https://groups.google.com/d/msgid/lucee/4e095c52-926f-4418-a469-9bc54f3d7922%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

Hey Paul,

Good to hear from you!

Structclear was also my first bet (see 1# post). That does not work though.
I’ll be experimenting a bit more to see why. It’s pretty old code that I’m trying to migrate. Must be something odd.

Cheers Marcel

Found it.

The initialisation of application variables was done at two places:
onRequest (when flushing) and onApplicationStart. Removed the last one.