Subject Jaybird 2.1.0 RC1 released - IndexOutOfBoundException
Author gamov2k2
Hello,
I'm developing an application that make (intensive) use of the wonderful Event API.
I'm at the finishing stage and I encountered a little problem that seems IMHO a little bug:

When I do:
if (!eventManager.isConnected()) {
eventManager.connect();
logger.debug("DataBaseEvent listener connected to DB");
}

after having added and removed EventListeners in the life cycle of my app, I get the
following error:

Exception in thread "Thread-5" java.lang.ArrayIndexOutOfBoundsException: -4
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl$EventCoordinatorImp.run
(AbstractJavaGDSImpl.java:3065)
at java.lang.Thread.run(Thread.java:595)

AbstractJavaGDSImpl.java:3065 corresponds to:
3061. int count = 0;
int shift = 0;
for (int i = buffer.length - 4;
i < buffer.length; i++){
3065. count += ((buffer[i] & 0xff) << shift);
shift += 8;
}

It looks like that the i = -4 (therefore buffer.length=0) therefore the buffer[i] is not valid.
Honestly, I have no idea what going on there.... just wanted to report it.

Best Regards,
Gam