summaryrefslogtreecommitdiff
path: root/smccSTALExt
diff options
context:
space:
mode:
Diffstat (limited to 'smccSTALExt')
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java16
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java20
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java8
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;
}
}