0

I have been running a game server and I get this error. I'm not really familiar with java yet so please help me out. I have a couple event managers to handle player events, like woodcutting or mining, and maybe events are not stopped correctly, i'm not sure. Can you explain what awt event queue is?

This happens when we have the game server running for more than a day. Probably happens every 12 hours or so.

[2/8/12 11:00 AM]: Exception in thread "AWT-EventQueue-0" [2/8/12 11:00 AM]: jav
a.lang.ArrayIndexOutOfBoundsException: 14 >= 14
[2/8/12 11:00 AM]:      at java.util.Vector.elementAt(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.DefaultListModel.getElementAt(Unknown Sou
rce)
[2/8/12 11:00 AM]:      at javax.swing.plaf.basic.BasicListUI.paintCell(Unknown
Source)
[2/8/12 11:00 AM]:      at javax.swing.plaf.basic.BasicListUI.paintImpl(Unknown
Source)
[2/8/12 11:00 AM]:      at javax.swing.plaf.basic.BasicListUI.paint(Unknown Sour
ce)
[2/8/12 11:00 AM]:   at javax
.swing.plaf.ComponentUI.update(Unknown Source)

[2/8/12 11:00 AM]:      at javax.swing.JComponent.paintComponent(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paint(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paintChildren(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paint(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JViewport.paint(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paintChildren(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paint(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paintToOffscreen(Unknown Sourc
e)
[2/8/12 11:00 AM]:      at javax.swing.BufferStrategyPaintManager.paint(Unknown
Source)
[2/8/12 11:00 AM]:      at javax.swing.RepaintManager.paint(Unknown Source)
[2/8/12 11:00 AM]:      at javax.swing.JComponent._paintImmediately(Unknown Sour
ce)
[2/8/12 11:00 AM]:      at javax.swing.JComponent.paintImmediately(Unknown Sourc
e)
[2/8/12 11:00 AM]:      at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)
[2/8/12 11:00 AM]:      at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)
[2/8/12 11:00 AM]:     at javax
.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)

[2/8/12 11:00 AM]:      at javax.swing.RepaintManager.access$700(Unknown Source)

[2/8/12 11:00 AM]:      at javax.swing.RepaintManager$ProcessingRunnable.run(Unk
nown Source)
[2/8/12 11:00 AM]:      at java.awt.event.InvocationEvent.dispatch(Unknown Sourc
e)[2/8/12 11:00 AM]: Npc deleted

[2/8/12 11:00 AM]:      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
[2/8/12 11:00 AM]: Npc deleted

[2/8/12 11:00 AM]:      at java.awt.EventQueue.access$000(Unknown Source)[2/8/12
 11:00 AM]: Npc deleted

[2/8/12 11:00 AM]:      at java.awt.EventQueue$3.run(Unknown Source)[2/8/12 11:0
0 AM]: Npc deleted

[2/8/12 11:00 AM]:      at java.awt.EventQueue$3.run(Unknown Source)
[2/8/12 11:00 AM]: Npc deleted[2/8/12 11:00 AM]:        at java.security.AccessC
ontroller.doPrivileged(Native Method)

[2/8/12 11:00 AM]:      at java.security.ProtectionDomain$1.doIntersectionPrivil
ege(Unknown Source)
[2/8/12 11:00 AM]:
at java.awt.EventQueue.dispatchEvent(Unknown Source)

[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.pumpOneEventForFilters(U
nknown Source)
[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.pumpEventsForFilter(Unkn
own Source)
[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.pumpEventsForHierarchy(U
nknown Source)
[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.pumpEvents(Unknown Sourc
e)
[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.pumpEvents(Unknown Sourc
e)
[2/8/12 11:00 AM]:      at java.awt.EventDispatchThread.run(Unknown Source)
Tudor
  • 61,523
  • 12
  • 102
  • 142
Aleksandr
  • 29
  • 6
  • The stacktrace itself does not help very much without the actual code where the exception is thrown. Can you post it please and indicate the line where the error occurs? – Tudor Feb 08 '12 at 19:52
  • I wish i had known where it's being thrown from... I can't find where it's being thrown... – Aleksandr Feb 09 '12 at 01:24

2 Answers2

2

I'm guessing you are updating the state of a component outside of the Event Dispatch Thread which can randomly cause problems.

Maybe Concurrency in Swing will help.

camickr
  • 321,443
  • 19
  • 166
  • 288
1

Regarding the event queue: when you have an application that uses a graphical user interface (GUI), there is also a thread associated with this GUI. The thread runs a loop waiting for events like mouse clicks and so on. That thread is also the only one that is supposed to update the controls on the GUI if something needs to change (e.g. a list is updated with more data).

The GUI thread operates the changes from a so-called event queue. Other threads that need to update the GUI need to forward their updates to the GUI thread, a process by which they get added to the event queue, because only the GUI thread can actually apply them.

Read some more about it here: http://www.kauss.org/Stephan/swing/index.html

Tudor
  • 61,523
  • 12
  • 102
  • 142