Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ArrayIndexOutOfBounds when removing an Adapter from an EObject
ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417606] Mon, 17 March 2008 16:14 Go to next message
Sascha Theves is currently offline Sascha ThevesFriend
Messages: 39
Registered: July 2009
Member
Hi all,

we get very often an ArrayIndexOutOfBounds Exception when we try to remove
an Adapter from an EObjects adapter list. Is the implementation of
EAdapterList not thread-safe? How do we prevent such Exceptions?

Thanks in advance,

Sascha
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417607 is a reply to message #417606] Mon, 17 March 2008 17:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Sascha,

None of EMF's data structures are thread safe in terms of being modified
by multiple threads. You could use the transaction framework or use a
synchronize block perhaps using the list itself as the object on which
you synchronize.


Sascha Theves wrote:
> Hi all,
>
> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
> an Adapter from an EObjects adapter list. Is the implementation of
> EAdapterList not thread-safe? How do we prevent such Exceptions?
>
> Thanks in advance,
>
> Sascha
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417608 is a reply to message #417606] Mon, 17 March 2008 17:11 Go to previous messageGo to next message
Marcelo Paternostro is currently offline Marcelo PaternostroFriend
Messages: 602
Registered: July 2009
Senior Member
Hi Sascha,

It is pretty safe to assume that lists in EMF are NOT thread safe. The
idea is that this should be an application concern given that there
isn't much that can be done in lower-level components (for example,
there is no way for EMF to "thread-safe" a "check if the list contains
an element and then remove it" code).

If the exception is happening due to multi-threading issues, you could
either identify places to add guards (semaphores or plain-old
synchronized blocks) or try approaches like converting the list to an
array and then removing the objects from the list using the
remove(Object) method (instead of remove(int)).

Cheers,
Marcelo

Sascha Theves wrote:
> Hi all,
>
> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
> an Adapter from an EObjects adapter list. Is the implementation of
> EAdapterList not thread-safe? How do we prevent such Exceptions?
>
> Thanks in advance,
>
> Sascha
>
>
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417615 is a reply to message #417606] Tue, 18 March 2008 07:08 Go to previous messageGo to next message
eddi is currently offline eddiFriend
Messages: 3
Registered: July 2009
Junior Member
But there are to much places in our code, where the adapterlist will be
modified : ItemProviderAdapters , Resource while load and unload, our
GEFeditors , PropertySections. Where is a best place to synchronize the
adapterlist?

Thanks in advance,
eddi
"Sascha Theves" <sascha.theves@innovations.de> schrieb im Newsbeitrag
news:frm5dv$2bh$1@build.eclipse.org...
> Hi all,
>
> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
> an Adapter from an EObjects adapter list. Is the implementation of
> EAdapterList not thread-safe? How do we prevent such Exceptions?
>
> Thanks in advance,
>
> Sascha
>
>
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417616 is a reply to message #417615] Tue, 18 March 2008 08:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090502090502000602080209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Sascha,

I imagine that most of these things are happening on the foreground
thread. What exactly is happening on the other threads? The
transaction framework could be used to deal with issues like this...


Eddi wrote:
> But there are to much places in our code, where the adapterlist will be
> modified : ItemProviderAdapters , Resource while load and unload, our
> GEFeditors , PropertySections. Where is a best place to synchronize the
> adapterlist?
>
> Thanks in advance,
> eddi
> "Sascha Theves" <sascha.theves@innovations.de> schrieb im Newsbeitrag
> news:frm5dv$2bh$1@build.eclipse.org...
>
>> Hi all,
>>
>> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
>> an Adapter from an EObjects adapter list. Is the implementation of
>> EAdapterList not thread-safe? How do we prevent such Exceptions?
>>
>> Thanks in advance,
>>
>> Sascha
>>
>>
>>
>
>
>


--------------090502090502000602080209
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sascha,<br>
<br>
I imagine that most of these things are happening on the foreground
thread.&nbsp; What exactly is happening on the other threads?&nbsp;&nbsp; The
transaction framework could be used to deal with issues like this...<br>
<br>
<br>
Eddi wrote:
<blockquote cite="mid:frnpq4$u5l$1@build.eclipse.org" type="cite">
<pre wrap="">But there are to much places in our code, where the adapterlist will be
modified : ItemProviderAdapters , Resource while load and unload, our
GEFeditors , PropertySections. Where is a best place to synchronize the
adapterlist?

