Bug 411014 - Trying to commit Dynamic EPackages with a null nsURI throws NPE
Summary: Trying to commit Dynamic EPackages with a null nsURI throws NPE
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-18 08:28 EDT by Alex Lagarde CLA
Modified: 2020-12-11 10:46 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Lagarde CLA 2013-06-18 08:28:26 EDT
This is pretty minor, but also very simple to fix:

if you commit Dynamic instances of an EPackage without nsURI, you get the following exception: 

EMFUtil.getEPackageBytes: throw a bettter exception if EPackage has no nsURI
org.eclipse.emf.cdo.util.CommitException: java.lang.NullPointerException
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1209)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1219)
	at org.eclipse.emf.cdo.client.formation.Client1.doSomeFancyStuff(Client1.java:87)
	at org.eclipse.emf.cdo.client.formation.Client1.main(Client1.java:51)
Caused by: java.lang.NullPointerException
	at org.eclipse.emf.common.util.URI.createURIWithCache(URI.java:2546)
	at org.eclipse.emf.common.util.URI.createURI(URI.java:2424)
	at org.eclipse.emf.cdo.common.model.EMFUtil.getEPackageBytes(EMFUtil.java:487)
	at org.eclipse.emf.cdo.common.model.CDOModelUtil.writePackage(CDOModelUtil.java:598)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl.write(CDOPackageUnitImpl.java:270)
	at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOPackageUnit(CDODataOutputImpl.java:91)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requestingCommit(CommitTransactionRequest.java:159)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requesting(CommitTransactionRequest.java:128)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequestWithMonitoring.requesting(CDOClientRequestWithMonitoring.java:91)
	at org.eclipse.net4j.signal.RequestWithMonitoring.requesting(RequestWithMonitoring.java:165)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedOutput(RequestWithConfirmation.java:119)
	at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:104)
	at org.eclipse.net4j.signal.RequestWithMonitoring.doExecute(RequestWithMonitoring.java:235)
	at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:53)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
	at org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:431)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:89)
	at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:75)
	at org.eclipse.net4j.signal.RequestWithMonitoring.send(RequestWithMonitoring.java:110)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:518)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.commitTransaction(CDOClientProtocol.java:393)
	at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:72)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1191)
	... 3 more


A simple fix would be to modify the EMFUtil.getEPackageBytes() method and throw a more explicit exception when ePackage.getNsURI() is null.
Comment 1 Eike Stepper CLA 2013-06-29 12:16:06 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 2 Eike Stepper CLA 2015-07-14 02:17:43 EDT
Moving all open bugzillas to 4.5.
Comment 3 Eike Stepper CLA 2016-07-31 01:00:37 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 4 Eike Stepper CLA 2017-12-28 01:20:27 EST
Moving all open bugs to 4.7
Comment 5 Eike Stepper CLA 2019-11-08 02:06:31 EST
Moving all unresolved issues to version 4.8-
Comment 6 Eike Stepper CLA 2019-12-13 12:55:07 EST
Moving all unresolved issues to version 4.9
Comment 7 Eike Stepper CLA 2020-12-11 10:46:43 EST
Moving to 4.13.