Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.io.InputStream;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
Expand All @@ -31,6 +33,8 @@
*/
class DirectLinkingEObjectInputStream extends EObjectInputStream {

private static final Logger LOGGER = LogManager.getLogger(DirectLinkingEObjectInputStream.class);

DirectLinkingEObjectInputStream(final InputStream inputStream, final Map<?, ?> options) throws IOException {
super(inputStream, options);
}
Expand All @@ -52,13 +56,19 @@ public EObject readEObject(final Resource context) throws IOException {
EObject eObject = context.getContents().get(readCompressedInt());
count--;
while (count > 0) {
EStructuralFeature feature = eObject.eClass().getEStructuralFeature(readCompressedInt());
int next = readCompressedInt();
EStructuralFeature feature = eObject.eClass().getEStructuralFeature(next);
count--;
if (feature.isMany()) {
eObject = ((EList<EObject>) eObject.eGet(feature, false)).get(readCompressedInt());
count--;
if (feature != null) {
if (feature.isMany()) {
eObject = ((EList<EObject>) eObject.eGet(feature, false)).get(readCompressedInt());
count--;
} else {
eObject = (EObject) eObject.eGet(feature, false);
}
} else {
eObject = (EObject) eObject.eGet(feature, false);
LOGGER.error(String.format("Failed to get EStructuralFeature for Eclass : %s, at readCompressedInt : %d", eObject.eClass(), next));

}
}
return eObject;
Expand Down