Thanks in advance,
eddi
"Sascha Theves" <a class="moz-txt-link-rfc2396E" href="mailto:sascha.theves@innovations.de">&lt;sascha.theves@innovations.de&gt;</a> schrieb im Newsbeitrag
<a class="moz-txt-link-freetext" href="news:frm5dv$2bh$1@build.eclipse.org">news:frm5dv$2bh$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,

we get very often an ArrayIndexOutOfBounds Exception when we try to remove
an Adapter from an EObjects adapter list. Is the implementation of
EAdapterList not thread-safe? How do we prevent such Exceptions?

Thanks in advance,

Sascha


</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------090502090502000602080209--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417621 is a reply to message #417606] Tue, 18 March 2008 15:32 Go to previous messageGo to next message
eddi is currently offline eddiFriend
Messages: 3
Registered: July 2009
Junior Member
What is wrong here?
If I execute a command quickly serveral times then I get the following
StackTrace:

Thread [main] (Suspended (exception
java.lang.ArrayIndexOutOfBoundsException))
org.eclipse.emf.common.util.BasicEList<E>.remove(int) line: 942

org.eclipse.emf.ecore.util.EObjectContainmentEList<E>(org.eclipse.emf.common
..notify.impl.NotifyingListImpl<E>).doRemove(int) line: 762

org.eclipse.emf.ecore.util.EObjectContainmentEList<E>(org.eclipse.emf.common
..notify.impl.NotifyingListImpl<E>).remove(int) line: 713
org.eclipse.emf.edit.command.RemoveCommand.doExecute() line: 326

org.eclipse.emf.edit.command.RemoveCommand(org.eclipse.emf.e dit.command.Abst
ractOverrideableCommand).execute() line: 129

de.visualrules.model.edit.command.delete.ElementDeleteComman d(org.eclipse.em
f.common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.move.StatementDragDropLoca lCommand(org.ecl
ipse.emf.common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
..common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
..common.command.CompoundCommand).execute() line: 267

org.eclipse.emf.workspace.EMFCommandOperation.doExecute(org. eclipse.core.run
time.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) line: 116

org.eclipse.emf.workspace.EMFCommandOperation(org.eclipse.em f.workspace.Abst
ractEMFOperation).execute(org.eclipse.core.runtime.IProgress Monitor,
org.eclipse.core.runtime.IAdaptable) line: 137

org.eclipse.core.commands.operations.DefaultOperationHistory .execute(org.ecl
ipse.core.commands.operations.IUndoableOperation,
org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable) line: 511

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.workspace.EMFCommandOperation, boolean) line: 353

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.common.command.Command, java.util.Map, boolean) line: 472

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.common.command.Command, java.util.Map) line: 401

de.visualrules.core.edit.editingdomain.WorkingCommandStack(o rg.eclipse.emf.t
ransaction.impl.AbstractTransactionalCommandStack).execute(o rg.eclipse.emf.c
ommon.command.Command) line: 217

de.visualrules.ui.gef.internal.editor.VisualRuleTreeCommandS tack.execute(org
..eclipse.gef.commands.Command) line: 95

de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.gef.ui.ac
tions.WorkbenchPartAction).execute(org.eclipse.gef.commands. Command) line:
76
de.visualrules.ui.flowrule.internal.action.PasteAction.run() line: 239

de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.jface.act
ion.Action).runWithEvent(org.eclipse.swt.widgets.Event) line: 498

org.eclipse.ui.actions.RetargetAction.runWithEvent(org.eclip se.swt.widgets.E
vent) line: 229

org.eclipse.jface.commands.ActionHandler.execute(org.eclipse .core.commands.E
xecutionEvent) line: 119

org.eclipse.core.commands.Command.executeWithChecks(org.ecli pse.core.command
s.ExecutionEvent) line: 475

org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(java.lang.O
bject, java.lang.Object) line: 429

org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(org.eclipse.c
ore.commands.ParameterizedCommand, org.eclipse.swt.widgets.Event) line: 165

