summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticatorBase.java19
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);
}
}