java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Wayne Johnson
Posts: 12
Joined: Wed Mar 08, 2017 12:40 pm

java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Wayne Johnson » Thu May 17, 2018 7:05 pm

Greetings,
I get the following error message when trying to view (Preview experimental data) my trc file:

A java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Based on a prior post regarding the same out of bounds error, I did shorten my file name to 14 characters (down from 21 characters), but still get the same error. I attached the .trc file for reference. I am running OpenSim v3.3.

Thanks,
Wayne


Full error msg:
A java.lang.ArrayIndexOutOfBoundsException exception has occurred.

java.lang.ArrayIndexOutOfBoundsException: 21
at org.opensim.view.experimentaldata.AnnotatedMotion.<init>(AnnotatedMotion.java:98)
at org.opensim.view.motions.FileLoadDataAction.performAction(FileLoadDataAction.java:57)
at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:129)
at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:126)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6516)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6281)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4872)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:747)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:720)
at java.awt.EventQueue$4.run(EventQueue.java:718)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:717)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Attachments
S10kg8stv2.zip
Zipped .trc file.
(5.9 KiB) Downloaded 65 times

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Thomas Uchida » Thu May 17, 2018 7:59 pm

There are two errors in the file:
1. A blank row must be inserted before the data for the first frame; and
2. The "Frame #" label cannot contain a space.
See the example on the "Marker (.trc) Files" page in the Confluence documentation (https://simtk-confluence.stanford.edu/d ... c%29+Files).

User avatar
Wayne Johnson
Posts: 12
Joined: Wed Mar 08, 2017 12:40 pm

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Wayne Johnson » Fri May 18, 2018 9:35 am

Thank you!!

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Thomas Uchida » Fri May 18, 2018 5:29 pm

Ah, sorry- the only issue is that there cannot be a space between "Frame" and "#" (the blank row is not essential).

User avatar
Robert Catena
Posts: 8
Joined: Tue Jun 04, 2019 3:32 pm

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Robert Catena » Tue Jul 19, 2022 10:27 pm

Is there a way for the user to read the error to know the problem or should it just get posted on here?

I am getting a slightly different error read out when I try to open a trc file using "preview experimental data". See below. Can you tell me what the problem is just by seeing the error? I would attach my zipped trc file, but it says it is too large to be attached, so below the error readout is the first (5x9) few cells of my trc file.

java.lang.ArrayIndexOutOfBoundsException: 162
at org.opensim.view.experimentaldata.AnnotatedMotion.<init>(AnnotatedMotion.java:107)
at org.opensim.view.motions.FileLoadDataAction.performAction(FileLoadDataAction.java:60)
at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:105)
at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:70)
at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:91)
at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:74)
at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:102)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:842)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:886)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


PathFileType 4 (X/Y/Z) Trimmed_S35-3-t1.trc
DataRate CameraRate NumFrames NumMarkers Units OrigDataRate OrigDataStartFrame OrigNumFrames
100 100 1000 54 mm 100 1 1000
Frame# Time Fhead Rtemp Ltemp
X1 Y1 Z1 X2 Y2 Z2 X3

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Thomas Uchida » Wed Jul 20, 2022 10:28 am

PathFileType 4 (X/Y/Z) Trimmed_S35-3-t1.trc
DataRate CameraRate NumFrames NumMarkers Units OrigDataRate OrigDataStartFrame OrigNumFrames
100 100 1000 54 mm 100 1 1000
Frame# Time Fhead Rtemp Ltemp
X1 Y1 Z1 X2 Y2 Z2 X3
I don't think this would work as the columns for Y3 and Z3 would be missing headers. The issue may be due to whitespace (e.g., it looks like tabs are missing at the beginning of row 5). Please see the "Marker (.trc) Files" page in the documentation for a description of the formatting requirements (https://simtk-confluence.stanford.edu:8 ... c%29+Files). There are also example TRC files in the Resources directory that you could use for comparison.

User avatar
Robert Catena
Posts: 8
Joined: Tue Jun 04, 2019 3:32 pm

Re: java.lang.ArrayIndexOutOfBoundsException exception has occurred.

Post by Robert Catena » Fri Jul 22, 2022 1:38 pm

The whitespace for headers was not the issue. Jake Banks found the issue for me. My TRC file (created from MotionAnalysis Cortex software) had virtual markers, but Cortex does not update the marker number amounts in the TRC when virtual markers are added. Instead, it was only listing (n=54) real markers we had, which conflicted with how many columns of data we had (54 real markers and 34 virtual markers). I changed the cell to 88 instead of 54 and it opened.

POST REPLY