org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(org.eclipse.jf
ace.bindings.Binding, org.eclipse.swt.widgets.Event) line: 470
org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(java.ut il.List,
org.eclipse.swt.widgets.Event) line: 821

org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(java.util.Lis
t, org.eclipse.swt.widgets.Event) line: 879

org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(org
..eclipse.swt.widgets.Event) line: 568

org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(org. eclipse.ui.inter
nal.keys.WorkbenchKeyboard, org.eclipse.swt.widgets.Event) line: 510

org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(org
..eclipse.swt.widgets.Event) line: 126
org.eclipse.swt.widgets.EventTable.sendEvent(org.eclipse.swt .widgets.Event)
line: 66
org.eclipse.swt.widgets.Display.filterEvent(org.eclipse.swt. widgets.Event)
line: 1141

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(or
g.eclipse.swt.widgets.Event) line: 937

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
t, org.eclipse.swt.widgets.Event, boolean) line: 962

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
t, org.eclipse.swt.widgets.Event) line: 947

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
(int, int, int, int, org.eclipse.swt.widgets.Event) line: 975

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
(int, int, int, int) line: 971
org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).wmChar(int,
int, int) line: 1285

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).WM_CHAR(int
, int) line: 3772

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).windowProc(
int, int, int, int) line: 3672

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Canv as).windowProc(i
nt, int, int, int) line: 291
org.eclipse.swt.widgets.Display.windowProc(int, int, int, int) line: 4351

org.eclipse.swt.internal.win32.OS.DispatchMessageW(org.eclip se.swt.internal.
win32.MSG) line: not available [native method]

org.eclipse.swt.internal.win32.OS.DispatchMessage(org.eclips e.swt.internal.w
in32.MSG) line: 2265
org.eclipse.swt.widgets.Display.readAndDispatch() line: 3291

org.eclipse.ui.internal.Workbench.runEventLoop(org.eclipse.j face.window.Wind
ow$IExceptionHandler, org.eclipse.swt.widgets.Display) line: 2389
org.eclipse.ui.internal.Workbench.runUI() line: 2353

org.eclipse.ui.internal.Workbench.access$4(org.eclipse.ui.in ternal.Workbench
) line: 2219
org.eclipse.ui.internal.Workbench$4.run() line: 466

org.eclipse.core.databinding.observable.Realm.runWithDefault (org.eclipse.cor
e.databinding.observable.Realm, java.lang.Runnable) line: 289

org.eclipse.ui.internal.Workbench.createAndRunWorkbench(org. eclipse.swt.widg
ets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 461

org.eclipse.ui.PlatformUI.createAndRunWorkbench(org.eclipse. swt.widgets.Disp
lay, org.eclipse.ui.application.WorkbenchAdvisor) line: 149

org.eclipse.ui.internal.ide.application.IDEApplication.start (org.eclipse.equ
inox.app.IApplicationContext) line: 106
org.eclipse.equinox.internal.app.EclipseAppHandle.run(java.l ang.Object)
line: 169

org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(
java.lang.Object) line: 106

org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(java.lang
..Object) line: 76
org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.Object) line:
363
org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.String[],
java.lang.Runnable) line: 176
sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
java.lang.Object, java.lang.Object[]) line: not available [native method]
sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
java.lang.Object[]) line: 39
sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
java.lang.Object[]) line: 25
java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
line: 585
org.eclipse.equinox.launcher.Main.invokeFramework(java.lang. String[],
java.net.URL[]) line: 508
org.eclipse.equinox.launcher.Main.basicRun(java.lang.String[ ]) line: 447
org.eclipse.equinox.launcher.Main.run(java.lang.String[]) line: 1173
org.eclipse.equinox.launcher.Main.main(java.lang.String[]) line: 1148





