ConcurrentModificationException

Sometimes, when navigating from form to form, the first time I load a form I get an error.

Without debugger, the error is “Cannot perform method ‘Null’”
With debugger, the error is “java.util.ConcurrentModificationException”

I had run into this before, and discovered that two methods, one triggered onLoad and one triggered onShow, were both editing the same global value (the global I use to show maxRecordIndex in the custom controller form). Removing the steps from the onLoad solved the problem.

Now, though, it appears to be giving me this error when two methods are triggered and edit different globals.

Has anyone else encountered this, and found a way to prevent it? Anyone have suggestions?

(Actually, if there’s another way to show the maxRecordIndex for the current form on the custom controller, I could circumvent this challenge altogether, at least for now.)

Chris,

Use the syntax:

databaseManager.getFoundSetCount(foundset) 

I’ve used this on foundsets as big as a million records - and it’s fast.

Bob

Curiouser and curiouser…

I can produce this error consistently on a form called “contracts”.

I have several other forms, among them one called “media_outletsRec”, which have identical trigger methods (globals).

Navigating to Contracts the first time produces the error. Not so with Media Outlets.

Bob,

This is a great tip!

However, I’ll still need to set the result into my global to display it, right?

Chris - yep - set the global to display the value.

Which seems to be the cause of the concurrent error message that is the subject of my post?

I don’t think the globals are the things that are causing the error. It sounds like the both events are trying to work on the same foundset or something. Globals are IN MEMORY VARIABLES, not physical “objects” - so I don’t think there’s any problem in accessing them.

I know that there is a fix in 2.2 for two events triggering at the same time (which is what I think the error is you’re getting).

When I’m running the debugger, the error pops on a step that’s setting the global. That being said, I’m not positive that that’s really what’s causing the error, either…

The 2.2 fix sounds promising, as do some of the other predicted enhancments. Is there a projected timeline for that release? If it’s coming in a matter of weeks, I may just live with this for now.

It’s a matter of weeks (beta sooner).