java.lang.IndexOutOfBoundsException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. Applications can subclass this class to indicate similar exceptions.


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • The following code causes a crash when swiping the table up and down. To reproduce, change the number of rows ({{l}}) so that the table has as many rows it can take without needing to scroll. If you remove the {{headerView}} or the {{swipe}} event listener, it no longer crashes. {code} var w = Ti.UI.createWindow({ backgroundColor: '#fff' }); var t = Ti.UI.createTableView(); t.headerView = Ti.UI.createView({ width: Ti.UI.FILL, height: 50, backgroundColor: 'red' }); var d = []; var l = 12; for (var i = 0; i < l; i++) { d.push(Ti.UI.createTableViewRow({ title: 'Row ' + i })); } t.setData(d); t.addEventListener('swipe', function () { Ti.API.info('swipe'); }); w.add(t); w.open(); {code} The crash log: {code} 08-16 09:31:41.133: E/MessageQueue-JNI(8879): java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.util.ArrayList.get(ArrayList.java:304) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1476) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1467) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1187) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1399) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1220) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.View.dispatchTouchEvent(View.java:7345) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2412) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2147) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.app.Activity.dispatchTouchEvent(Activity.java:2487) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.View.dispatchPointerEvent(View.java:7535) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.MessageQueue.nativePollOnce(Native Method) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.MessageQueue.next(MessageQueue.java:125) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.Looper.loop(Looper.java:124) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.app.ActivityThread.main(ActivityThread.java:4921) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.lang.reflect.Method.invokeNative(Native Method) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.lang.reflect.Method.invoke(Method.java:511) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at dalvik.system.NativeStart.main(Native Method) 08-16 09:31:41.133: W/dalvikvm(8879): threadid=1: thread exiting with uncaught exception (group=0x412d22a0) 08-16 09:31:41.138: E/TiApplication(8879): (main) [2677,10633] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12; Titanium 3.1.2,2013/08/14 12:46,5ceaff8 {code}
    via by Fokke Zandbergen,
  • The following code causes a crash when swiping the table up and down. To reproduce, change the number of rows ({{l}}) so that the table has as many rows it can take without needing to scroll. If you remove the {{headerView}} or the {{swipe}} event listener, it no longer crashes. {code} var w = Ti.UI.createWindow({ backgroundColor: '#fff' }); var t = Ti.UI.createTableView(); t.headerView = Ti.UI.createView({ width: Ti.UI.FILL, height: 50, backgroundColor: 'red' }); var d = []; var l = 12; for (var i = 0; i < l; i++) { d.push(Ti.UI.createTableViewRow({ title: 'Row ' + i })); } t.setData(d); t.addEventListener('swipe', function () { Ti.API.info('swipe'); }); w.add(t); w.open(); {code} The crash log: {code} 08-16 09:31:41.133: E/MessageQueue-JNI(8879): java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.util.ArrayList.get(ArrayList.java:304) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1476) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1467) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1187) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1399) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1220) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.View.dispatchTouchEvent(View.java:7345) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2412) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2147) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.app.Activity.dispatchTouchEvent(Activity.java:2487) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.View.dispatchPointerEvent(View.java:7535) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.MessageQueue.nativePollOnce(Native Method) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.MessageQueue.next(MessageQueue.java:125) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.os.Looper.loop(Looper.java:124) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at android.app.ActivityThread.main(ActivityThread.java:4921) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.lang.reflect.Method.invokeNative(Native Method) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at java.lang.reflect.Method.invoke(Method.java:511) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 08-16 09:31:41.133: E/MessageQueue-JNI(8879): at dalvik.system.NativeStart.main(Native Method) 08-16 09:31:41.133: W/dalvikvm(8879): threadid=1: thread exiting with uncaught exception (group=0x412d22a0) 08-16 09:31:41.138: E/TiApplication(8879): (main) [2677,10633] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12; Titanium 3.1.2,2013/08/14 12:46,5ceaff8 {code}
    via by Fokke Zandbergen,
  • GitHub comment 6#22723322
    via GitHub by cletus42o
    ,
  • IndexOutOfBoundsException
    via GitHub by DropArtDev
    ,
  • 一个关于Cookile的问题
    via GitHub by x842205017
    ,
    • java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411) at ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163) at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1476) at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1467) at org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1187) at android.view.GestureDetector.onTouchEvent(GestureDetector.java:1399) at org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1220) at android.view.View.dispatchTouchEvent(View.java:7345) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2412) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2147) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476) at android.app.Activity.dispatchTouchEvent(Activity.java:2487) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087) at android.view.View.dispatchPointerEvent(View.java:7535) at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:125) at android.os.Looper.loop(Looper.java:124) at android.app.ActivityThread.main(ActivityThread.java:4921) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    Macapon
    6 times, last one,
    Unknown visitor1 times, last one,
    szoszi
    2 times, last one,
    Larten
    1 times, last one,
    Unknown visitor1 times, last one,
    237 more bugmates