"Sascha Theves" <sascha.theves@innovations.de> schrieb im Newsbeitrag
news:frm5dv$2bh$1@build.eclipse.org...
> Hi all,
>
> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
> an Adapter from an EObjects adapter list. Is the implementation of
> EAdapterList not thread-safe? How do we prevent such Exceptions?
>
> Thanks in advance,
>
> Sascha
>
>
Re: ArrayIndexOutOfBounds when removing an Adapter from an EObject [message #417623 is a reply to message #417621] Tue, 18 March 2008 17:51 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050602010000020700050903
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Eddi,

There seems to be a whole stack of framework overrides leading up to
this. It sounds like you're deleting an object that was in the list
when the command was created but is no longer in the list when the
command is executed.


Eddi wrote:
> What is wrong here?
> If I execute a command quickly serveral times then I get the following
> StackTrace:
>
> Thread [main] (Suspended (exception
> java.lang.ArrayIndexOutOfBoundsException))
> org.eclipse.emf.common.util.BasicEList<E>.remove(int) line: 942
>
> org.eclipse.emf.ecore.util.EObjectContainmentEList<E>(org.eclipse.emf.common
> .notify.impl.NotifyingListImpl<E>).doRemove(int) line: 762
>
> org.eclipse.emf.ecore.util.EObjectContainmentEList<E>(org.eclipse.emf.common
> .notify.impl.NotifyingListImpl<E>).remove(int) line: 713
> org.eclipse.emf.edit.command.RemoveCommand.doExecute() line: 326
>
> org.eclipse.emf.edit.command.RemoveCommand(org.eclipse.emf.e dit.command.Abst
> ractOverrideableCommand).execute() line: 129
>
> de.visualrules.model.edit.command.delete.ElementDeleteComman d(org.eclipse.em
> f.common.command.CompoundCommand).execute() line: 267
>
> de.visualrules.model.edit.command.move.StatementDragDropLoca lCommand(org.ecl
> ipse.emf.common.command.CompoundCommand).execute() line: 267
>
> de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
> .common.command.CompoundCommand).execute() line: 267
>
> de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
> .common.command.CompoundCommand).execute() line: 267
>
> org.eclipse.emf.workspace.EMFCommandOperation.doExecute(org. eclipse.core.run
> time.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) line: 116
>
> org.eclipse.emf.workspace.EMFCommandOperation(org.eclipse.em f.workspace.Abst
> ractEMFOperation).execute(org.eclipse.core.runtime.IProgress Monitor,
> org.eclipse.core.runtime.IAdaptable) line: 137
>
> org.eclipse.core.commands.operations.DefaultOperationHistory .execute(org.ecl
> ipse.core.commands.operations.IUndoableOperation,
> org.eclipse.core.runtime.IProgressMonitor,
> org.eclipse.core.runtime.IAdaptable) line: 511
>
> de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
> se.emf.workspace.EMFCommandOperation, boolean) line: 353
>
> de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
> se.emf.common.command.Command, java.util.Map, boolean) line: 472
>
> de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
> se.emf.common.command.Command, java.util.Map) line: 401
>
> de.visualrules.core.edit.editingdomain.WorkingCommandStack(o rg.eclipse.emf.t
> ransaction.impl.AbstractTransactionalCommandStack).execute(o rg.eclipse.emf.c
> ommon.command.Command) line: 217
>
> de.visualrules.ui.gef.internal.editor.VisualRuleTreeCommandS tack.execute(org
> .eclipse.gef.commands.Command) line: 95
>
> de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.gef.ui.ac
> tions.WorkbenchPartAction).execute(org.eclipse.gef.commands. Command) line:
> 76
> de.visualrules.ui.flowrule.internal.action.PasteAction.run() line: 239
>
> de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.jface.act
> ion.Action).runWithEvent(org.eclipse.swt.widgets.Event) line: 498
>
> org.eclipse.ui.actions.RetargetAction.runWithEvent(org.eclip se.swt.widgets.E
> vent) line: 229
>
> org.eclipse.jface.commands.ActionHandler.execute(org.eclipse .core.commands.E
> xecutionEvent) line: 119
>
> org.eclipse.core.commands.Command.executeWithChecks(org.ecli pse.core.command
> s.ExecutionEvent) line: 475
>
> org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(java.lang.O
> bject, java.lang.Object) line: 429
>
> org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(org.eclipse.c
> ore.commands.ParameterizedCommand, org.eclipse.swt.widgets.Event) line: 165
>
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(org.eclipse.jf
> ace.bindings.Binding, org.eclipse.swt.widgets.Event) line: 470
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(java.ut il.List,
> org.eclipse.swt.widgets.Event) line: 821
>
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(java.util.Lis
> t, org.eclipse.swt.widgets.Event) line: 879
>
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(org
> .eclipse.swt.widgets.Event) line: 568
>
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(org. eclipse.ui.inter
> nal.keys.WorkbenchKeyboard, org.eclipse.swt.widgets.Event) line: 510
>
> org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(org
> .eclipse.swt.widgets.Event) line: 126
> org.eclipse.swt.widgets.EventTable.sendEvent(org.eclipse.swt .widgets.Event)
> line: 66
> org.eclipse.swt.widgets.Display.filterEvent(org.eclipse.swt. widgets.Event)
> line: 1141
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(or
> g.eclipse.swt.widgets.Event) line: 937
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
> t, org.eclipse.swt.widgets.Event, boolean) line: 962
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
> t, org.eclipse.swt.widgets.Event) line: 947
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
> (int, int, int, int, org.eclipse.swt.widgets.Event) line: 975
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
> (int, int, int, int) line: 971
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).wmChar(int,
> int, int) line: 1285
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).WM_CHAR(int
> , int) line: 3772
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).windowProc(
> int, int, int, int) line: 3672
>
> org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Canv as).windowProc(i
> nt, int, int, int) line: 291
> org.eclipse.swt.widgets.Display.windowProc(int, int, int, int) line: 4351
>
> org.eclipse.swt.internal.win32.OS.DispatchMessageW(org.eclip se.swt.internal.
> win32.MSG) line: not available [native method]
>
> org.eclipse.swt.internal.win32.OS.DispatchMessage(org.eclips e.swt.internal.w
> in32.MSG) line: 2265
> org.eclipse.swt.widgets.Display.readAndDispatch() line: 3291
>
> org.eclipse.ui.internal.Workbench.runEventLoop(org.eclipse.j face.window.Wind
> ow$IExceptionHandler, org.eclipse.swt.widgets.Display) line: 2389
> org.eclipse.ui.internal.Workbench.runUI() line: 2353
>
> org.eclipse.ui.internal.Workbench.access$4(org.eclipse.ui.in ternal.Workbench
> ) line: 2219
> org.eclipse.ui.internal.Workbench$4.run() line: 466
>
> org.eclipse.core.databinding.observable.Realm.runWithDefault (org.eclipse.cor
> e.databinding.observable.Realm, java.lang.Runnable) line: 289
>
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(org. eclipse.swt.widg
> ets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 461
>
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(org.eclipse. swt.widgets.Disp
> lay, org.eclipse.ui.application.WorkbenchAdvisor) line: 149
>
> org.eclipse.ui.internal.ide.application.IDEApplication.start (org.eclipse.equ
> inox.app.IApplicationContext) line: 106
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(java.l ang.Object)
> line: 169
>
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(
> java.lang.Object) line: 106
>
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(java.lang
> .Object) line: 76
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.Object) line:
> 363
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.String[],
> java.lang.Runnable) line: 176
> sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
> java.lang.Object, java.lang.Object[]) line: not available [native method]
> sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
> java.lang.Object[]) line: 39
> sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
> java.lang.Object[]) line: 25
> java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
> line: 585
> org.eclipse.equinox.launcher.Main.invokeFramework(java.lang. String[],
> java.net.URL[]) line: 508
> org.eclipse.equinox.launcher.Main.basicRun(java.lang.String[ ]) line: 447
> org.eclipse.equinox.launcher.Main.run(java.lang.String[]) line: 1173
> org.eclipse.equinox.launcher.Main.main(java.lang.String[]) line: 1148
>
>
>
>
>
> "Sascha Theves" <sascha.theves@innovations.de> schrieb im Newsbeitrag
> news:frm5dv$2bh$1@build.eclipse.org...
>
>> Hi all,
>>
>> we get very often an ArrayIndexOutOfBounds Exception when we try to remove
>> an Adapter from an EObjects adapter list. Is the implementation of
>> EAdapterList not thread-safe? How do we prevent such Exceptions?
>>
>> Thanks in advance,
>>
>> Sascha
>>
>>
>>
>
>
>


