Carcassonne Central

Carc Central Community => Online Games and Competitions => JCloisterZone FAQ, Suggestions & Bug Reports => Topic started by: Phisk on December 16, 2014, 04:07:05 PM

Title: "Array Index Out of Bounds Exception" Alert
Post by: Phisk on December 16, 2014, 04:07:05 PM
What does this alert mean and why does it show up? Thanks for your help!
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Paul on December 17, 2014, 12:29:31 AM
arrays are used in programming language. Could be you need to update Java (by Oracle media) or are you using a JavaScript yourself?

Arrays have an index and like the error says and could be anything but usually it's because the script is missing a semi-colon somewhere.
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Decar on December 17, 2014, 02:27:27 AM
Hi Phisk,

a) Is this happening when the application starts up or when you're doing something in particular?

b) is there an error.log in the JCloisterZone directory?

c) Can you confirm what version of Java you are running?

d) Can you confirm JCloisterZone is the latest version 3.0.2?

Cheers :)
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Phisk on December 17, 2014, 04:06:22 AM
Hi Decar,

a) I placed a tile and suddenly this showed up.

b) yes there is.

c) Unfortunately I'm not very experienced with computers so I don't know :-\

d) Yes, it's the latest version.

Thanks
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Decar on December 17, 2014, 07:28:25 AM
That's useful,

Does it happen every time you place a tile or was it a one off?

Any chance you can paste the content of the error.log here - it might contain a clue.

I'm trying to find an easy way of checking your java version - it's probably 1.7 so I imagine that's not the cause.
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Decar on December 17, 2014, 07:30:06 AM
You might be able to check you're up to date with this:

https://www.java.com/en/download/installed.jsp
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Paul on December 17, 2014, 07:31:08 AM
You might be able to check you're up to date with this:

https://www.java.com/en/download/installed.jsp

 :(y) Beat me to it!  ^-^
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: farin on December 17, 2014, 08:34:37 AM
Hi
In help menu is choice to create bug report (which contains java version etc). So if it happens again plese try to create report.

Maybe you still have, error.log in game directory. If so please sent it to me. Thanks
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: danisthirty on December 17, 2014, 08:51:20 AM
Hi
In help menu is choice to create bug report (which contains java version etc). So if it happens again plese try to create report.

Maybe you still have, error.log in game directory. If so please sent it to me. Thanks

 :(y)

Thanks farin!  :)
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Phisk on December 17, 2014, 09:40:17 AM
Ok, it says I have the recommended Java version installed.

It happened when I placed a single tile. I started a new game today and there were no problems at all.

the error.log says:

[Thread-21] ERROR com.jcloisterzone.ui.panel.GamePanel - null
java.lang.ArrayIndexOutOfBoundsException
   at com.jcloisterzone.board.DefaultTilePack.drawTile(DefaultTilePack.java:75)
   at com.jcloisterzone.board.DefaultTilePack.drawTiles(DefaultTilePack.java:86)
   at com.jcloisterzone.game.phase.BazaarPhase.handleRandSample(BazaarPhase.java:94)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:483)
   at com.jcloisterzone.wsio.MessageDispatcher.dispatchOn(MessageDispatcher.java:47)
   at com.jcloisterzone.wsio.MessageDispatcher.dispatch(MessageDispatcher.java:30)
   at com.jcloisterzone.rmi.ClientStub.onWebsocketMessage(ClientStub.java:117)
   at com.jcloisterzone.wsio.Connection$1.onMessage(Connection.java:72)
   at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:248)
   at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:375)
   at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:158)
   at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:185)
   at java.lang.Thread.run(Thread.java:745)
[Thread-21] ERROR com.jcloisterzone.EventBusExceptionHandler - game event bus > Could not dispatch event: com.jcloisterzone.ui.InvokeInSwingUiAdapter@7f6ff426 to public void com.jcloisterzone.ui.InvokeInSwingUiAdapter.handleAllEvents(com.jcloisterzone.event.Event)
java.lang.NullPointerException
   at com.jcloisterzone.action.TilePlacementAction.toString(TilePlacementAction.java:102)
   at java.lang.String.valueOf(String.java:2981)
   at java.lang.StringBuilder.append(StringBuilder.java:131)
   at java.util.AbstractCollection.toString(AbstractCollection.java:462)
   at java.lang.String.valueOf(String.java:2981)
   at java.lang.StringBuilder.append(StringBuilder.java:131)
   at com.jcloisterzone.event.SelectActionEvent.toString(SelectActionEvent.java:36)
   at java.lang.String.valueOf(String.java:2981)
   at java.lang.StringBuilder.append(StringBuilder.java:131)
   at com.jcloisterzone.ui.InvokeInSwingUiAdapter.handleAllEvents(InvokeInSwingUiAdapter.java:30)
   at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:483)
   at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
   at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
   at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
   at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
   at com.google.common.eventbus.EventBus.post(EventBus.java:275)
   at com.jcloisterzone.game.Game.flushEventQueue(Game.java:124)
   at com.jcloisterzone.rmi.ClientStub.phaseLoop(ClientStub.java:132)
   at com.jcloisterzone.rmi.ClientStub.onWebsocketMessage(ClientStub.java:118)
   at com.jcloisterzone.wsio.Connection$1.onMessage(Connection.java:72)
   at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:248)
   at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:375)
   at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:158)
   at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:185)
   at java.lang.Thread.run(Thread.java:745)
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Leven on January 22, 2015, 01:47:24 PM
FYI:
A few days ago I took part in a 3-player game where the Bridges, castles and bazaars expansion was included.
When there was only 2 tiles left in the stack, one of us drew the remaining Bazaar tile, and then it happened: the "ArrayIndexOutOfBoundsException" appeared.
So apparently the problem occurs when there is less tiles left than the number of players.

According to CAR, in such a situation the Bazaar has to be ignored so that would be the appropriate behaviour of JCZ.
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: farin on January 22, 2015, 03:01:07 PM
hi,

in that case it is this bug https://github.com/farin/JCloisterZone/issues/98
will be fixed in 3.1-beta1 (i hope i will build it during weekend)
Title: Re: "Array Index Out of Bounds Exception" Alert
Post by: Leven on January 22, 2015, 04:38:29 PM
That's it, exactly.
Fortunately the last two tiles of that game could not influence the final result yet, everything was already decided by that time.