diff options
author | Simon Rettberg | 2018-09-26 10:46:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-09-26 10:46:30 +0200 |
commit | 30484116603c50ca0709692b96f3d518f77243c4 (patch) | |
tree | 65fa9d56fbc71d26cd74cffee13ce3a5410068b1 | |
parent | Clear cookies before every authentication request (diff) | |
download | ecp-client-lean-30484116603c50ca0709692b96f3d518f77243c4.tar.gz ecp-client-lean-30484116603c50ca0709692b96f3d518f77243c4.tar.xz ecp-client-lean-30484116603c50ca0709692b96f3d518f77243c4.zip |
Log XML reply if failed to parse
-rw-r--r-- | src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java | 19 |
1 files 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);
}
}
|