From 32a55fe960a609e0d4f25e408d1f56e2204f02db Mon Sep 17 00:00:00 2001 From: tkellner Date: Tue, 2 Oct 2012 19:40:16 +0000 Subject: set / log errormessages in some remaining places git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1144 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java | 2 ++ .../bku/local/stal/LocalSignRequestHandler.java | 4 +++- .../stal/service/impl/STALRequestBrokerImpl.java | 4 +++- .../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 21 +++++++++++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java index 8562677c..ef8addc0 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java @@ -71,11 +71,13 @@ public class ExclusiveAccessSTAL implements STAL { // time out log.info("Timeout while waiting for exclusive access to STAL."); ErrorResponse response = new ErrorResponse(6000); + response.setErrorMessage("Timeout while waiting for exclusive access to STAL."); return Collections.singletonList((STALResponse) response); } } catch (InterruptedException e) { // interrupted ErrorResponse response = new ErrorResponse(6000); + response.setErrorMessage("Interrupted: " + e); return Collections.singletonList((STALResponse) response); } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index 3ced30a6..c4855400 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -62,7 +62,9 @@ public class LocalSignRequestHandler extends SignRequestHandler { return super.handleRequest(request); } 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; } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index 1fdac2ca..cc5b8462 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -184,7 +184,9 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.warn("Timeout while waiting to consume response, cleanup requests."); requests.clear(); hashDataInputs.clear(); - return Collections.singletonList((STALResponse) new ErrorResponse(ERR_4500)); + ErrorResponse err = new ErrorResponse(ERR_4500); + err.setErrorMessage("Timeout while waiting to consume response"); + return Collections.singletonList((STALResponse) err); } } log.trace("consuming responses"); diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index 830ec8cb..1374e890 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -80,7 +80,9 @@ public abstract class AbstractSMCCSTAL implements STAL { if (handler != null) { if (handler.requireCard()) { if (waitForCard()) { - return new ErrorResponse(6001); + ErrorResponse err = new ErrorResponse(6001); + err.setErrorMessage("Cancel while waiting for card"); + return err; } } try { @@ -88,8 +90,8 @@ public abstract class AbstractSMCCSTAL implements STAL { STALResponse response = handler.handleRequest(request); if (response != null) { if (response instanceof ErrorResponse) { - log.info("Got an error response."); ErrorResponse err = (ErrorResponse) response; + log.info("Got an error response: " + err.getErrorMessage()); if (unrecoverableErrors.contains(err.getErrorCode())) { return response; } @@ -118,15 +120,21 @@ public abstract class AbstractSMCCSTAL implements STAL { signatureCard = null; } else { log.info("Exceeded max retries, returning error."); - return new ErrorResponse(6000); + ErrorResponse err = new ErrorResponse(6000); + err.setErrorMessage("Exceeded max retries trying to read STAL response"); + return err; } } } else { log.error("Cannot find a handler for STAL request: {}.", request); - return new ErrorResponse(); + ErrorResponse err = new ErrorResponse(); + err.setErrorMessage("Cannot find a handler for STAL request: " + request); + return err; } } - return new ErrorResponse(6000); + ErrorResponse err = new ErrorResponse(6000); + err.setErrorMessage("Exceeded max retries trying to read STAL response"); + return err; } /** @@ -148,7 +156,8 @@ public abstract class AbstractSMCCSTAL implements STAL { if (response != null) { responseList.add(response); if (response instanceof ErrorResponse) { - log.info("Got an error response, don't process remaining requests."); + ErrorResponse err = (ErrorResponse)response; + log.info("Got an error response, don't process remaining requests: " + err.getErrorMessage()); break; } } -- cgit v1.2.3