Skip to content

Commit

Permalink
Made prismContext handling more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 11, 2014
1 parent 0cb5f59 commit 4a1a9a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Expand Up @@ -128,19 +128,13 @@ public PrismContainerValue(OriginType type, Objectable source, PrismContainerabl

@Override
public PrismContext getPrismContext() {
return prismContext;

// we could take prismContext also from the parent, but
// actually if it's in the parent, it should be also here
// (as the "add" operation automatically adopts/revives
// the child being added)
// if (prismContext != null) {
// return prismContext;
// }
// if (getParent() != null) {
// return getParent().getPrismContext();
// }
// return null;
if (prismContext != null) {
return prismContext;
}
if (getParent() != null) {
return getParent().getPrismContext();
}
return null;
}

/**
Expand Down
Expand Up @@ -234,7 +234,7 @@ public static <T extends Containerable> boolean setFieldContainerValue(PrismCont
// This value is already part of another prism. We need to clone it to add it here.
fieldContainerValue = fieldContainerValue.clone();
}
fieldContainer = new PrismContainer<T>(fieldName);
fieldContainer = new PrismContainer<T>(fieldName, parent.getPrismContext());
fieldContainer.add(fieldContainerValue);
if (parent.getParent() == null) {
parent.add(fieldContainer);
Expand Down

0 comments on commit 4a1a9a1

Please sign in to comment.