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.
to reconstruct: (using an example) 1. open a java file in the editor. 2. write the following import line: import java.util.HashMap; 3. click on "HashMap" (put the cursor in the word). 4. press Alt+Shift+I. 5. click on the "Import Class" button. results: the following exception occurs: -------------------------------------------------------------------------------- Wed Mar 28 18:15:22 IST 2001java.lang.ArrayIndexOutOfBoundsException: null java.lang.ArrayIndexOutOfBoundsException at org.netbeans.modules.java.model.ImportCollection.findPositions (ImportCollection.java:170) at org.netbeans.modules.java.model.ObjectCollection.addMembers (ObjectCollection.java:102) at org.netbeans.modules.java.model.ImportCollection.addImports (ImportCollection.java:91) at org.netbeans.modules.java.model.ImportCollection.changeMembers (ImportCollection.java:151) at org.netbeans.modules.java.model.SourceElementImpl.changeImports (SourceElementImpl.java:171) at org.netbeans.modules.java.parser.SourceImplProxy.changeImports (SourceImplProxy.java:132) at org.openide.src.SourceElement.addImport(SourceElement.java:127) at org.netbeans.modules.editor.java.NbJavaFastImport.updateImport (NbJavaFastImport.java:52) at org.netbeans.editor.ext.java.JavaFastImport.actionPerformed (JavaFastImport.java:191) at org.netbeans.core.NbPresenter$ButtonListener.actionPerformed (NbPresenter.java:711) at javax.swing.AbstractButton.fireActionPerformed (AbstractButton.java:1450) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed (AbstractButton.java:1504) at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:378) at javax.swing.DefaultButtonModel.setPressed (DefaultButtonModel.java:250) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased (BasicButtonListener.java:216) at java.awt.Component.processMouseEvent(Component.java:3717) at java.awt.Component.processEvent(Component.java:3546) at java.awt.Container.processEvent(Container.java:1164) at java.awt.Component.dispatchEventImpl(Component.java:2595) at java.awt.Container.dispatchEventImpl(Container.java:1213) at java.awt.Component.dispatchEvent(Component.java:2499) at java.awt.LightweightDispatcher.retargetMouseEvent (Container.java:2451) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125) at java.awt.Container.dispatchEventImpl(Container.java:1200) at java.awt.Window.dispatchEventImpl(Window.java:912) at java.awt.Component.dispatchEvent(Component.java:2499) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:319) at java.awt.EventDispatchThread.pumpOneEvent (EventDispatchThread.java:103) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.Dialog.show(Dialog.java:370) at org.netbeans.core.NbPresenter.superShow(NbPresenter.java:477) at org.netbeans.core.NbPresenter.run(NbPresenter.java:500) at org.openide.util.Mutex.doEventAccess(Mutex.java:855) at org.openide.util.Mutex.readAccess(Mutex.java:145) at org.netbeans.core.NbPresenter.show(NbPresenter.java:481) at java.awt.Component.show(Component.java:946) at java.awt.Component.setVisible(Component.java:903) at org.netbeans.editor.ext.java.JavaFastImport.setDialogVisible (JavaFastImport.java:76) at org.netbeans.modules.editor.java.JavaKit$FastImportAction.actionPerformed (JavaKit.java:543) at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:133) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1702) at javax.swing.JComponent.processKeyBinding(JComponent.java:2156) at javax.swing.JComponent.processKeyBindings(JComponent.java:2182) at javax.swing.JComponent.processKeyEvent(JComponent.java:2119) at javax.swing.JEditorPane.processKeyEvent(JEditorPane.java:1159) at java.awt.Component.processEvent(Component.java:3555) at java.awt.Container.processEvent(Container.java:1164) at java.awt.Component.dispatchEventImpl(Component.java:2595) at java.awt.Container.dispatchEventImpl(Container.java:1213) at java.awt.Component.dispatchEvent(Component.java:2499) at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2155) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2135) at java.awt.Container.dispatchEventImpl(Container.java:1200) at java.awt.Window.dispatchEventImpl(Window.java:912) at java.awt.Component.dispatchEvent(Component.java:2499) at java.awt.EventQueue.dispatchEvent(EventQueue.java:319) at java.awt.EventDispatchThread.pumpOneEvent (EventDispatchThread.java:103) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
*** Issue 10782 has been marked as a duplicate of this issue. ***
seems related to java module. I think that the java module could also ignore adding of the import if there is exactly the same import already present in the import section.
Please, whenever you change the Product, DO "reassign to the owner of selected component". I was not notified about this one at all by Issuezilla. Thanks.
Marking as fixed - I've removed similar bug about a week ago. In fact, this exception was caused by java module filtering out existing imports and passing on empty array.
Target milestone -> 3.2
No Exception is thrown now
Resolved for 3.4.x or earlier, no new info since then -> closing.