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 | 52 |
1 files changed, 44 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..28ce69e95 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 @@ -1,3 +1,25 @@ +/******************************************************************************* + * Copyright 2014 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /* * Copyright 2003 Federal Chancellery Austria * MOA-ID has been developed in a cooperation between BRZ, the Federal @@ -40,9 +62,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 +89,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 +113,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 +127,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 +138,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); } } |