Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] convertToString() exception during share
[EMFStore] convertToString() exception during share [message #1220602] Thu, 12 December 2013 16:45 Go to next message
Scott Dybiec is currently offline Scott DybiecFriend
Messages: 148
Registered: July 2009
Senior Member
I've run into the following exception when sharing a project that
contains an instance of my application's model. Stack trace is attached
below.

In my Ecore-based model, I declare an enumeration called Opacity, which
ends up having the same classifier ID as Ecore's Float data type (38 in
this case). I think that EMF reuses containers ID integers for each
model, so these IDs are only guaranteed to be universally unique within
an EPackage --- hence the conflict I encountered. This has bitten me
before in my own code.

In the EMFStoreResourceHelper.convertToString() method, I think there
should be a check to make sure that the EFactory for the EDataType is
really the EcoreFactory, not any other model's EFactory.

Perhaps I'm the first person using EMFStore with a model that has enough
DataType's to finally encounter this problem.

I didn't have this problem until I upgraded from V1.0.1 to v1.0.3.

Here's the original method.

@Override
public String convertToString(EFactory factory, EDataType dataType,
Object value)
{
final int classifierID = dataType.getClassifierID();
if (isFloat(classifierID)) {
return format((Float) value);
} else if (isDouble(classifierID)) {
return format((Double) value);
}

return super.convertToString(factory, dataType, value);
}

Here's the stack trace:

Root exception:
java.lang.ClassCastException:
com.humanfactor.rw.model.reportdesigner.Opacity cannot be cast to
java.lang.Float
at
org.eclipse.emf.emfstore.internal.common.EMFStoreResourceHelper.convertToString(EMFStoreResourceHelper.java:46)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.getDatatypeValue(XMLSaveImpl.java:3103)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeSingle(XMLSaveImpl.java:1693)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1275)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:678)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:586)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:365)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:999)
at
org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.saveResource(ModelUtil.java:428)
at
org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveResource(ProjectSpaceBase.java:1088)
at
org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveChangePackage(ProjectSpaceBase.java:1069)
at
org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.save(ProjectSpaceBase.java:1047)
at
org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.doRun(ShareController.java:86)
at
org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:59)
at
org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:1)
at
org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.run(ServerCall.java:249)
at
org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.executeCall(SessionManager.java:120)
at
org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:61)
at
org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
at
org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.shareProject(ProjectSpaceBase.java:1149)
at
org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:588)
at
org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:1)
at
org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
at
org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
at
org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
at
org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
at
org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
at
org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
at
org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
at
org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
at
org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.shareProject(ESLocalProjectImpl.java:586)
at
org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:65)
at
org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:1)
at
org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction$1.run(MonitoredEMFStoreAction.java:70)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


public class EMFStoreResourceHelper extends XMIHelperImpl {

/**
* Constructor.
*
* @param resource
* the EMFStore resource for which to create the helper
*/
public EMFStoreResourceHelper(EMFStoreResource resource) {
super(resource);
}

@Override
public String convertToString(EFactory factory, EDataType dataType,
Object value)
{
final int classifierID = dataType.getClassifierID();
if (isFloat(classifierID)) {
return format((Float) value);
} else if (isDouble(classifierID)) {
return format((Double) value);
}

return super.convertToString(factory, dataType, value);
}

private static boolean isFloat(int classifierID) {
return classifierID == EcorePackage.EFLOAT
|| classifierID == EcorePackage.EFLOAT_OBJECT;
}

private static boolean isDouble(int classifierID) {
return classifierID == EcorePackage.EDOUBLE
|| classifierID == EcorePackage.EDOUBLE_OBJECT;
}

private String format(Float value) {
return String.format(Locale.US, "%f", value.floatValue());
}

private String format(Double value) {
return String.format(Locale.US, "%f", value.doubleValue());
}
}
Re: [EMFStore] convertToString() exception during share [message #1220683 is a reply to message #1220602] Fri, 13 December 2013 04:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31781
Registered: July 2009
Senior Member
That does seem questionable. One should test for dataType ==
EcorePackage.Literals.EFLOAT or perhaps to handle all data types based
on float using dataType.getInstanceClass() == float.class.


On 12/12/2013 5:45 PM, scott@xxxxxxxx wrote:
> I've run into the following exception when sharing a project that
> contains an instance of my application's model. Stack trace is
> attached below.
>
> In my Ecore-based model, I declare an enumeration called Opacity,
> which ends up having the same classifier ID as Ecore's Float data type
> (38 in this case). I think that EMF reuses containers ID integers for
> each model, so these IDs are only guaranteed to be universally unique
> within an EPackage --- hence the conflict I encountered. This has
> bitten me before in my own code.
>
> In the EMFStoreResourceHelper.convertToString() method, I think there
> should be a check to make sure that the EFactory for the EDataType is
> really the EcoreFactory, not any other model's EFactory.
>
> Perhaps I'm the first person using EMFStore with a model that has
> enough DataType's to finally encounter this problem.
>
> I didn't have this problem until I upgraded from V1.0.1 to v1.0.3.
>
> Here's the original method.
>
> @Override
> public String convertToString(EFactory factory, EDataType
> dataType, Object value)
> {
> final int classifierID = dataType.getClassifierID();
> if (isFloat(classifierID)) {
> return format((Float) value);
> } else if (isDouble(classifierID)) {
> return format((Double) value);
> }
>
> return super.convertToString(factory, dataType, value);
> }
>
> Here's the stack trace:
>
> Root exception:
> java.lang.ClassCastException:
> com.humanfactor.rw.model.reportdesigner.Opacity cannot be cast to
> java.lang.Float
> at
> org.eclipse.emf.emfstore.internal.common.EMFStoreResourceHelper.convertToString(EMFStoreResourceHelper.java:46)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.getDatatypeValue(XMLSaveImpl.java:3103)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeSingle(XMLSaveImpl.java:1693)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1275)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:678)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:586)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:365)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:999)
> at
> org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.saveResource(ModelUtil.java:428)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveResource(ProjectSpaceBase.java:1088)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveChangePackage(ProjectSpaceBase.java:1069)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.save(ProjectSpaceBase.java:1047)
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.doRun(ShareController.java:86)
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:59)
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:1)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.run(ServerCall.java:249)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.executeCall(SessionManager.java:120)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:61)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.shareProject(ProjectSpaceBase.java:1149)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:588)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:1)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
> at
> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.shareProject(ESLocalProjectImpl.java:586)
> at
> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:65)
> at
> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:1)
> at
> org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction$1.run(MonitoredEMFStoreAction.java:70)
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>
>
> public class EMFStoreResourceHelper extends XMIHelperImpl {
>
> /**
> * Constructor.
> *
> * @param resource
> * the EMFStore resource for which to create the helper
> */
> public EMFStoreResourceHelper(EMFStoreResource resource) {
> super(resource);
> }
>
> @Override
> public String convertToString(EFactory factory, EDataType
> dataType, Object value)
> {
> final int classifierID = dataType.getClassifierID();
> if (isFloat(classifierID)) {
> return format((Float) value);
> } else if (isDouble(classifierID)) {
> return format((Double) value);
> }
>
> return super.convertToString(factory, dataType, value);
> }
>
> private static boolean isFloat(int classifierID) {
> return classifierID == EcorePackage.EFLOAT
> || classifierID == EcorePackage.EFLOAT_OBJECT;
> }
>
> private static boolean isDouble(int classifierID) {
> return classifierID == EcorePackage.EDOUBLE
> || classifierID == EcorePackage.EDOUBLE_OBJECT;
> }
>
> private String format(Float value) {
> return String.format(Locale.US, "%f", value.floatValue());
> }
>
> private String format(Double value) {
> return String.format(Locale.US, "%f", value.doubleValue());
> }
> }


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMFStore] convertToString() exception during share [message #1220723 is a reply to message #1220602] Fri, 13 December 2013 09:46 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
Messages: 89
Registered: March 2011
Member
Hi Scott,

yes, you are absolutely right. Thanks for pointing this out.
I've created a BR for this issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=424002
We'll fix this with the next hotfix release.

Thanks

Cheers
Edgar

Am 12.12.2013 17:45, schrieb scott@xxxxxxxx:
> I've run into the following exception when sharing a project that
> contains an instance of my application's model. Stack trace is attached
> below.
>
> In my Ecore-based model, I declare an enumeration called Opacity, which
> ends up having the same classifier ID as Ecore's Float data type (38 in
> this case). I think that EMF reuses containers ID integers for each
> model, so these IDs are only guaranteed to be universally unique within
> an EPackage --- hence the conflict I encountered. This has bitten me
> before in my own code.
>
> In the EMFStoreResourceHelper.convertToString() method, I think there
> should be a check to make sure that the EFactory for the EDataType is
> really the EcoreFactory, not any other model's EFactory.
>
> Perhaps I'm the first person using EMFStore with a model that has enough
> DataType's to finally encounter this problem.
>
> I didn't have this problem until I upgraded from V1.0.1 to v1.0.3.
>
> Here's the original method.
>
> @Override
> public String convertToString(EFactory factory, EDataType dataType,
> Object value)
> {
> final int classifierID = dataType.getClassifierID();
> if (isFloat(classifierID)) {
> return format((Float) value);
> } else if (isDouble(classifierID)) {
> return format((Double) value);
> }
>
> return super.convertToString(factory, dataType, value);
> }
>
> Here's the stack trace:
>
> Root exception:
> java.lang.ClassCastException:
> com.humanfactor.rw.model.reportdesigner.Opacity cannot be cast to
> java.lang.Float
> at
> org.eclipse.emf.emfstore.internal.common.EMFStoreResourceHelper.convertToString(EMFStoreResourceHelper.java:46)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.getDatatypeValue(XMLSaveImpl.java:3103)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeSingle(XMLSaveImpl.java:1693)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1275)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:678)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:586)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:365)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:999)
>
> at
> org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.saveResource(ModelUtil.java:428)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveResource(ProjectSpaceBase.java:1088)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveChangePackage(ProjectSpaceBase.java:1069)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.save(ProjectSpaceBase.java:1047)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.doRun(ShareController.java:86)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:59)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:1)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.run(ServerCall.java:249)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.executeCall(SessionManager.java:120)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:61)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.shareProject(ProjectSpaceBase.java:1149)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:588)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:1)
>
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.shareProject(ESLocalProjectImpl.java:586)
>
> at
> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:65)
>
> at
> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:1)
>
> at
> org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction$1.run(MonitoredEMFStoreAction.java:70)
>
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>
>
>
> public class EMFStoreResourceHelper extends XMIHelperImpl {
>
> /**
> * Constructor.
> *
> * @param resource
> * the EMFStore resource for which to create the helper
> */
> public EMFStoreResourceHelper(EMFStoreResource resource) {
> super(resource);
> }
>
> @Override
> public String convertToString(EFactory factory, EDataType dataType,
> Object value)
> {
> final int classifierID = dataType.getClassifierID();
> if (isFloat(classifierID)) {
> return format((Float) value);
> } else if (isDouble(classifierID)) {
> return format((Double) value);
> }
>
> return super.convertToString(factory, dataType, value);
> }
>
> private static boolean isFloat(int classifierID) {
> return classifierID == EcorePackage.EFLOAT
> || classifierID == EcorePackage.EFLOAT_OBJECT;
> }
>
> private static boolean isDouble(int classifierID) {
> return classifierID == EcorePackage.EDOUBLE
> || classifierID == EcorePackage.EDOUBLE_OBJECT;
> }
>
> private String format(Float value) {
> return String.format(Locale.US, "%f", value.floatValue());
> }
>
> private String format(Double value) {
> return String.format(Locale.US, "%f", value.doubleValue());
> }
> }


