Source:
public void fixAssertions(Archetype archetype, AssertionResult assertionResult) { createdMissingStructure.clear(); try { Map<String, Value> setPathValues = assertionResult.getSetPathValues(); for(String path:setPathValues.keySet()) { Value value = setPathValues.get(path); String pathOfParent = stripLastPathSegment(path); String lastPathSegment = getLastPathSegment(path); List<Object> parents = null; parents = ruleEvaluation.getQueryContext().findList(pathOfParent); while(parents.isEmpty()) { parents = constructMissingStructure(archetype, pathOfParent, lastPathSegment, parents); } for(Object parent:parents) { RMAttributeInfo attributeInfo = ArchieRMInfoLookup.getInstance().getAttributeInfo(parent.getClass(), lastPathSegment); if(attributeInfo == null) { throw new IllegalStateException("attribute " + lastPathSegment + " does not exist on type " + parent.getClass()); } if(value.getValue() == null) { creator.set(parent, lastPathSegment, Lists.newArrayList(value.getValue())); } else if(attributeInfo.getType().equals(Long.class) && value.getValue().getClass().equals(Double.class)) { Long convertedValue = ((Double) value.getValue()).longValue(); creator.set(parent, lastPathSegment, Lists.newArrayList(convertedValue)); } else if(attributeInfo.getType().equals(Double.class) && value.getValue().getClass().equals(Long.class)) { Double convertedValue = ((Long) value.getValue()).doubleValue(); creator.set(parent, lastPathSegment, Lists.newArrayList(convertedValue)); } else { creator.set(parent, lastPathSegment, Lists.newArrayList(value.getValue())); } if(parent instanceof CodePhrase) { fixCodePhrase(archetype, pathOfParent, parent); } ruleEvaluation.refreshQueryContext(); } for(MissingStructure structure:createdMissingStructure) { completeStructure(archetype, structure); } } } catch (XPathExpressionException e) { logger.error("error fixing assertionResult {}", assertionResult, e); } }

Target:
public void fixAssertions(Archetype archetype, AssertionResult assertionResult) { try { Map<String, Value> setPathValues = assertionResult.getSetPathValues(); for(String path:setPathValues.keySet()) { Value value = setPathValues.get(path); String pathOfParent = stripLastPathSegment(path); String lastPathSegment = getLastPathSegment(path); List<Object> parents = null; parents = ruleEvaluation.getQueryContext().findList(pathOfParent); while(parents.isEmpty()) { parents = constructMissingStructure(archetype, pathOfParent, lastPathSegment, parents); } for(Object parent:parents) { RMAttributeInfo attributeInfo = ArchieRMInfoLookup.getInstance().getAttributeInfo(parent.getClass(), lastPathSegment); if(attributeInfo == null) { throw new IllegalStateException("attribute " + lastPathSegment + " does not exist on type " + parent.getClass()); } if(value.getValue() == null) { creator.set(parent, lastPathSegment, Lists.newArrayList(value.getValue())); } else if(attributeInfo.getType().equals(Long.class) && value.getValue().getClass().equals(Double.class)) { Long convertedValue = ((Double) value.getValue()).longValue(); creator.set(parent, lastPathSegment, Lists.newArrayList(convertedValue)); } else if(attributeInfo.getType().equals(Double.class) && value.getValue().getClass().equals(Long.class)) { Double convertedValue = ((Long) value.getValue()).doubleValue(); creator.set(parent, lastPathSegment, Lists.newArrayList(convertedValue)); } else { creator.set(parent, lastPathSegment, Lists.newArrayList(value.getValue())); } if(parent instanceof CodePhrase) { fixCodePhrase(archetype, pathOfParent, parent); } ruleEvaluation.refreshQueryContext(); } } } catch (XPathExpressionException e) { logger.error("error fixing assertionResult {}", assertionResult, e); } }