Skip to content

Commit

Permalink
Fix writing traces with dynamically-defined PCs
Browse files Browse the repository at this point in the history
ItemType couldn't be created for PrismContainers with no compile time
class, as .getRealValues() obviously cannot be executed.

TODO This situation probably occurs at more places in the code. Review.
  • Loading branch information
mederly committed Jan 20, 2020
1 parent c33d808 commit 8c93b31
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -94,11 +94,18 @@ public String toString() {
'}';
}

public static ItemType fromItem(Item item) {
public static ItemType fromItem(Item<?, ?> item) {
if (item != null) {
ItemType rv = new ItemType();
rv.setName(item.getElementName());
rv.value.addAll(item.getRealValues());
if (item instanceof PrismContainer && (item.getDefinition() == null || ((PrismContainerDefinition) item.getDefinition()).getCompileTimeClass() == null)) {
// a special case -- item.getRealValues() does not work here (TODO generalize this)
for (PrismContainerValue<?> value : ((PrismContainer<?>) item).getValues()) {
rv.value.add(new RawType(value, null, item.getPrismContext()));
}
} else {
rv.value.addAll(item.getRealValues());
}
return rv;
} else {
return null;
Expand Down

0 comments on commit 8c93b31

Please sign in to comment.