--------------050602010000020700050903
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Eddi,<br>
<br>
There seems to be a whole stack of framework overrides leading up to
this.&nbsp; It sounds like you're deleting an object that was in the list
when the command was created but is no longer in the list when the
command is executed.<br>
<br>
<br>
Eddi wrote:
<blockquote cite="mid:fronbc$4no$1@build.eclipse.org" type="cite">
<pre wrap="">What is wrong here?
If I execute a command quickly serveral times then I get the following
StackTrace:

Thread [main] (Suspended (exception
java.lang.ArrayIndexOutOfBoundsException))
org.eclipse.emf.common.util.BasicEList&lt;E&gt;.remo ve(int) line: 942

org.eclipse.emf.ecore.util.EObjectContainmentEList&lt;E& amp;gt;(org.eclipse.emf.common
..notify.impl.NotifyingListImpl&lt;E&gt;).doRemove(i nt) line: 762

org.eclipse.emf.ecore.util.EObjectContainmentEList&lt;E& amp;gt;(org.eclipse.emf.common
..notify.impl.NotifyingListImpl&lt;E&gt;).remove(int ) line: 713
org.eclipse.emf.edit.command.RemoveCommand.doExecute() line: 326

org.eclipse.emf.edit.command.RemoveCommand(org.eclipse.emf.e dit.command.Abst
ractOverrideableCommand).execute() line: 129

