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 42164

Summary: ArrayIndexOutOfBoundsException in System.arraycopy
Product: utilities Reporter: _ proxity <proxity>
Component: PropertiesAssignee: Jan Stola <jstola>
Status: VERIFIED FIXED    
Severity: blocker Keywords: THREAD
Priority: P2    
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Screenshot of situation during display of exception
See ide.log for version information

Description _ proxity 2004-04-20 12:55:23 UTC
I added

Key:   "Koord.: #"
Value: "Coord.: #"

to my resource bundle using the properties editor
and received:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at
java.util.ArrayList.ensureCapacity(ArrayList.java:170)
	at java.util.ArrayList.add(ArrayList.java:354)
	at
org.netbeans.modules.properties.BundleStructure.buildKeySet(BundleStructure.java:404)
	at
org.netbeans.modules.properties.BundleStructure.notifyOneFileChanged(BundleStructure.java:469)
	at
org.netbeans.modules.properties.PropertiesStructure.structureChanged(PropertiesStructure.java:266)
	at
org.netbeans.modules.properties.PropertiesStructure.addItem(PropertiesStructure.java:243)
	at
org.netbeans.modules.properties.BundleEditPanel$8.actionPerformed(BundleEditPanel.java:429)
	at
org.netbeans.core.windows.services.NbPresenter$ButtonListener.actionPerformed(NbPresenter.java:975)
	at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
	at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
	at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
	at
java.awt.Component.processMouseEvent(Component.java:5100)
	at
java.awt.Component.processEvent(Component.java:4897)
	at
java.awt.Container.processEvent(Container.java:1569)
	at
java.awt.Component.dispatchEventImpl(Component.java:3615)
	at
java.awt.Container.dispatchEventImpl(Container.java:1627)
	at
java.awt.Component.dispatchEvent(Component.java:3477)
	at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
	at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
	at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
	at
java.awt.Container.dispatchEventImpl(Container.java:1613)
	at
java.awt.Window.dispatchEventImpl(Window.java:1606)
	at
java.awt.Component.dispatchEvent(Component.java:3477)
	at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
	at java.awt.Dialog$1.run(Dialog.java:540)
	at java.awt.Dialog.show(Dialog.java:561)
	at
org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:722)
	at
org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:765)
	at
org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:753)
	at
org.openide.util.Mutex.doEventAccess(Mutex.java:924)
	at org.openide.util.Mutex.readAccess(Mutex.java:158)
	at
org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:738)
	at
org.netbeans.modules.properties.BundleEditPanel.addButtonActionPerformed(BundleEditPanel.java:496)
	at
org.netbeans.modules.properties.BundleEditPanel.access$600(BundleEditPanel.java:49)
	at
org.netbeans.modules.properties.BundleEditPanel$5.actionPerformed(BundleEditPanel.java:290)
	at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
	at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
	at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
	at
java.awt.Component.processMouseEvent(Component.java:5100)
	at
java.awt.Component.processEvent(Component.java:4897)
	at
java.awt.Container.processEvent(Container.java:1569)
	at
java.awt.Component.dispatchEventImpl(Component.java:3615)
	at
java.awt.Container.dispatchEventImpl(Container.java:1627)
	at
java.awt.Component.dispatchEvent(Component.java:3477)
	at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
	at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
	at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
	at
java.awt.Container.dispatchEventImpl(Container.java:1613)
	at
java.awt.Window.dispatchEventImpl(Window.java:1606)
	at
java.awt.Component.dispatchEvent(Component.java:3477)
[catch] at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
	at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
	at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
	at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Comment 1 _ proxity 2004-04-20 12:58:47 UTC
