Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 192420 - [70cat] ArrayIndexOutOfBoundsException: -1
[70cat] ArrayIndexOutOfBoundsException: -1
Product: platform
Classification: Unclassified
Component: Progress
All All
: P2 (vote)
: 7.2
Assigned To: apireviews
: 188999 193861 200057 215228 229393 244997 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2010-11-24 17:00 UTC by pcdinh
Modified: 2015-03-06 12:25 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT

stacktrace (1.25 KB, text/plain)
2010-11-24 17:00 UTC, pcdinh
stacktrace (1.64 KB, text/plain)
2011-06-16 17:11 UTC, aldobrucale
Synchronization in TaskModel (8.60 KB, patch)
2011-10-06 12:10 UTC, Jan Peska
Details | Diff
Patch for API_REVIEW (8.23 KB, patch)
2011-11-23 11:06 UTC, Jan Peska
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pcdinh 2010-11-24 17:00:42 UTC
Build: NetBeans IDE 7.0 Beta (Build 201011152355)
VM: Java HotSpot(TM) Client VM, 17.0-b15, Java(TM) SE Runtime Environment, 1.6.0_21-ea-b05
OS: Windows XP

User Comments:
pcdinh: Tried to run a J2ME project

java.lang.ArrayIndexOutOfBoundsException: -1
   at java.util.Vector.elementAt(
   at javax.swing.DefaultListModel.getElementAt(
   at org.netbeans.modules.progress.spi.TaskModel.getSelectedHandle(
   at org.netbeans.modules.progress.spi.TaskModel.updateSelection(
   at org.netbeans.modules.progress.spi.TaskModel.addHandle(
   at org.netbeans.modules.progress.spi.Controller.runNow(
Comment 1 pcdinh 2010-11-24 17:00:46 UTC
Created attachment 103298 [details]
Comment 2 aldobrucale 2011-06-16 17:11:59 UTC
Created attachment 108932 [details]
Comment 3 Jan Peska 2011-08-09 12:31:11 UTC
*** Bug 200057 has been marked as a duplicate of this bug. ***
Comment 4 Exceptions Reporter 2011-10-06 10:20:47 UTC
This bug already has 20 duplicates 
Comment 5 Jan Peska 2011-10-06 12:10:35 UTC
Created attachment 111595 [details]
Synchronization in TaskModel

Possible fix for this issue
Comment 6 Jan Peska 2011-10-06 12:59:58 UTC
Bug description: Occurrence of this issue is random. It is caused by leak of synchronization within progress API (usage of Two or more threads are accessing TaskModel's fields at the same time.

Waiver justification:  Patch is ready to use (see bugzilla) but it could affect other module that are using this API. This API is widely used in NB so I would like to apply these changes in the next version and solve eventual regressions then.

User impact: Exception dialog is shown. This issue was reported 6x in last three months (during different scenarios).

-> Keywords: 7.1_WAIVER_REQUEST
Comment 7 Jan Peska 2011-11-23 10:43:31 UTC
*** Bug 188999 has been marked as a duplicate of this bug. ***
Comment 8 Jan Peska 2011-11-23 11:06:22 UTC
Created attachment 113454 [details]
Patch for API_REVIEW

This is a final patch, ready to be reviewed. Sync blocks were added for every access to "model" and "selectionModel" fields. Attached listeners (ListDataListener, ListSelectionListener) are added to lists and they are called in another thread after an event is fired to prevent performing listener's actions in sync blocks.
Comment 9 Jan Peska 2011-11-23 11:08:40 UTC
Please review last attached patch.
Comment 10 Jesse Glick 2011-11-23 14:23:12 UTC
I do not think this need to go through API review; org.netbeans.modules.progress.spi is not a public SPI. (The NB module system is incapable of expressing that this package should be visible only to o.n.m.progress.ui whereas the API should be public, but that is the intent.)

Anyway it does not look like you are changing even the SPI, just its implementation; am I missing something?

BTW the following diff:

-    public void addListSelectionListener(ListSelectionListener listener) {
-        selectionModel.addListSelectionListener(listener);
+    public void addListSelectionListener(ListSelectionListener listener) {        
+        synchronized (selectionListeners) {
+            selectionListeners.add(listener);
+        }

shows you adding whitespace to the end of a line but otherwise not changing it. (1) Diffs, especially for review, should avoid formatting changes. (2) When working on any NB code please set Tools > Options > Editor > General > Remove Trailing Whitespace to "From Modified Lines Only" so sources are not polluted by trailing whitespace. (ml-hgext [1] promises to deal with it before commit but I have not found it reliable yet.)

Comment 11 Jan Peska 2011-11-24 13:21:44 UTC
I was not sure if changes in threading have to be reviewed or not. But thanks for tip, that whitespace
Comment 12 Jan Peska 2011-11-28 14:28:24 UTC
*** Bug 193861 has been marked as a duplicate of this bug. ***
Comment 13 Jan Peska 2011-11-28 14:31:09 UTC
Comment 14 Jesse Glick 2011-11-28 17:39:08 UTC
Do not forget to set Target Milestone when closing an issue as FIXED.

(In reply to comment #11)
> I was not sure if changes in threading have to be reviewed or not.

If the changes affect how clients may or should call the API, then this aspect of the contract should be mentioned in Javadoc and changes deserve a review. In this case my impression was that the threading was an internal implementation detail.
Comment 15 Quality Engineering 2011-11-29 15:56:28 UTC
Integrated into 'main-golden'
User: Jan Peska <>
Log: Issue #192420 - [70cat] ArrayIndexOutOfBoundsException: -1
Synchronization added. See issue comments
Comment 16 Jan Peska 2012-09-20 07:57:51 UTC
*** Bug 215228 has been marked as a duplicate of this bug. ***
Comment 17 Jan Peska 2013-08-12 08:13:52 UTC
*** Bug 229393 has been marked as a duplicate of this bug. ***
Comment 18 Ondrej Vrabec 2015-03-06 12:25:53 UTC
*** Bug 244997 has been marked as a duplicate of this bug. ***

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo