summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-05 10:25:56 (EDT)
committerEike Stepper2008-05-05 10:25:56 (EDT)
commit28067900c805b57269009f5b40bc6e19075664da (patch)
treeecd10fbd36513a9924c3786e49d7eac11d78ba00
parente434634d60e0424605b84d25c7fb125cdc82805b (diff)
downloadcdo-28067900c805b57269009f5b40bc6e19075664da.zip
cdo-28067900c805b57269009f5b40bc6e19075664da.tar.gz
cdo-28067900c805b57269009f5b40bc6e19075664da.tar.bz2
[230076] Client is hanging :-(
https://bugs.eclipse.org/bugs/show_bug.cgi?id=230076
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java79
1 files changed, 39 insertions, 40 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
index 1b200da..51b3020 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
@@ -258,45 +258,48 @@ public final class EMFUtil
public static String ePackageToString(EPackage ePackage, EPackage.Registry packageRegistry)
{
- Resource.Factory resourceFactory = new XMIResourceFactoryImpl();
- ResourceSetImpl resourceSet = new ResourceSetImpl()
- // {
- // @Override
- // protected Resource delegatedGetResource(URI uri, boolean loadOnDemand)
- // {
- // System.out.println("\nGET_RESOURCE: " + uri);
- // return delegatedGetResource(uri, loadOnDemand);
- // }
- // }
- ;
+ synchronized (EMFUtil.class)
+ {
+ Resource.Factory resourceFactory = new XMIResourceFactoryImpl();
+ ResourceSetImpl resourceSet = new ResourceSetImpl()
+ // {
+ // @Override
+ // protected Resource delegatedGetResource(URI uri, boolean loadOnDemand)
+ // {
+ // System.out.println("\nGET_RESOURCE: " + uri);
+ // return delegatedGetResource(uri, loadOnDemand);
+ // }
+ // }
+ ;
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
- resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("*", resourceFactory);
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
+ resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("*", resourceFactory);
- Resource packageResource = createPackageResource(resourceSet, ePackage);
- // for (Object object : packageRegistry.values())
- // {
- // if (object != ePackage)
- // {
- // createPackageResource(resourceSet, (EPackage)object);
- // }
- // }
+ Resource packageResource = createPackageResource(resourceSet, ePackage);
+ // for (Object object : packageRegistry.values())
+ // {
+ // if (object != ePackage)
+ // {
+ // createPackageResource(resourceSet, (EPackage)object);
+ // }
+ // }
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
- try
- {
- packageResource.save(stream, null);
- String string = stream.toString(ECORE_ENCODING);
- return string;
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
+ try
+ {
+ packageResource.save(stream, null);
+ String string = stream.toString(ECORE_ENCODING);
+ return string;
+ }
+ catch (RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
}
}
@@ -304,11 +307,7 @@ public final class EMFUtil
{
URI uri = URI.createURI(ePackage.getNsURI());
Resource resource = resourceSet.createResource(uri);
- synchronized (ePackage)
- {
- resource.getContents().add(ePackage);
- }
-
+ resource.getContents().add(ePackage);
return resource;
}