Created attachment 14475 [details]
Screenshot of situation during display of exception
Comment 2 _ proxity 2004-04-20 13:01:08 UTC
I suspect a problem with the escaping of the # comment sign which is
in the value.
Comment 3 _ proxity 2004-04-20 13:07:31 UTC
It seems that problem can be always triggered by simply adding " #"
(space + #) to the end of a key!
Comment 4 Marian Petras 2004-04-20 13:39:03 UTC
I am not able to reproduce the exception.

Boris, could you please describe the exact steps on how to make the
exception to be thrown? Thank you.
Comment 5 Marian Petras 2004-04-20 13:39:31 UTC
This bug may be related to bug #41885 ("Table-view editor cannot save
keys containing space").
Comment 6 _ proxity 2004-04-20 14:58:42 UTC
E.g. open a properties file, create a new property with key "a #" and
value "b". This causes mysterious things with the entered data. With
or without exception.
Comment 7 Marian Petras 2004-04-20 15:29:56 UTC
OK, I did it. I opened an already existing .properties file by
double-clicking on its node in the NetBeans explorer window. The table
editor was opened. Then I clicked on the New Property... and entered
key "a #" and value "b" into the dialog. I pressed the OK button in
the dialog. In the table, a new entry was added, having key "a" and
value "#=b" which is wrong but it is caused by the known bug #41885.

However, I cannot see the exception.

If you are able to reproduce the bug with a simple .properties file,
please attach it to this bug report.
Comment 8 Marian Petras 2004-04-20 15:31:03 UTC
Are you using the final version of NetBeans 3.6? Which JDK are you using?
Comment 9 _ proxity 2004-04-20 15:41:10 UTC
Created attachment 14483 [details]
See ide.log for version information
Comment 10 Marian Petras 2004-04-20 16:00:18 UTC
Thank you.

You have the same version of both NetBeans and JDK as me. The only
difference is that you have a different version of Linux kernel and
(probably) a different hardware.

It seems the problem is with synchronization of threads. It may have
same or similar cause as bug #34436 ("ConcurrentModificationException
on resource file editing").

I have not been able to reproduce any of the bugs but their existence
is apparent from the exception call stacks.
Comment 11 Marian Petras 2004-04-20 17:41:18 UTC
The reporter uses a multiprocessor machine - it is the probable reason
why I could not reproduce it (on a single-processor machine).
Comment 12 _ proxity 2004-05-12 15:10:04 UTC
Exception happened again. I inserted only a missing 'n' in a value of
a resource bundle.
Comment 13 _ proxity 2004-05-12 15:14:25 UTC
No sorry, it was the key field. I tried it again and bug #34436 happened.
Please fix that stuff. To me the Resource Editor is totally unusable
in 3.6

Comment 14 Jan Stola 2004-06-08 15:34:06 UTC
Lowering the priority - the exception seems to be extremely
rare on a single-processor machine.
Comment 15 _ proxity 2004-07-20 11:59:04 UTC
On a SMP machine this happens very often. The properties editor is
unusable for me now. Please check for missing synchronization.
Comment 16 Jan Stola 2004-07-20 12:46:36 UTC
This issue is not reproducible on single-processor machine =>
lowering priority to P3. Please, don't change priorities
inappropriately. We understand that it is an important problem
for you, but the priority must be objective and should not
track someones' feelings.
Comment 17 _ proxity 2004-07-20 13:49:16 UTC
If you program in multiple threads you have to bear the consequences.
Do you need a SMP machine to test your software?
Comment 18 Marian Petras 2004-07-20 15:48:04 UTC
I agree with the reporter that this bug should have a higher priority
if it prevents using the basic module's functionality. Multiprocessor
machines are not extraordinary and the module should work on such
machines.
Comment 19 Jan Stola 2004-07-21 10:19:17 UTC
This issue seems to be similar to the issue 34436. The root of the
exception seems to be again a missing synchronization of the method
BundleStructure.buildKeySet() and the fact that the field
BundleStructure.keyList is modified directly (it is better
to replace it when a new list is completed).
I implemented both mentioned changes, so the problem should be fixed.
Unfortunately I was not able to reproduce this problem even before
this fix (its probability is much lower then the probability
of the issue 34436). On the other hand the "steps to reproduce"
and the attached snapshot support the mentioned scenario.

If you want to verify/ensure that this bug is fixed, you
can download the latest development build of Netbeans 4.0
from http://www.netbeans.info/downloads/download.php?a=n&p=1
Note that the first build that contains this fix is
21 July, 18:00 200407211800 4.0 daily build.
Feel free to reopen this issue if you are still able to reproduce it.
Comment 20 Max Sauer 2005-07-19 11:11:23 UTC
Verified on a 2cpu Optetron mashine, in nb200507181000.