Skip to content

Commit

Permalink
fix #53 by adding sanity check on eObject(Id)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdaniel committed Jan 16, 2017
1 parent 2e42c4e commit c1638b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,13 @@ public EStructuralFeature getContainingFeature(InternalEObject internalObject) {

@Override
public EObject eObject(Id id) {
EClass eClass = resolveInstanceOf(id);
PersistentEObject object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
PersistentEObject object = null;
if(id != null) {
EClass eClass = resolveInstanceOf(id);
object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
}
}
return object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,13 @@ public EStructuralFeature getContainingFeature(InternalEObject internalObject) {

@Override
public EObject eObject(Id id) {
EClass eClass = resolveInstanceOf(id);
PersistentEObject object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
PersistentEObject object = null;
if(id != null) {
EClass eClass = resolveInstanceOf(id);
object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
}
}
return object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,13 @@ public EStructuralFeature getContainingFeature(InternalEObject internalObject) {

@Override
public EObject eObject(Id id) {
EClass eClass = resolveInstanceOf(id);
PersistentEObject object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
PersistentEObject object = null;
if(id != null) {
EClass eClass = resolveInstanceOf(id);
object = persistentObjectsCache.get(id, new PersistentEObjectCacheLoader(eClass));
if (object.resource() != resource()) {
object.resource(resource());
}
}
return object;
}
Expand Down

0 comments on commit c1638b7

Please sign in to comment.