fixed NPE on expressions
This commit is contained in:
parent
4d064916e9
commit
63ffd77622
@ -241,24 +241,30 @@ public class ApsProcessJsonTranslator extends ApsOrganizationHandler implements
|
|||||||
String idField = prefix == null ? "id" : prefix + "Id";
|
String idField = prefix == null ? "id" : prefix + "Id";
|
||||||
|
|
||||||
ObjectNode jsonRef = (ObjectNode)_jsonRef;
|
ObjectNode jsonRef = (ObjectNode)_jsonRef;
|
||||||
String modelName = jsonRef.get(nameField).asText();
|
JsonNode jsonName = jsonRef.get(nameField);
|
||||||
this.logger.trace("Found model '{}' in the APS Process descriptor", modelName);
|
if (jsonName == null) {
|
||||||
|
this.logger.trace("The expression does not have an APS model name field ({})", nameField);
|
||||||
if (apsIndex.containsValue(modelName)) {
|
return false;
|
||||||
long modelId = jsonRef.get(idField).asLong();
|
|
||||||
long apsModelId = apsIndex.getFirstKey(modelName);
|
|
||||||
if (apsModelId != modelId) {
|
|
||||||
this.logger.debug("The model '{}' exists in APS with ID {}; leaving unchanged", modelName, apsModelId);
|
|
||||||
jsonRef.put(idField, apsModelId);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.logger.trace("The model '{}' ID does not change; leaving unchanged", modelName);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.logger.debug("The model '{}' does not exists in APS; leaving unchanged", modelName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
String modelName = jsonName.asText();
|
||||||
|
this.logger.trace("Found model '{}' in the APS Process descriptor", modelName);
|
||||||
|
if (!apsIndex.containsValue(modelName)) {
|
||||||
|
this.logger.debug("The model '{}' does not exists in APS; leaving unchanged", modelName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonNode jsonId = jsonRef.get(idField);
|
||||||
|
long modelId = jsonId == null ? -1L : jsonId.asLong();
|
||||||
|
long apsModelId = apsIndex.getFirstKey(modelName);
|
||||||
|
if (apsModelId != modelId) {
|
||||||
|
this.logger.debug("The model '{}' exists in APS with ID {}", modelName, apsModelId);
|
||||||
|
jsonRef.put(idField, apsModelId);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
this.logger.trace("The model '{}' ID does not change; leaving unchanged", modelName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user