--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] convertToString() exception during share [message #1220751 is a reply to message #1220723] Fri, 13 December 2013 11:44 Go to previous message
Scott Dybiec is currently offline Scott DybiecFriend
Messages: 148
Registered: July 2009
Senior Member
Here's the workaround I have put in place until the hotfix is available:

@Override
public String convertToString(EFactory factory, EDataType dataType,
Object value)
{
if (factory instanceof EcoreFactory) {
final int classifierID = dataType.getClassifierID();
if (isFloat(classifierID)) {
return format((Float) value);
} else if (isDouble(classifierID)) {
return format((Double) value);
}
}

return super.convertToString(factory, dataType, value);
}

$cott

On 12/13/2013 4:46 AM, Edgar Mueller wrote:
> Hi Scott,
>
> yes, you are absolutely right. Thanks for pointing this out.
> I've created a BR for this issue:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=424002
> We'll fix this with the next hotfix release.
>
> Thanks
>
> Cheers
> Edgar
>
> Am 12.12.2013 17:45, schrieb scott@xxxxxxxx:
>> I've run into the following exception when sharing a project that
>> contains an instance of my application's model. Stack trace is attached
>> below.
>>
>> In my Ecore-based model, I declare an enumeration called Opacity, which
>> ends up having the same classifier ID as Ecore's Float data type (38 in
>> this case). I think that EMF reuses containers ID integers for each
>> model, so these IDs are only guaranteed to be universally unique within
>> an EPackage --- hence the conflict I encountered. This has bitten me
>> before in my own code.
>>
>> In the EMFStoreResourceHelper.convertToString() method, I think there
>> should be a check to make sure that the EFactory for the EDataType is
>> really the EcoreFactory, not any other model's EFactory.
>>
>> Perhaps I'm the first person using EMFStore with a model that has enough
>> DataType's to finally encounter this problem.
>>
>> I didn't have this problem until I upgraded from V1.0.1 to v1.0.3.
>>
>> Here's the original method.
>>
>> @Override
>> public String convertToString(EFactory factory, EDataType dataType,
>> Object value)
>> {
>> final int classifierID = dataType.getClassifierID();
>> if (isFloat(classifierID)) {
>> return format((Float) value);
>> } else if (isDouble(classifierID)) {
>> return format((Double) value);
>> }
>>
>> return super.convertToString(factory, dataType, value);
>> }
>>
>> Here's the stack trace:
>>
>> Root exception:
>> java.lang.ClassCastException:
>> com.humanfactor.rw.model.reportdesigner.Opacity cannot be cast to
>> java.lang.Float
>> at
>> org.eclipse.emf.emfstore.internal.common.EMFStoreResourceHelper.convertToString(EMFStoreResourceHelper.java:46)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.getDatatypeValue(XMLSaveImpl.java:3103)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveDataTypeSingle(XMLSaveImpl.java:1693)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1275)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSingle(XMLSaveImpl.java:2398)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1542)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:678)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:586)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:365)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:999)
>>
>> at
>> org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.saveResource(ModelUtil.java:428)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveResource(ProjectSpaceBase.java:1088)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.saveChangePackage(ProjectSpaceBase.java:1069)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.save(ProjectSpaceBase.java:1047)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.doRun(ShareController.java:86)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:59)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.controller.ShareController.run(ShareController.java:1)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.run(ServerCall.java:249)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.executeCall(SessionManager.java:120)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:61)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.shareProject(ProjectSpaceBase.java:1149)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:588)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$15.call(ESLocalProjectImpl.java:1)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.shareProject(ESLocalProjectImpl.java:586)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:65)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.ui.controller.UIShareProjectController.doRun(UIShareProjectController.java:1)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction$1.run(MonitoredEMFStoreAction.java:70)
>>
>> at
>> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>>
>>
>>
>> public class EMFStoreResourceHelper extends XMIHelperImpl {
>>
>> /**
>> * Constructor.
>> *
>> * @param resource
>> * the EMFStore resource for which to create the helper
>> */
>> public EMFStoreResourceHelper(EMFStoreResource resource) {
>> super(resource);
>> }
>>
>> @Override
>> public String convertToString(EFactory factory, EDataType dataType,
>> Object value)
>> {
>> final int classifierID = dataType.getClassifierID();
>> if (isFloat(classifierID)) {
>> return format((Float) value);
>> } else if (isDouble(classifierID)) {
>> return format((Double) value);
>> }
>>
>> return super.convertToString(factory, dataType, value);
>> }
>>
>> private static boolean isFloat(int classifierID) {
>> return classifierID == EcorePackage.EFLOAT
>> || classifierID == EcorePackage.EFLOAT_OBJECT;
>> }
>>
>> private static boolean isDouble(int classifierID) {
>> return classifierID == EcorePackage.EDOUBLE
>> || classifierID == EcorePackage.EDOUBLE_OBJECT;
>> }
>>
>> private String format(Float value) {
>> return String.format(Locale.US, "%f", value.floatValue());
>> }
>>
>> private String format(Double value) {
>> return String.format(Locale.US, "%f", value.doubleValue());
>> }
>> }
>
>
Previous Topic:[EMFStore] Illegal argument for method createProject
Next Topic:[EMF Client Platform] Modifying content of ECPProject in non-UI thread
Goto Forum:
  


Current Time: Tue Mar 09 08:20:04 GMT 2021

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

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

Back to the top