diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/InfoboxReadResponseParser.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/InfoboxReadResponseParser.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/InfoboxReadResponseParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/InfoboxReadResponseParser.java index 760df649d..7075e66f2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/InfoboxReadResponseParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/InfoboxReadResponseParser.java @@ -40,9 +40,10 @@ import org.apache.xpath.XPathAPI; import org.w3c.dom.Document; import org.w3c.dom.Element; -import at.gv.egovernment.moa.id.AuthenticationException; -import at.gv.egovernment.moa.id.ParseException; import at.gv.egovernment.moa.id.auth.data.IdentityLink; +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; @@ -66,14 +67,19 @@ public class InfoboxReadResponseParser { * @param xmlResponse <code><InfoboxReadResponse></code> as String * @throws ParseException If an element cannot be parsed * @throws AuthenticationException If any authentication error occurs + * @throws BKUException */ - public InfoboxReadResponseParser(String xmlResponse) throws ParseException, AuthenticationException { + public InfoboxReadResponseParser(String xmlResponse) throws ParseException, AuthenticationException, 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); } } @@ -85,8 +91,9 @@ public class InfoboxReadResponseParser { * @param is <code><InfoboxReadResponse></code> as InputStream * @throws ParseException If an element cannot be parsed * @throws AuthenticationException If any authentication error occurs + * @throws BKUException */ - public InfoboxReadResponseParser(InputStream is) throws ParseException, AuthenticationException { + public InfoboxReadResponseParser(InputStream is) throws ParseException, AuthenticationException, BKUException { init(is); } @@ -98,8 +105,9 @@ public class InfoboxReadResponseParser { * @param is The InfoBoxReadResponse 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); @@ -108,11 +116,17 @@ public class InfoboxReadResponseParser { infoBoxElem_ = 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 (BKUException e) { + throw e; } catch (Throwable t) { - throw new ParseException("parser.01", new Object[] { t.toString()}, t); + throw new ParseException("parser.01", new Object[] { t.toString()}, t); } } |