de.visualrules.model.edit.command.delete.ElementDeleteComman d(org.eclipse.em
f.common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.move.StatementDragDropLoca lCommand(org.ecl
ipse.emf.common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
..common.command.CompoundCommand).execute() line: 267

de.visualrules.model.edit.command.VisualRulesCompoundCommand (org.eclipse.emf
..common.command.CompoundCommand).execute() line: 267

org.eclipse.emf.workspace.EMFCommandOperation.doExecute(org. eclipse.core.run
time.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) line: 116

org.eclipse.emf.workspace.EMFCommandOperation(org.eclipse.em f.workspace.Abst
ractEMFOperation).execute(org.eclipse.core.runtime.IProgress Monitor,
org.eclipse.core.runtime.IAdaptable) line: 137

org.eclipse.core.commands.operations.DefaultOperationHistory .execute(org.ecl
ipse.core.commands.operations.IUndoableOperation,
org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable) line: 511

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.workspace.EMFCommandOperation, boolean) line: 353

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.common.command.Command, java.util.Map, boolean) line: 472

de.visualrules.core.edit.editingdomain.WorkingCommandStack.e xecute(org.eclip
se.emf.common.command.Command, java.util.Map) line: 401

de.visualrules.core.edit.editingdomain.WorkingCommandStack(o rg.eclipse.emf.t
ransaction.impl.AbstractTransactionalCommandStack).execute(o rg.eclipse.emf.c
ommon.command.Command) line: 217

de.visualrules.ui.gef.internal.editor.VisualRuleTreeCommandS tack.execute(org
..eclipse.gef.commands.Command) line: 95

de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.gef.ui.ac
tions.WorkbenchPartAction).execute(org.eclipse.gef.commands. Command) line:
76
de.visualrules.ui.flowrule.internal.action.PasteAction.run() line: 239

de.visualrules.ui.flowrule.internal.action.PasteAction(org.e clipse.jface.act
ion.Action).runWithEvent(org.eclipse.swt.widgets.Event) line: 498

org.eclipse.ui.actions.RetargetAction.runWithEvent(org.eclip se.swt.widgets.E
vent) line: 229

org.eclipse.jface.commands.ActionHandler.execute(org.eclipse .core.commands.E
xecutionEvent) line: 119

org.eclipse.core.commands.Command.executeWithChecks(org.ecli pse.core.command
s.ExecutionEvent) line: 475

org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(java.lang.O
bject, java.lang.Object) line: 429

org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(org.eclipse.c
ore.commands.ParameterizedCommand, org.eclipse.swt.widgets.Event) line: 165

org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(org.eclipse.jf
ace.bindings.Binding, org.eclipse.swt.widgets.Event) line: 470
org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(java.ut il.List,
org.eclipse.swt.widgets.Event) line: 821

org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(java.util.Lis
t, org.eclipse.swt.widgets.Event) line: 879

org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(org
..eclipse.swt.widgets.Event) line: 568

org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(org. eclipse.ui.inter
nal.keys.WorkbenchKeyboard, org.eclipse.swt.widgets.Event) line: 510

