This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 112536 - AIOOBE while switching views in multiview editor and HierarchyEvent listener is added
Summary: AIOOBE while switching views in multiview editor and HierarchyEvent listener ...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: David Simonek
URL:
Keywords: T9Y
Depends on:
Blocks: 112096
  Show dependency tree
 
Reported: 2007-08-10 12:32 UTC by Jiri Skrivanek
Modified: 2008-12-22 14:22 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace. (3.60 KB, text/plain)
2007-08-10 12:32 UTC, Jiri Skrivanek
Details
Module to simulate problem. (7.20 KB, application/octet-stream)
2007-08-10 12:33 UTC, Jiri Skrivanek
Details
diff of hacky solution - model cleaning postponed by invokeLater (1.97 KB, application/octet-stream)
2007-08-14 15:54 UTC, David Simonek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2007-08-10 12:32:05 UTC
This problem appeared after fixing issue 109123 (change in openide/explorer/src/org/openide/explorer/view/ListView.java
http://deadlock.netbeans.org/fisheye/browse/netbeans/openide/explorer/src/org/openide/explorer/view/ListView.java?r1=1.12&r2=1.13).
ArrayIndexOutOfBoundsException is thrown when you switch between Schema, Design, Source views in multiview editor for
XML schema. It happens only on JDK1.6.0 and only if HierarchyEvent listener is added to Toolkit. We use such listeners
in our testing tools, that's why this issue blocks automating testing. To reproduce:

- run IDE with JDK1.6
- open attached module in IDE
- call 'Install/Reload in Development IDE' action on module's project node
- call 'Help|Add Listener' main menu action
- open new file wizard
- choose 'XML|XML Schema' and finish the wizard
- switch to Design view in editor
- switch to Schema view, again to Design and bunch of AIOOBEs will appear. If you call 'Help|Remove Listener', it works
without exceptions.

Since build 200707241200, JDK1.6.0_02-b05.
Comment 1 Jiri Skrivanek 2007-08-10 12:32:50 UTC
Created attachment 46456 [details]
Stack trace.
Comment 2 Jiri Skrivanek 2007-08-10 12:33:36 UTC
Created attachment 46457 [details]
Module to simulate problem.
Comment 3 _ rkubacki 2007-08-10 17:21:49 UTC
It is not clear to me how the change is related. Passing to Milos who maintain multiview. 
Comment 4 David Simonek 2007-08-11 11:28:59 UTC
It's true that my change looks unrelated, but it triggers the exception somehow. If my fix for 109123 is deleted, then
exception is gone. I think it's JDK issue, but we have to prove it somehow...
Comment 5 David Simonek 2007-08-14 15:53:14 UTC
I make up some solution, but it's not pretty as I can't find real reason of the exception, it's complete mystery to me,
I'm giving up - maybe somebody smarter then me....
Comment 6 David Simonek 2007-08-14 15:54:29 UTC
Created attachment 46584 [details]
diff of hacky solution - model cleaning postponed by invokeLater
Comment 7 David Simonek 2007-08-15 10:42:18 UTC
OK, fixed in main trunk:

Checking in ListView.java;
/cvs/openide/explorer/src/org/openide/explorer/view/ListView.java,v  <--  ListView.java
new revision: 1.14; previous revision: 1.13
done

i wonder what other nice bugs will this fix trigger :-)
Comment 8 mslama 2007-08-16 17:46:09 UTC
I spent half day on this without any result. Just curious why explorer.setRootContext(Node.EMPTY); called from
DocumentsDlg on dialog close does not release references to documents? I want to say there should be another solution
for #109123 than to call model.setNode(Node.EMPTY) for every ListView in removeNotify. (It might be even better as I can
imagine use case that ListView can be reused so it is waste to always reset model....) I tested in JDK 7 b16 and it
happens too. Current test app to reproduce this problem - patched IDE + separate module - is too big for investigation.
Still we could try to file issue against AWT.

I found problem happens only for org.netbeans.modules.xml.schema.multiview.SchemaColumnViewMultiViewElement always when
component array has size 1 it is accessed with index 1. But it is not clear why as loop is not trivial.
Comment 9 Jiri Skrivanek 2007-08-17 11:12:32 UTC
Verified. Thank you.