From 30484116603c50ca0709692b96f3d518f77243c4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 26 Sep 2018 10:46:30 +0200 Subject: Log XML reply if failed to parse --- .../edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java index a0dec7e..56148e1 100644 --- a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java +++ b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java @@ -24,7 +24,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; -import org.apache.http.ParseException; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.methods.HttpPost; @@ -98,19 +97,15 @@ public abstract class ECPAuthenticatorBase extends Observable { String responseBody; try { responseBody = EntityUtils.toString(httpResponse.getEntity()); - httpPost.reset(); - return buildDocumentFromString(responseBody); - } catch (ParseException e) { - logger.debug("Could not read response from IdP"); - throw new ECPAuthenticationException(e); - } catch (IOException e) { - logger.debug("Could not read response from IdP"); - throw new ECPAuthenticationException(e); - } catch (SAXException e) { + } catch (RuntimeException | IOException e) { logger.debug("Could not read response from IdP"); throw new ECPAuthenticationException(e); - } catch (ParserConfigurationException e) { - logger.debug("Could not read response from IdP"); + } + try { + httpPost.reset(); + return buildDocumentFromString(responseBody); + } catch (IOException | SAXException | ParserConfigurationException | RuntimeException e) { + logger.debug("Could not parse XML response from IdP:\n" + responseBody); throw new ECPAuthenticationException(e); } } -- cgit v1.2.3-55-g7522