diff options
author | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2012-10-02 19:38:38 +0000 |
---|---|---|
committer | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2012-10-02 19:38:38 +0000 |
commit | 6053457f2c36be893cacbd74f2b173d149f9efd1 (patch) | |
tree | 2ba6a7ecb78d36404a2e470f97fb5b1d3fdeb94e /smccSTALExt/src/main/java/at/gv/egiz | |
parent | d06952f807b754359f994d684c2490eb4a731bbb (diff) | |
download | mocca-6053457f2c36be893cacbd74f2b173d149f9efd1.tar.gz mocca-6053457f2c36be893cacbd74f2b173d149f9efd1.tar.bz2 mocca-6053457f2c36be893cacbd74f2b173d149f9efd1.zip |
Also set error messages for STALExt requests
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1143 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTALExt/src/main/java/at/gv/egiz')
3 files changed, 29 insertions, 15 deletions
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java index 0cf45a9c..ca01ffeb 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java @@ -76,6 +76,14 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac */ private int currentActivationScript = 0; + private ErrorResponse errorResponse(int errorCode, String errorMessage) + { + log.error(errorMessage); + ErrorResponse err = new ErrorResponse(errorCode); + err.setErrorMessage(errorMessage); + return err; + } + @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -89,9 +97,8 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac Card icc = card.getCard(); if (icc == null) { - log.error("SignatureCard instance '{}' does not support card management requests.", - card.getClass().getName()); - return new ErrorResponse(1000); + return errorResponse(1000, "SignatureCard instance '" + + card.getClass().getName() + "' does not support card management requests."); } List<RequestScriptElement> script = ((APDUScriptRequest) request).getScript(); @@ -172,8 +179,7 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac return new APDUScriptResponse(responses); } else { - log.error("Got unexpected STAL request: {}.", request); - return new ErrorResponse(1000); + return errorResponse(1000, "Got unexpected STAL request: " + request); } } diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java index 9ba63a89..efaafec9 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java @@ -57,6 +57,14 @@ public class IdentityLinkRequestHandler extends AbstractRequestHandler { return true; } + private ErrorResponse errorResponse(int errorCode, String errorMessage, Exception e) + { + log.error(errorMessage, e); + ErrorResponse err = new ErrorResponse(errorCode); + err.setErrorMessage(errorMessage + (e == null ? "" : " " + e)); + return err; + } + @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -82,8 +90,7 @@ public class IdentityLinkRequestHandler extends AbstractRequestHandler { if(il_gui == null) { - log.warn("Failed to cast gui to IdentityLinkGUIFacade!"); - return new ErrorResponse(1000); + return errorResponse(1000, "Failed to cast gui to IdentityLinkGUIFacade!", null); } il_gui.showIdentityLinkInformationDialog(this, "ok_action", @@ -97,23 +104,20 @@ public class IdentityLinkRequestHandler extends AbstractRequestHandler { } catch(SignatureCardException ex) { - log.error(ex.getMessage(), ex); gui.showErrorDialog(PINManagementGUIFacade.ERR_CARD_NOTACTIVATED, null, this, "cancel"); waitForAction(); - return new ErrorResponse(1000); + return errorResponse(1000, ex.getMessage(), ex); } catch (IOException ex) { - log.error(ex.getMessage(), ex); gui.showErrorDialog(IdentityLinkGUIFacade.ERR_INFOBOX_INVALID, null, this, "cancel"); waitForAction(); - return new ErrorResponse(1000); + return errorResponse(1000, ex.getMessage(), ex); } } else { - log.error("Got unexpected STAL request: {}.", request); - return new ErrorResponse(1000); + return errorResponse(1000, "Got unexpected STAL request: " + request); } } } diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java index 3ef2f515..26cb9368 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java @@ -169,11 +169,15 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null, this, "ok"); waitForAction(); - return new ErrorResponse(1000); + ErrorResponse err = new ErrorResponse(1000); + err.setErrorMessage(ex.getMessage()); + return err; } } else { log.error("Got unexpected STAL request: {}.", request); - return new ErrorResponse(1000); + ErrorResponse err = new ErrorResponse(1000); + err.setErrorMessage("Got unexpected STAL request: " + request); + return err; } } |