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