summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_auth_sl20
diff options
context:
space:
mode:
authorThomas <>2021-03-11 13:41:21 +0100
committerThomas <>2021-03-11 13:41:21 +0100
commit16fcf9a762e4ee145e6f276061dc1c5d6c20b73c (patch)
tree048e0679bdb36e1a9e0ffe807c3058106b56cd29 /eaaf_modules/eaaf_module_auth_sl20
parent181d9d3e6427b974372347b95e5ed2d9e236e9de (diff)
downloadEAAF-Components-16fcf9a762e4ee145e6f276061dc1c5d6c20b73c.tar.gz
EAAF-Components-16fcf9a762e4ee145e6f276061dc1c5d6c20b73c.tar.bz2
EAAF-Components-16fcf9a762e4ee145e6f276061dc1c5d6c20b73c.zip
update error-handling in SL2.0 binding-utils
Diffstat (limited to 'eaaf_modules/eaaf_module_auth_sl20')
-rw-r--r--eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
index d07c0e66..cc2a8430 100644
--- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
@@ -96,7 +96,7 @@ public class SL20HttpBindingUtils {
return holder;
} catch (final IOException | ParseException e) {
- log.warn("SL20 response contains no valid JSON", e);
+ log.warn("SL20 response contains no )valid JSON", e);
throw new SlCommandoParserException(MessageFormat.format(
"SL20 response with http-code: {0} with body: {1} and generic response-processing error: {2}",
httpStatusCode, bodyMsg, e.getMessage()));
@@ -170,18 +170,28 @@ public class SL20HttpBindingUtils {
private static JsonNode parseSL20ResultFromResponse(final HttpEntity resp) throws Exception {
if (resp != null && resp.getContent() != null) {
final String rawSL20Resp = EntityUtils.toString(resp);
- final JsonNode sl20Resp = mapper.getMapper().readTree(rawSL20Resp);
+ try {
+ final JsonNode sl20Resp = mapper.getMapper().readTree(rawSL20Resp);
+ if (sl20Resp != null) {
+ return sl20Resp;
- // TODO: check sl20Resp type like && sl20Resp.isJsonObject()
- if (sl20Resp != null) {
- return sl20Resp;
-
- } else {
+ } else {
+ log.error("SL2.0 can NOT parse to a JSON object from msg: {}", rawSL20Resp);
+ throw new SlCommandoParserException("SL2.0 can NOT parse to a JSON object");
+ }
+
+ } catch (SlCommandoParserException e) {
+ throw e;
+
+ } catch (Exception e) {
+ log.error("SL2.0 can NOT parse to a JSON object from msg: {}", rawSL20Resp);
throw new SlCommandoParserException("SL2.0 can NOT parse to a JSON object");
+
}
} else {
throw new SlCommandoParserException("Can NOT find content in http response");
+
}
}