Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 306998 - [DB] NullPointerException when invalid default value literal of EENum type
Summary: [DB] NullPointerException when invalid default value literal of EENum type
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.db (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Winkler CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-24 17:03 EDT by Kai Schlamp CLA
Modified: 2010-06-29 04:35 EDT (History)
2 users (show)

See Also:
stepper: review+


Attachments
testcase v1 (12.28 KB, patch)
2010-03-28 14:11 EDT, Stefan Winkler CLA
no flags Details | Diff
Patch-v2 (7.67 KB, patch)
2010-05-08 11:36 EDT, Stefan Winkler CLA
no flags Details | Diff
Patch-v3 (including testcase) (7.75 KB, patch)
2010-05-09 08:12 EDT, Stefan Winkler CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Schlamp CLA 2010-03-24 17:03:38 EDT
Build Identifier: I20100312-1448

When you try to commit a model object that contains a field that is of EENum type and uses an invalid "Default Value Literal" then the below exception is thrown. Former CDO builds did handle that differently and did not throw that exception.
Maybe we should improve the error message of that exception or simply ignore the invalid "Default Value Literal" then.

[ERROR] NullPointerException
java.lang.NullPointerException
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping$TMEnum.getDefaultValue(TypeMapping.java:294)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValue(TypeMapping.java:117)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValueFromRevision(TypeMapping.java:96)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:268)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:445)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:382)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:363)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:298)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:270)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:161)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:115)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

!ENTRY org.eclipse.emf.cdo.server 4 0 2010-03-24 21:52:01.025
!MESSAGE NullPointerException
!STACK 0
java.lang.NullPointerException
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping$TMEnum.getDefaultValue(TypeMapping.java:294)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValue(TypeMapping.java:117)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValueFromRevision(TypeMapping.java:96)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:268)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:445)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:382)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:363)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:298)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:270)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:161)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:115)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

!ENTRY org.eclipse.emf.cdo.net4j 4 0 2010-03-24 21:52:01.051
!MESSAGE Rollback in DBStore: java.lang.NullPointerException
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping$TMEnum.getDefaultValue(TypeMapping.java:294)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValue(TypeMapping.java:117)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValueFromRevision(TypeMapping.java:96)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:268)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:445)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:382)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:363)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:298)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:270)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:161)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:115)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

[ERROR] Rollback in DBStore: java.lang.NullPointerException
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping$TMEnum.getDefaultValue(TypeMapping.java:294)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValue(TypeMapping.java:117)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValueFromRevision(TypeMapping.java:96)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:268)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:445)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:382)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:363)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:298)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:270)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:161)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:115)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)


!ENTRY org.eclipse.ui 4 0 2010-03-24 21:52:01.156
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.net4j.util.transaction.TransactionException: Rollback in DBStore: java.lang.NullPointerException
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping$TMEnum.getDefaultValue(TypeMapping.java:294)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValue(TypeMapping.java:117)
	at org.eclipse.emf.cdo.server.internal.db.mapping.TypeMapping.setValueFromRevision(TypeMapping.java:96)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:268)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:445)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:382)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:363)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:298)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:270)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:161)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:115)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:311)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:238)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

	at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:78)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:885)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:904)
	at org.testing.cdodb.ServerManager.createSession(ServerManager.java:153)
	at org.testing.cdodb.ApplicationWorkbenchWindowAdvisor.postWindowOpen(ApplicationWorkbenchWindowAdvisor.java:30)
	at org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpened(WorkbenchWindow.java:1332)
	at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:798)
	at org.eclipse.ui.internal.Workbench$22.runWithException(Workbench.java:1063)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3507)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3154)
	at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
	at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1388)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4272)
	at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1383)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2343)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2229)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:504)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:497)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.testing.cdodb.Application.start(Application.java:20)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1406)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1382)