org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(org
..eclipse.swt.widgets.Event) line: 126
org.eclipse.swt.widgets.EventTable.sendEvent(org.eclipse.swt .widgets.Event)
line: 66
org.eclipse.swt.widgets.Display.filterEvent(org.eclipse.swt. widgets.Event)
line: 1141

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(or
g.eclipse.swt.widgets.Event) line: 937

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
t, org.eclipse.swt.widgets.Event, boolean) line: 962

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendEvent(in
t, org.eclipse.swt.widgets.Event) line: 947

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
(int, int, int, int, org.eclipse.swt.widgets.Event) line: 975

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).sendKeyEvent
(int, int, int, int) line: 971
org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Widg et).wmChar(int,
int, int) line: 1285

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).WM_CHAR(int
, int) line: 3772

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Cont rol).windowProc(
int, int, int, int) line: 3672

org.eclipse.draw2d.FigureCanvas(org.eclipse.swt.widgets.Canv as).windowProc(i
nt, int, int, int) line: 291
org.eclipse.swt.widgets.Display.windowProc(int, int, int, int) line: 4351

org.eclipse.swt.internal.win32.OS.DispatchMessageW(org.eclip se.swt.internal.
win32.MSG) line: not available [native method]

org.eclipse.swt.internal.win32.OS.DispatchMessage(org.eclips e.swt.internal.w
in32.MSG) line: 2265
org.eclipse.swt.widgets.Display.readAndDispatch() line: 3291

org.eclipse.ui.internal.Workbench.runEventLoop(org.eclipse.j face.window.Wind
ow$IExceptionHandler, org.eclipse.swt.widgets.Display) line: 2389
org.eclipse.ui.internal.Workbench.runUI() line: 2353

org.eclipse.ui.internal.Workbench.access$4(org.eclipse.ui.in ternal.Workbench
) line: 2219
org.eclipse.ui.internal.Workbench$4.run() line: 466

org.eclipse.core.databinding.observable.Realm.runWithDefault (org.eclipse.cor
e.databinding.observable.Realm, java.lang.Runnable) line: 289

org.eclipse.ui.internal.Workbench.createAndRunWorkbench(org. eclipse.swt.widg
ets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 461

org.eclipse.ui.PlatformUI.createAndRunWorkbench(org.eclipse. swt.widgets.Disp
lay, org.eclipse.ui.application.WorkbenchAdvisor) line: 149

org.eclipse.ui.internal.ide.application.IDEApplication.start (org.eclipse.equ
inox.app.IApplicationContext) line: 106
org.eclipse.equinox.internal.app.EclipseAppHandle.run(java.l ang.Object)
line: 169

org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(
java.lang.Object) line: 106

org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(java.lang
..Object) line: 76
org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.Object) line:
363
org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lan g.String[],
java.lang.Runnable) line: 176
sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.refle ct.Method,
java.lang.Object, java.lang.Object[]) line: not available [native method]
sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object ,
java.lang.Object[]) line: 39
sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Ob ject,
java.lang.Object[]) line: 25
java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...)
line: 585
org.eclipse.equinox.launcher.Main.invokeFramework(java.lang. String[],
java.net.URL[]) line: 508
org.eclipse.equinox.launcher.Main.basicRun(java.lang.String[ ]) line: 447
org.eclipse.equinox.launcher.Main.run(java.lang.String[]) line: 1173
org.eclipse.equinox.launcher.Main.main(java.lang.String[]) line: 1148





"Sascha Theves" <a class="moz-txt-link-rfc2396E" href="mailto:sascha.theves@innovations.de">&lt;sascha.theves@innovations.de&gt;</a> schrieb im Newsbeitrag
<a class="moz-txt-link-freetext" href="news:frm5dv$2bh$1@build.eclipse.org">news:frm5dv$2bh$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,

we get very often an ArrayIndexOutOfBounds Exception when we try to remove
an Adapter from an EObjects adapter list. Is the implementation of
EAdapterList not thread-safe? How do we prevent such Exceptions?

Thanks in advance,

Sascha


</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------050602010000020700050903--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to programmatically resolve a proxy?
Next Topic:Incorrect output under "load" (multiple concurrent calling threads) Is this code thread-
Goto Forum:
  


Current Time: Thu Apr 25 23:42:30 GMT 2024

Powered by FUDForum. Page generated in 0.03387 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top