summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_auth_sl20
diff options
context:
space:
mode:
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");
+
}
}