diff --git a/bundles/org.eclipse.sirius.emfjson/META-INF/MANIFEST.MF b/bundles/org.eclipse.sirius.emfjson/META-INF/MANIFEST.MF index f562b93..96bc1a2 100644 --- a/bundles/org.eclipse.sirius.emfjson/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.sirius.emfjson/META-INF/MANIFEST.MF @@ -19,4 +19,3 @@ Import-Package: com.google.gson;version="2.2.4", org.eclipse.emf.ecore.resource.impl;version="0.0.0", org.eclipse.emf.ecore.util;version="0.0.0" Automatic-Module-Name: org.eclipse.sirius.emfjson -Require-Bundle: javax.xml.bind;bundle-version="2.2.0" diff --git a/bundles/org.eclipse.sirius.emfjson/src/main/java/org/eclipse/sirius/emfjson/utils/GsonEObjectSerializer.java b/bundles/org.eclipse.sirius.emfjson/src/main/java/org/eclipse/sirius/emfjson/utils/GsonEObjectSerializer.java index 8fbb7fb..86ea5d2 100644 --- a/bundles/org.eclipse.sirius.emfjson/src/main/java/org/eclipse/sirius/emfjson/utils/GsonEObjectSerializer.java +++ b/bundles/org.eclipse.sirius.emfjson/src/main/java/org/eclipse/sirius/emfjson/utils/GsonEObjectSerializer.java @@ -688,15 +688,12 @@ private JsonElement createSchemaLocationHeader() { xsiNoNamespaceSchemaLocation = this.getNoNamespaceSchemaLocation(ePackage); } } else { - Resource resource = ePackage.eResource(); - if (resource != null) { - JsonObjectProperty jsonObjectProperty = this.getJsonObjectFromResource(ePackage, handleBySchemaLocationMap, resource); - if (jsonObjectProperty != null) { - if (jsonObject == null) { - jsonObject = new JsonObject(); - } - jsonObject.add(jsonObjectProperty.getKey(), jsonObjectProperty.getElement()); + JsonObjectProperty jsonObjectProperty = this.getJsonObjectProperty(ePackage, handleBySchemaLocationMap); + if (jsonObjectProperty != null) { + if (jsonObject == null) { + jsonObject = new JsonObject(); } + jsonObject.add(jsonObjectProperty.getKey(), jsonObjectProperty.getElement()); } } } @@ -713,6 +710,14 @@ private JsonElement createSchemaLocationHeader() { return jsonObject; } + private JsonObjectProperty getJsonObjectProperty(EPackage ePackage, Map handleBySchemaLocationMap) { + Resource resource = ePackage.eResource(); + if (resource != null) { + return this.getJsonObjectFromResource(ePackage, handleBySchemaLocationMap, resource); + } + return null; + } + /** * Return JsonObject representation of schemLocation xml Attribute from given elements. *