Bug 527210 - NegativeArraySizeException from proxy management. No thread safe
Summary: NegativeArraySizeException from proxy management. No thread safe
Status: CLOSED WONTFIX
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-13 11:16 EST by Karthik Mising name CLA
Modified: 2024-05-07 00:51 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karthik Mising name CLA 2017-11-13 11:16:53 EST
I get this error during the sphinx based model update via transaction. Probably proxy management is not a thread safe


java.lang.NegativeArraySizeException
       at java.util.AbstractCollection.toArray(AbstractCollection.java:136)
       at java.util.ArrayList.<init>(ArrayList.java:177)
       at org.eclipse.sphinx.emf.internal.ecore.proxymanagement.blacklist.MapModelIndex.updateIndexOnResourceLoaded(MapModelIndex.java:123)
       at org.eclipse.sphinx.emf.internal.ecore.proxymanagement.blacklist.ModelIndex.updateIndexOnResourceLoaded(ModelIndex.java:88)
       at org.eclipse.sphinx.emf.internal.ecore.proxymanagement.blacklist.ModelIndexUpdater.resourceSetChanged(ModelIndexUpdater.java:106)
       at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781)
       at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
       at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
       at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
       at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
       at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
       at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
       at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
       at org.eclipse.sphinx.emf.util.WorkspaceTransactionUtil.executeInWriteTransaction(WorkspaceTransactionUtil.java:191)
       at org.eclipse.sphinx.emf.util.WorkspaceTransactionUtil.executeInWriteTransaction(WorkspaceTransactionUtil.java:296)
Comment 1 Sebastian Engvall CLA 2018-03-08 07:50:18 EST
We've experienced this as well.

It's because the Set 'proxyURIs' is only initialized and thus has size = -1.
When the ArrayList is created at updateIndexOnResourceLoaded:106 the Set size (-1) is used to set ArrayList size and exception is thrown.

Something like changing the if above to 'resource != null && !resource.getContents().isEmpty() && !proxyURIs.isEmpty()' should fix the problem.
Comment 2 Sebastian Engvall CLA 2018-03-08 07:51:33 EST
(In reply to Sebastian Engvall from comment #1)
> We've experienced this as well.
> 
> It's because the Set 'proxyURIs' is only initialized and thus has size = -1.
> When the ArrayList is created at updateIndexOnResourceLoaded:106 the Set
> size (-1) is used to set ArrayList size and exception is thrown.
> 
> Something like changing the if above to 'resource != null &&
> !resource.getContents().isEmpty() && !proxyURIs.isEmpty()' should fix the
> problem.

Correction, new ArrayList is on Line 123 of course.
Comment 3 Balazs Grill CLA 2024-05-07 00:51:00 EDT
Closed stale issue before migration