diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java index 1624a59c0..339f8a993 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/CreateXMLSignatureResponseParser.java @@ -36,10 +36,11 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; -import at.gv.egovernment.moa.id.AuthenticationException; -import at.gv.egovernment.moa.id.ParseException; import at.gv.egovernment.moa.id.auth.data.CreateXMLSignatureResponse; import at.gv.egovernment.moa.id.auth.data.SAMLAttribute; +import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; +import at.gv.egovernment.moa.id.auth.exception.BKUException; +import at.gv.egovernment.moa.id.auth.exception.ParseException; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.XPathUtils; @@ -84,13 +85,18 @@ public class CreateXMLSignatureResponseParser { * * @throws AuthenticationException if any authentication error occurs * @throws ParseException if an element cannot be parsed + * @throws */ - public CreateXMLSignatureResponseParser(String xmlResponse) throws AuthenticationException, ParseException { + public CreateXMLSignatureResponseParser(String xmlResponse) throws AuthenticationException, ParseException, BKUException{ try { InputStream s = new ByteArrayInputStream(xmlResponse.getBytes("UTF-8")); init(s); } - catch (Throwable t) { + + catch (BKUException e) { + throw e; + + } catch (Throwable t) { throw new ParseException("parser.01", new Object[] { t.toString()}, t); } } @@ -103,8 +109,9 @@ public class CreateXMLSignatureResponseParser { * * @throws AuthenticationException If any authentication error occurs * @throws ParseException If an element cannot be parsed + * @throws BKUException */ - public CreateXMLSignatureResponseParser(InputStream is) throws AuthenticationException, ParseException { + public CreateXMLSignatureResponseParser(InputStream is) throws AuthenticationException, ParseException, BKUException { init(is); } @@ -125,8 +132,9 @@ public class CreateXMLSignatureResponseParser { * @param is The CreateXMLSignatureResponse as stream. * @throws AuthenticationException if an authentication error occurs. * @throws ParseException If an error occurs on parsing the the document. + * @throws BKUException */ - private void init(InputStream is) throws AuthenticationException, ParseException { + private void init(InputStream is) throws AuthenticationException, ParseException, BKUException { try { Element responseElem = DOMUtils.parseXmlValidating(is); @@ -135,10 +143,16 @@ public class CreateXMLSignatureResponseParser { sigResponse_ = responseElem; } else { ErrorResponseParser erp = new ErrorResponseParser(responseElem); - throw new AuthenticationException("auth.08", new Object[] { erp.getErrorCode(), erp.getErrorInfo()}); + throw new BKUException("auth.08", + new Object[] { erp.getErrorCode(), erp.getErrorInfo()}, + erp.getErrorCode(), + erp.getErrorInfo()); } - } catch (Throwable t) { + } catch (BKUException e) { + throw e; + + } catch (Throwable t) { throw new ParseException("parser.01", new Object[] { t.toString()}, t); } } |