Ok, the bug could be in jinputtester.jar… but it looks deeper than that… probably caused by a bad device driver, but I think we should try to fail more gracefully with it.
With a Logitech iTouch keyboard I get some strange devices showing up, I’m using the jinputtester.jar posted in another thread. The keyboard is listed as three devices:
Keyboard (keyboard)
Internet Keys USB Internet Keys USB
Internet Keys USB Internet Keys USB
Yes those last two are named the same (and are listed with the name repeated)
If I select the first ‘Internet Keys USB…’ device, the jinputtester program starts spitting out this as it tries to poll:
java.lang.ArrayIndexOutOfBoundsException: 72
at net.java.games.input.DirectInputAxis.getPollData(DirectInputAxis.java:148)
at robs.jinput.AxisTableModel.getValueAt(AxisTableModel.java:60)
at javax.swing.JTable.getValueAt(Unknown Source)
at javax.swing.JTable.prepareRenderer(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Obviously the tester app is asking for an axis that is out of bounds… but why? It appears to be working fine for the other two devices and the mouse, I assume it queries the number of axis from JInput, so I suspect that this device is reporting bad data to JInput, but if the client code is written correctly, I think the exception shouldn’t happen… even if it is the devices fault, there is little that the client can do… maybe JInput can do something to avoid the problem?, like some sort of internal checks that would avoid listing a device that it detects a problem with? Maybe some sort of blacklist of known problem devices?
Note that ControllerReadTest has the same problem.
Here is the error that it spews…
java.lang.ArrayIndexOutOfBoundsException: 63
at net.java.games.input.DirectInputAxis.getPollData(DirectInputAxis.java:148)
at net.java.games.input.test.AxisPanel.poll(ControllerReadTest.java:63)
at net.java.games.input.test.ControllerWindow.poll(ControllerReadTest.java:224)
at net.java.games.input.test.ControllerReadTest$1.run(ControllerReadTest.java:251)
at java.lang.Thread.run(Unknown Source)