[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ArrayIndexOutOfBoundsException

Hi Markus,
Thanks for the tip,
After changing the implementation to using the DOMAIN operator, everything works great.
Sadly, after restarting toolbox I can't reproduce the bug here either.


On Sunday, September 10, 2017 at 4:29:56 PM UTC+3, Alon Be wrote:
I have a funny bug, 
I can't post the whole code right now, but I could tomorrow if need be.

I wrote this function :

VectorToSet(V,size) == { V[i] : i \in 1..size }

And kept on receiving an index out of bounds exception, when calling it with parameters: (<<{7},{6},{5}>>, 3).
To debug, I changed the implementation to:

VectorToSet(V,size) == { V[i] : i \in 1..Print(<<"in VectorToSet, V=",V>>,size) }

And suddenly - no bugs!
I am clueless.
I would love it if anyone here could explain what is going on.

This is the error message:
TLC threw an unexpected exception.
This was probably caused by an error in the spec or model.
See the User Output or TLC Console for clues to what happened.
The exception was a java.lang.ArrayIndexOutOfBoundsException
: 1