[ERROR] Not active: SignalProtocol[cdo]
java.lang.IllegalStateException: Not active: SignalProtocol[cdo]
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.checkActive(LifecycleUtil.java:71)
	at org.eclipse.net4j.signal.Signal.getProtocol(Signal.java:88)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequest.getProtocol(CDOClientRequest.java:49)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequest.getProtocol(CDOClientRequest.java:1)
	at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:73)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:350)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.closeView(CDOClientProtocol.java:180)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doDeactivate(CDOViewImpl.java:1780)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.doDeactivate(CDOTransactionImpl.java:1767)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.close(CDOViewImpl.java:1675)
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doDeactivate(CDOSessionImpl.java:940)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl$1.onDeactivated(CDOSessionImpl.java:136)
	at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyLifecycleEvent(LifecycleEventAdapter.java:52)
	at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyEvent(LifecycleEventAdapter.java:30)
	at org.eclipse.net4j.util.event.Notifier.fireEventSafe(Notifier.java:133)
	at org.eclipse.net4j.util.event.Notifier.fireEvent(Notifier.java:97)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:127)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.spi.net4j.Protocol.handleChannelDeactivation(Protocol.java:159)
	at org.eclipse.net4j.signal.SignalProtocol.handleChannelDeactivation(SignalProtocol.java:310)
	at org.eclipse.spi.net4j.Protocol$1.onDeactivated(Protocol.java:48)
	at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyLifecycleEvent(LifecycleEventAdapter.java:52)
	at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyEvent(LifecycleEventAdapter.java:30)
	at org.eclipse.net4j.util.event.Notifier.fireEventSafe(Notifier.java:133)
	at org.eclipse.net4j.util.event.Notifier.fireEvent(Notifier.java:97)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:127)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.spi.net4j.ChannelMultiplexer.inverseCloseChannel(ChannelMultiplexer.java:198)
	at org.eclipse.net4j.internal.jvm.JVMConnector.deregisterChannelFromPeer(JVMConnector.java:124)
	at org.eclipse.spi.net4j.ChannelMultiplexer.closeChannel(ChannelMultiplexer.java:191)
	at org.eclipse.spi.net4j.Channel.unregisterFromMultiplexer(Channel.java:312)
	at org.eclipse.spi.net4j.Channel.doDeactivate(Channel.java:294)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.spi.net4j.Channel.close(Channel.java:317)
	at org.eclipse.net4j.signal.SignalProtocol.doDeactivate(SignalProtocol.java:290)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.emf.cdo.internal.server.Session.doDeactivate(Session.java:489)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.emf.cdo.internal.server.SessionManager.doDeactivate(SessionManager.java:437)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.emf.cdo.internal.server.Repository.doDeactivate(Repository.java:1145)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivateNoisy(LifecycleUtil.java:213)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivateNoisy(LifecycleUtil.java:208)
	at org.eclipse.net4j.util.container.ManagedContainer.doDeactivate(ManagedContainer.java:532)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:122)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.net4j.internal.util.container.PluginContainer.dispose(PluginContainer.java:53)
	at org.eclipse.net4j.internal.util.bundle.OM$Activator.stop(OM.java:94)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:843)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:836)
	at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:501)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:545)
	at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1098)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:590)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:259)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215)
	at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:266)
	at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:685)
	at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:583)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:415)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1406)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1382)

Reproducible: Always
Comment 1 Stefan Winkler CLA 2010-03-25 02:32:18 EDT
There's two possibilities here: 

a. Check for valid default value and a better exception in the DBStore
b. Do this check in EMF/CDO earlier

