diff options
author | Eike Stepper | 2013-06-22 10:16:05 +0000 |
---|---|---|
committer | Eike Stepper | 2013-06-22 10:16:05 +0000 |
commit | b41384a2428ad6cfbd655bb43f1db00f7a9baf35 (patch) | |
tree | 6f3ba40195ef5df613cb9ff872f82aaeef28ca59 | |
parent | c931e969ea8971afefc867bd3a0a223537799fe9 (diff) | |
download | cdo-b41384a2428ad6cfbd655bb43f1db00f7a9baf35.tar.gz cdo-b41384a2428ad6cfbd655bb43f1db00f7a9baf35.tar.xz cdo-b41384a2428ad6cfbd655bb43f1db00f7a9baf35.zip |
[409287] ArrayIndexOutOfBoundsException on rollback bugs/409287
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409287
2 files changed, 83 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_409287b_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_409287b_Test.java new file mode 100644 index 0000000000..1880753d01 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_409287b_Test.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.bugzilla; + +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.tests.AbstractCDOTest; +import org.eclipse.emf.cdo.tests.model1.Category; +import org.eclipse.emf.cdo.tests.model1.Company; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.ecore.EReference; + +/** + * Bug 409287: ArrayIndexOutOfBoundsException on rollback + * + * @author Jack Lechner + */ +public class Bugzilla_409287b_Test extends AbstractCDOTest +{ + public void testIsSetAfterRollback() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/test")); + Company company = getModel1Factory().createCompany(); + resource.getContents().add(company); + transaction.commit(); + + Category category = getModel1Factory().createCategory(); + company.getCategories().add(category); + + transaction.rollback(); + + EReference feature = getModel1Package().getCategory_Categories(); + category.eIsSet(feature); + } + + public void testListenersOnRollback() throws Exception + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/test")); + Company company = getModel1Factory().createCompany(); + resource.getContents().add(company); + transaction.commit(); + + final Category category = getModel1Factory().createCategory(); + company.getCategories().add(category); + + // Add regular EMF adapter + company.eAdapters().add(new AdapterImpl() + { + @Override + public void notifyChanged(Notification notification) + { + try + { + EReference feature = getModel1Package().getCategory_Categories(); + category.eIsSet(feature); + } + catch (ArrayIndexOutOfBoundsException ex) + { + // Found my exception + throw ex; + } + } + }); + + transaction.rollback(); + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java index 21d9f1a5f2..712166d81c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java @@ -1251,6 +1251,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa } InternalCDOObject internal = (InternalCDOObject)object; + // internal.cdoInternalPostDetach(false); internal.cdoInternalSetView(null); internal.cdoInternalSetID(null); internal.cdoInternalSetState(CDOState.TRANSIENT); |