Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-04-05 02:26:22 +0000
committerEike Stepper2020-04-05 02:26:22 +0000
commit40498ab7e6f21bdfae1996731edb05aedcd0a9e6 (patch)
treeed8b59716f8f08cac56f6edaee393ba1e45f0730 /plugins/org.eclipse.emf.cdo.common/src
parentcc6e929b042369cb56a2a30436f150b337ddd664 (diff)
downloadcdo-40498ab7e6f21bdfae1996731edb05aedcd0a9e6.tar.gz
cdo-40498ab7e6f21bdfae1996731edb05aedcd0a9e6.tar.xz
cdo-40498ab7e6f21bdfae1996731edb05aedcd0a9e6.zip
[561779] IllegalStateException: Package 'xyz' contains unresolved proxy
https://bugs.eclipse.org/bugs/show_bug.cgi?id=561779
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java64
1 files changed, 34 insertions, 30 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
index 583ba1e872..d075cb76a2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
@@ -647,72 +647,76 @@ public final class CDOModelUtil implements CDOModelConstants
TreeIterator<EObject> it = ePackage.eAllContents();
while (it.hasNext())
{
- EObject e = it.next();
+ EObject packageElement = it.next();
- if (e instanceof EAnnotation)
+ if (packageElement instanceof EAnnotation)
{
- // we don't need to validate the structure of annotations. The applications that
- // define annotations will have to take what they can get
+ // We don't need to validate the structure of annotations.
+ // The applications that define annotations will have to take what they can get.
it.prune();
}
else
{
- for (EObject r : e.eCrossReferences())
+ for (EObject referencedElement : packageElement.eCrossReferences())
{
- EObject refTarget = null;
+ EObject referenceTarget = null;
- if (r.eIsProxy())
+ if (referencedElement.eIsProxy())
{
- String msg = "Package '%s' contains unresolved proxy '%s'";
- msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)r).eProxyURI());
- throw new IllegalStateException(msg);
+ referencedElement = EcoreUtil.resolve(referencedElement, (ResourceSet)null);
+ if (referencedElement.eIsProxy())
+ {
+ String msg = "Package '%s' contains unresolved proxy '%s'";
+ msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)referencedElement).eProxyURI());
+ throw new IllegalStateException(msg);
+ }
}
- if (r.eResource() != null && r.eResource() != e.eResource())
+ if (referencedElement.eResource() != null && referencedElement.eResource() != packageElement.eResource())
{
- // It's a ref into another resource
- EPackage pkg = null;
- if (r instanceof EClassifier)
+ // It's a reference into another resource.
+ EPackage referencedPackage = null;
+ if (referencedElement instanceof EClassifier)
{
- refTarget = r;
- pkg = ((EClassifier)r).getEPackage();
+ referenceTarget = referencedElement;
+ referencedPackage = ((EClassifier)referencedElement).getEPackage();
}
- else if (r instanceof EStructuralFeature)
+ else if (referencedElement instanceof EStructuralFeature)
{
- refTarget = r;
- EStructuralFeature feature = (EStructuralFeature)r;
+ referenceTarget = referencedElement;
+ EStructuralFeature feature = (EStructuralFeature)referencedElement;
EClass ownerClass = (EClass)feature.eContainer();
- pkg = ownerClass.getEPackage();
+ referencedPackage = ownerClass.getEPackage();
}
- else if (r instanceof EGenericType)
+ else if (referencedElement instanceof EGenericType)
{
- EGenericType genType = (EGenericType)r;
+ EGenericType genType = (EGenericType)referencedElement;
EClassifier c = genType.getEClassifier();
if (c != null)
{
- refTarget = c;
- pkg = c.getEPackage();
+ referenceTarget = c;
+ referencedPackage = c.getEPackage();
}
}
- if (pkg == null)
+ if (referencedPackage == null)
{
continue;
}
- while (pkg.getESuperPackage() != null)
+ while (referencedPackage.getESuperPackage() != null)
{
- pkg = pkg.getESuperPackage();
+ referencedPackage = referencedPackage.getESuperPackage();
}
- String resourceURI = refTarget.eResource().getURI().toString();
- if (!resourceURI.toString().equals(pkg.getNsURI()))
+ String resourceURI = referenceTarget.eResource().getURI().toString();
+ if (!resourceURI.toString().equals(referencedPackage.getNsURI()))
{
String msg = "URI of the resource (%s) does not match the nsURI (%s) of the top-level package;\n"
+ "this can be fixed by calling Resource.setURI(URI) after loading the packages,\n"
+ "or by configuring a URI mapping from nsURI's to location URI's before loading the packages,\n"
+ "and then loading them with their nsURI's";
- msg = String.format(msg, resourceURI, pkg.getNsURI());
+ msg = String.format(msg, resourceURI, referencedPackage.getNsURI());
throw new IllegalStateException(msg);
}
}

Back to the top