Just to be sure: If the default value literal for an EEnum is invalid, then the model is invalid, no? So the question is, why have you been able to instantiate and register an invalid model in the first place? Or am I mistaken here?
Comment 2 Kai Schlamp CLA 2010-03-25 16:20:39 EDT
(In reply to comment #1)
> There's two possibilities here: 
> 
> a. Check for valid default value and a better exception in the DBStore
> b. Do this check in EMF/CDO earlier

 
> 
> Just to be sure: If the default value literal for an EEnum is invalid, then the
> model is invalid, no? So the question is, why have you been able to instantiate
> and register an invalid model in the first place? Or am I mistaken here?

Yes, one can type in any default value literal without making the EMF model invalid. This is also true for other types than EEnum. For example one can provide a non digit string for an EInteger type field (didn't test how CDO behaves then). The "Default Value Literal" is just a normal text field in the Ecore editor. And it isn't checked for validity when creating the model.
I am not sure what the better solution would be. I guess the EMF guys have their reasons why it isn't checked for validity (but I am not an EMF expert).
Comment 3 Stefan Winkler CLA 2010-03-26 10:03:40 EDT
Ed, 

could you comment on this? Is it indeed desirable that a model can be instantiated wich contains invalid default literals? Why is there no check in EMF that would prevent this?
Comment 4 Ed Merks CLA 2010-03-26 10:32:44 EDT
In general, data types can specialize the implementation of createAbcFromString and convertAbcToString so in order to do the conversion as implemented in the generated model, we really need to do it using that generated factory implementation which isn't available at model development time.  It's a long way to say: we don't generally know the literal-to-value mapping at development time.
Comment 5 Kai Schlamp CLA 2010-03-27 05:25:34 EDT
In my opinion the best solution then would be a validation test in the the DBStore. Then log a warning if the default literal value is invalid and treat it as it was never set. This is how EMF seems to treat those created model objects.
Comment 6 Kai Schlamp CLA 2010-03-27 12:07:42 EDT
There is an even a bigger problem here. When using the Ecore model editor to delete the default value literal again by deleting all characters in the "Default Value Literal" field, a defaultValueLiteral="" is left in the ecore xml code of the model. And that also leads to the NullPointerException (at least in EENum type fields).
Comment 7 Ed Merks CLA 2010-03-27 16:00:42 EDT
A text cell has a hard time distinguishing null verses "" so you need to use the little restore toolbar button to make it null again.
Comment 8 Kai Schlamp CLA 2010-03-28 09:10:31 EDT
(In reply to comment #7)
> A text cell has a hard time distinguishing null verses "" so you need to use
> the little restore toolbar button to make it null again.

Thanks for the hint. But we still need a better error handling for that in CDO resp. DBStore. I still recommend to simply provide a warning when an invalid default value literal by the DBStore is found and then simply ignore it (treat it as never set).
Comment 9 Stefan Winkler CLA 2010-03-28 14:10:49 EDT
Kai, 

I've tried to implement a test case first in order to reproduce the issue. However, I cannot.
Can you have a look at the attached testcase and enhance it with a test that reproduces the problem?
Comment 10 Stefan Winkler CLA 2010-03-28 14:11:33 EDT
Created attachment 163189 [details]
testcase v1
Comment 11 Stefan Winkler CLA 2010-05-08 11:36:51 EDT
Created attachment 167604 [details]
Patch-v2

Testcase and fix. 
If an invalid literal is encountered, the EEnum default value is used instead and a warning is reported to OM.LOG.
Comment 12 Eike Stepper CLA 2010-05-09 03:29:04 EDT
Questions:

1) What is an "invalid" literal? Why can it be invalid?
2) Why does Bugzilla_306998_Test not fail without the patch? It doesn't seem to prove anything...
Comment 13 Kai Schlamp CLA 2010-05-09 03:53:27 EDT
Sorry for the late reply. I will look into it when I have some time. I am very busy at the moment. And as it doesn't fail when providing a correct default value for an Enum attribute, it doesn't have top priority for me at the moment. But it's still on my radar.

(In reply to comment #12)
> Questions:
> 
> 1) What is an "invalid" literal? Why can it be invalid?
> 2) Why does Bugzilla_306998_Test not fail without the patch? It doesn't seem to
> prove anything...
Comment 14 Stefan Winkler CLA 2010-05-09 08:12:31 EDT
Created attachment 167626 [details]
Patch-v3 (including testcase)

resync'd with HEAD
Comment 15 Stefan Winkler CLA 2010-05-09 08:21:39 EDT
Sorry, Eike. Something went wrong yesterday. Apparently, setting attachment #1 [details] obsolete did not work.

I guess you tried the tests in the first attachments which were erroneous because these tests were for base types, not for enums. Patch-v2 also contained a testcase (for enums this time) and this testcase (testInvalidEENumLiteral) fails without the patch and shows the error.

For a description of the problem, please see the discussion involving Ed above. In the CDO test model, there is an EEnum "VAT" with values for "VAT0", "VAT7", "VAT15", etc.

Now if someone adds a feature to an EClass with type set to VAT, he could enter also a default value literal for this feature, which could be "VAT8". The model validation does not complain about that (Ed stated that at validation time, valid literals cannot be told from invalid ones). This is why when the DBStore tries to convert the default literal to the default value, it fails.

The patch in attachment#3 [details] (which is the same as in #2, only synced to HEAD) catches the error, falls back to the EENum default literal and writes a warning to OM.LOG instead of failing with a NullPointerException.
Comment 16 Eike Stepper CLA 2010-05-09 10:40:01 EDT
Hmm, I'd prefer an exception. NPE is possibly not meaningful enough, though...
Comment 17 Eike Stepper CLA 2010-05-18 06:17:19 EDT
Go ahead ;-)
Comment 18 Stefan Winkler CLA 2010-05-18 10:14:22 EDT
Committed to HEAD
Comment 19 Stefan Winkler CLA 2010-05-18 16:52:14 EDT
I was not aware that this Bug is not specific to the DBStore. 
The testcase fails with the MEMStore as well. 

Maybe it would be a good idea to check for invalid default literals on the client side or at some other more central place. Either that or the same bug has to be fixed in the MEMStore as well.

I've disabled the testcase for the MemStore for now and added a FIXME comment.
I've also created Bug 313440 for this issue in the MemStore.
Comment 20 Stefan Winkler CLA 2010-05-18 17:01:33 EDT
For the protocol: MemStore works ok, only in a way not expected by the testcase. -> No issue with the MemStore.
Comment 21 Eike Stepper CLA 2010-06-29 04:35:33 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/