java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12

Appcelerator JIRA | Fokke Zandbergen | 3 years ago
  1. 0

    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}

    Appcelerator JIRA | 3 years ago | Fokke Zandbergen
    java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12
  2. 0

    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}

    Appcelerator JIRA | 3 years ago | Fokke Zandbergen
    java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12
  3. 0

    GitHub comment 6#22723322

    GitHub | 3 years ago | cletus42o
    java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Android : Introducing delay using handler does not work

    Stack Overflow | 4 years ago | user1488212
    java.lang.IndexOutOfBoundsException: Invalid index 12, size is 12
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    Invalid index 12, size is 12

    at java.util.ArrayList.throwIndexOutOfBoundsException()
  2. Java RT
    ArrayList.get
    1. java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
    2. java.util.ArrayList.get(ArrayList.java:304)
    2 frames
  3. ti.modules.titanium
    TableViewProxy.fireEvent
    1. ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411)
    2. ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163)
    2 frames
  4. org.appcelerator.titanium
    TiUIView$4.onFling
    1. org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1476)
    2. org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1467)
    3. org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1187)
    3 frames
  5. Android Platform
    GestureDetector.onTouchEvent
    1. android.view.GestureDetector.onTouchEvent(GestureDetector.java:1399)
    1 frame
  6. org.appcelerator.titanium
    TiUIView$5.onTouch
    1. org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1220)
    1 frame
  7. Android Platform
    ViewGroup.dispatchTouchEvent
    1. android.view.View.dispatchTouchEvent(View.java:7345)
    2. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2412)
    3. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2147)
    4. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    5. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    6. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    7. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    8. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    9. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    10. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    11. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    12. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    13. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    14. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
    15. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
    15 frames
  8. Android
    PhoneWindow.superDispatchTouchEvent
    1. com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139)
    2. com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476)
    2 frames
  9. Android Platform
    Activity.dispatchTouchEvent
    1. android.app.Activity.dispatchTouchEvent(Activity.java:2487)
    1 frame
  10. Android
    PhoneWindow$DecorView.dispatchTouchEvent
    1. com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087)
    1 frame
  11. Android Platform
    ActivityThread.main
    1. android.view.View.dispatchPointerEvent(View.java:7535)
    2. android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415)
    3. android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347)
    4. android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456)
    5. android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434)
    6. android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538)
    7. android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
    8. android.os.MessageQueue.nativePollOnce(Native Method)
    9. android.os.MessageQueue.next(MessageQueue.java:125)
    10. android.os.Looper.loop(Looper.java:124)
    11. android.app.ActivityThread.main(ActivityThread.java:4921)
    11 frames
  12. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  13. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
    2 frames
  14. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame