Skip to content
Snippets Groups Projects
Commit 23889d16 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

failsafe added when recon returns invalid response

parent a9b8c96b
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!386Resolve "Continous integration tests"
......@@ -335,15 +335,20 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService
String match = null;
JsonObject result = null;
for (JsonElement element : asJsonArray) {
String objAbreviation = ((JsonObject) element).get("abbreviation").getAsString();
if (match == null) {
match = objAbreviation;
result = (JsonObject) element;
} else if (match.length() > objAbreviation.length()) {
match = objAbreviation;
result = (JsonObject) element;
} else if (id.equalsIgnoreCase(objAbreviation)) {
match = objAbreviation;
if (((JsonObject) element).get("abbreviation") != null) {
String objAbreviation = ((JsonObject) element).get("abbreviation").getAsString();
if (match == null) {
match = objAbreviation;
result = (JsonObject) element;
} else if (match.length() > objAbreviation.length()) {
match = objAbreviation;
result = (JsonObject) element;
} else if (id.equalsIgnoreCase(objAbreviation)) {
match = objAbreviation;
result = (JsonObject) element;
}
} else if (match == null) {
logger.warn("No abbreviation found for element: " + element);
result = (JsonObject) element;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment