From 108df5e1cc640070d1b03fb2dfd99306e661b8fe Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 18 Jun 2021 08:18:59 +0200 Subject: update some log messages --- .../eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java') 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 cc2a8430..2b6ddb96 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 @@ -16,6 +16,7 @@ import org.apache.http.ParseException; import org.apache.http.StatusLine; import org.apache.http.client.ResponseHandler; import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; import org.apache.http.util.EntityUtils; import org.jose4j.base64url.Base64Url; import org.slf4j.Logger; @@ -57,10 +58,13 @@ public class SL20HttpBindingUtils { throw new SlCommandoParserException("SL20 response contains NO ContentType"); } - - if (!response.getEntity().getContentType().getValue().startsWith("application/json")) { + + final ContentType contentType = ContentType.getOrDefault(response.getEntity()); + if (!ContentType.APPLICATION_JSON.getMimeType().equals(contentType.getMimeType())) { + log.error("SL20 response with statuscode: {} has wrong http ContentType: {}", + response.getStatusLine(), contentType); throw new SlCommandoParserException( - "SL20 response with a wrong ContentType: " + response.getEntity().getContentType().getValue()); + "SL20 response with a wrong http ContentType: " + contentType); } @@ -190,7 +194,7 @@ public class SL20HttpBindingUtils { } } else { - throw new SlCommandoParserException("Can NOT find content in http response"); + throw new SlCommandoParserException("Can NOT find any content in http response"); } -- cgit v1.2.3