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 70678 - [50cat] IndexOutOfBoundsException thrown while editing XML file
Summary: [50cat] IndexOutOfBoundsException thrown while editing XML file
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P1 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords: RANDOM
: 70609 72352 73152 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-21 10:13 UTC by misterm
Modified: 2006-08-11 10:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2005-12-21 10:13:25 UTC
[ BUILD # : 20051218 ]
[ JDK VERSION : 1.4.2_xx ]

The following exception was throwing while editing a XML file. There are no known steps to reproduce it:

java.lang.IndexOutOfBoundsException: Index: 2, Size: 0
	at java.util.ArrayList.add(ArrayList.java:371)
	at org.netbeans.modules.xml.text.navigator.TreeNodeAdapter.elementAdded(TreeNodeAdapter.java:305)
	at org.netbeans.modules.editor.structure.api.DocumentElement.fireDocumentElementEvent(DocumentElement.java:300)
	at org.netbeans.modules.editor.structure.api.DocumentElement.childAdded(DocumentElement.java:311)
	at org.netbeans.modules.editor.structure.api.DocumentModel$DocumentModelModificationTransaction.addDE(DocumentModel.java:988)
	at org.netbeans.modules.editor.structure.api.DocumentModel$DocumentModelModificationTransaction.commit(DocumentModel.java:915)
	at org.netbeans.modules.editor.structure.api.DocumentModel$DocumentModelModificationTransaction.access$100(DocumentModel.java:782)
	at org.netbeans.modules.editor.structure.api.DocumentModel.updateModel(DocumentModel.java:440)
	at org.netbeans.modules.editor.structure.api.DocumentModel.access$400(DocumentModel.java:97)
	at org.netbeans.modules.editor.structure.api.DocumentModel$2.run(DocumentModel.java:414)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926)
Comment 1 Jesse Glick 2005-12-22 20:25:50 UTC
*** Issue 70609 has been marked as a duplicate of this issue. ***
Comment 2 Marek Fukala 2006-01-02 09:09:49 UTC
Almost impossible to fix without steps to reproduce :-(((
Comment 3 Jesse Glick 2006-01-02 17:30:46 UTC
Well you can at least check the bounds before calling ArrayList.add, and if
something is wrong, skip the operation, print whatever diagnostics you can to
the log file, try to force a refresh of all cached data, etc.
Comment 4 Marek Fukala 2006-01-03 08:24:22 UTC
I ment hard to fix to 5.0. I am already considering something like you mentioned
to 5.1. Thanks
Comment 5 Marek Fukala 2006-03-06 13:21:39 UTC
*** Issue 72352 has been marked as a duplicate of this issue. ***
Comment 6 Marek Fukala 2006-03-06 13:22:03 UTC
increasing priority base on user report.
Comment 7 Marek Fukala 2006-03-09 13:23:42 UTC
I have fixed the outgrowth of the problem - now the boundaries are checked and
if the new element doesn't fit to the actual state of the node then a debug
message is printed and the node is refreshed. Bad thing is that I am not able to
reproduce so I am not 100% sure that the new code will not break something else,
though I hope so. If you will see any inconsistences between the XML navigator
and the xml document or any messages related to this please reopen or fill a new
issue.

Checking in TreeNodeAdapter.java;
/cvs/xml/text-edit/src/org/netbeans/modules/xml/text/navigator/TreeNodeAdapter.java,v
 <--  TreeNodeAdapter.java
new revision: 1.2.2.2.2.1; previous revision: 1.2.2.2
done
Comment 8 Marek Fukala 2006-05-23 09:22:57 UTC
*** Issue 73152 has been marked as a duplicate of this issue. ***
Comment 9 Jindrich Sedek 2006-08-11 10:57:03 UTC
v. no more occurences