diff options
author | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-05-05 15:29:01 +0000 |
---|---|---|
committer | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-05-05 15:29:01 +0000 |
commit | b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd (patch) | |
tree | 0883f08a408f89f758e9a1be629232e3dd055c3a /smccSTAL/src/main/java/at/gv/egiz/bku/smccstal | |
parent | 83a9b613836910f7edc370c2fe60fa2268dc4461 (diff) | |
download | mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.tar.gz mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.tar.bz2 mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.zip |
Merged feature branch mocca-1.2.13-id@r724 back to trunk.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@725 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTAL/src/main/java/at/gv/egiz/bku/smccstal')
6 files changed, 59 insertions, 61 deletions
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java index 14b36e28..8400700f 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -43,7 +43,8 @@ import at.gv.egiz.stal.STALResponse; */ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements ActionListener, SMCCSTALRequestHandler { - protected static Log log = LogFactory.getLog(AbstractBKUWorker.class); + private final Logger log = LoggerFactory.getLogger(AbstractBKUWorker.class); + protected BKUGUIFacade gui; protected List<String> actionCommandList = new ArrayList<String>(); protected Boolean actionPerformed = false; @@ -68,7 +69,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti */ @Override public void actionPerformed(ActionEvent e) { - log.info("Action: " + e); + log.info("Action: {}.", e); if (actionCommandList != null) { if (actionCommandList.contains(e.getActionCommand())) { actionOccured(); @@ -83,7 +84,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti * @throws java.lang.InterruptedException */ protected synchronized void waitForAction() throws InterruptedException { - log.info("Waiting for Action"); + log.info("Waiting for Action."); while (!actionPerformed) { wait(); } @@ -91,7 +92,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti } protected synchronized void actionOccured() { - log.info("Received Action"); + log.info("Received Action."); actionPerformed = true; notifyAll(); } @@ -119,7 +120,6 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti try { waitForAction(); } catch (InterruptedException e) { - log.error(e); } return true; case SMCCHelper.TERMINAL_NOT_PRESENT: @@ -129,7 +129,6 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti try { waitForAction(); } catch (InterruptedException e) { - log.error(e); } return true; case SMCCHelper.CARD_NOT_SUPPORTED: @@ -178,10 +177,10 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti @Override public STALResponse handleRequest(STALRequest request) { if (request instanceof QuitRequest) { - log.info("Setting state to: finished for BKUWorker " + this); + log.info("Setting state to: finished for BKUWorker {}.", this); finished = true; } else { - log.error("Unexpected request to handle: " + request); + log.error("Unexpected request to handle: {}.", request); } return null; } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java index 98b21f79..940674f9 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java @@ -19,8 +19,8 @@ package at.gv.egiz.bku.smccstal; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -29,8 +29,7 @@ import at.gv.egiz.stal.STALResponse; public abstract class AbstractRequestHandler implements SMCCSTALRequestHandler, ActionListener { - private final static Log log = LogFactory - .getLog(AbstractRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(AbstractRequestHandler.class); protected SignatureCard card; protected BKUGUIFacade gui; 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 d0762da9..b8f85a60 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 @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -37,7 +37,7 @@ import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.StatusRequest; public abstract class AbstractSMCCSTAL implements STAL { - private static Log log = LogFactory.getLog(AbstractSMCCSTAL.class); + private final Logger log = LoggerFactory.getLogger(AbstractSMCCSTAL.class); public final static int DEFAULT_MAX_RETRIES = 1; @@ -66,7 +66,7 @@ public abstract class AbstractSMCCSTAL implements STAL { private STALResponse getResponse(STALRequest request) throws InterruptedException { int retryCounter = 0; while (retryCounter < maxRetries) { - log.info("Retry #" + retryCounter + " of " + maxRetries); + log.info("Retry #{} of {}.", retryCounter, maxRetries); SMCCSTALRequestHandler handler = null; handler = handlerMap.get(request.getClass().getSimpleName()); if (handler != null) { @@ -80,7 +80,7 @@ public abstract class AbstractSMCCSTAL implements STAL { STALResponse response = handler.handleRequest(request); if (response != null) { if (response instanceof ErrorResponse) { - log.info("Got an error response"); + log.info("Got an error response."); ErrorResponse err = (ErrorResponse) response; if (unrecoverableErrors.contains(err.getErrorCode())) { return response; @@ -89,8 +89,8 @@ public abstract class AbstractSMCCSTAL implements STAL { signatureCard.disconnect(true); signatureCard = null; } else { - log.info("Exceeded max retries, returning error " - + err.getErrorMessage()); + log.info("Exceeded max retries, returning error {}.", err + .getErrorMessage()); return response; } } else { @@ -101,10 +101,10 @@ public abstract class AbstractSMCCSTAL implements STAL { return null; } } catch (InterruptedException e) { - log.info("Interrupt during request handling, do not retry"); + log.info("Interrupt during request handling, do not retry."); throw e; } catch (Exception e) { - log.info("Error while handling STAL request:", e); + log.info("Error while handling STAL request.", e); if (++retryCounter < maxRetries) { signatureCard.disconnect(true); signatureCard = null; @@ -114,7 +114,7 @@ public abstract class AbstractSMCCSTAL implements STAL { } } } else { - log.error("Cannot find a handler for STAL request: " + request); + log.error("Cannot find a handler for STAL request: {}.", request); return new ErrorResponse(); } } @@ -129,25 +129,24 @@ public abstract class AbstractSMCCSTAL implements STAL { */ @Override public List<STALResponse> handleRequest(List<? extends STALRequest> requestList) { - log.debug("Got request list containing " + requestList.size() - + " STAL requests"); + log.debug("Got request list containing {} STAL requests.", requestList.size()); List<STALResponse> responseList = new ArrayList<STALResponse>(requestList .size()); for (STALRequest request : requestList) { - log.info("Processing: " + request.getClass()); + log.info("Processing: {}.", request.getClass()); STALResponse response; try { response = getResponse(request); if (response != null) { responseList.add(response); if (response instanceof ErrorResponse) { - log.info("Got an error response, don't process remaining requests"); + log.info("Got an error response, don't process remaining requests."); break; } } } catch (InterruptedException ex) { - log.error("interrupted during request handling"); - throw new RuntimeException("interrupted during request handling", ex); + log.error("Interrupted during request handling."); + throw new RuntimeException("nterrupted during request handling", ex); } } @@ -156,12 +155,12 @@ public abstract class AbstractSMCCSTAL implements STAL { public void addRequestHandler(Class<? extends STALRequest> id, SMCCSTALRequestHandler handler) { - log.debug("Registering STAL request handler: " + id.getSimpleName()); + log.trace("Registering STAL request handler: {}.", id.getSimpleName()); handlerMap.put(id.getSimpleName(), handler); } public void removeRequestHandler(Class<? extends STALRequest> id) { - log.debug("De-registering STAL request handler: " + id.getSimpleName()); + log.trace("De-registering STAL request handler: {}", id.getSimpleName()); handlerMap.remove(id.getSimpleName()); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java index b34ab862..a2042589 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java @@ -18,8 +18,8 @@ package at.gv.egiz.bku.smccstal; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.pin.gui.VerifyPINGUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.LockedException; @@ -34,7 +34,7 @@ import at.gv.egiz.stal.STALResponse; public class InfoBoxReadRequestHandler extends AbstractRequestHandler { - private static Log log = LogFactory.getLog(InfoBoxReadRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(InfoBoxReadRequestHandler.class); // protected PINProviderFactory pinProviderFactory; @@ -46,7 +46,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { try { if (infoBox.getInfoboxIdentifier().equals("IdentityLink")) { newSTALMessage("Message.RequestCaption", "Message.IdentityLink"); - log.debug("Handling identitylink infobox"); + log.debug("Handling identitylink infobox."); byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(), new VerifyPINGUI(gui), infoBox.getDomainIdentifier()); @@ -58,7 +58,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { resp = DomainIdConverter.convertDomainId(resp, infoBox .getDomainIdentifier()); } catch (Exception e) { - log.error("Cannot convert domain specific id", e); + log.error("Cannot convert domain specific id.", e); return new ErrorResponse(1000); } } @@ -68,7 +68,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { } else if (SignatureCard.KeyboxName.CERITIFIED_KEYPAIR.equals(infoBox .getInfoboxIdentifier())) { newSTALMessage("Message.RequestCaption", "Message.CertifiedKeypair"); - log.debug("Handling certified keypair infobox"); + log.debug("Handling certified keypair infobox."); byte[] resp = card .getCertificate(SignatureCard.KeyboxName.CERITIFIED_KEYPAIR); if (resp == null) { @@ -81,7 +81,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { .equals(infoBox.getInfoboxIdentifier())) { newSTALMessage("Message.RequestCaption", "Message.SecureSignatureKeypair"); - log.debug("Handling secure signature keypair infobox"); + log.debug("Handling secure signature keypair infobox."); byte[] resp = card .getCertificate(SignatureCard.KeyboxName.SECURE_SIGNATURE_KEYPAIR); if (resp == null) { @@ -92,8 +92,8 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { return stalResp; } else { newSTALMessage("Message.RequestCaption", "Message.InfoboxReadRequest"); - log.warn("Unknown infobox identifier: " - + infoBox.getInfoboxIdentifier() + " trying generic request"); + log.warn("Unknown infobox identifier: {} trying generic request.", + infoBox.getInfoboxIdentifier()); byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(), new VerifyPINGUI(gui), infoBox.getDomainIdentifier()); @@ -105,7 +105,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { return stalResp; } } catch (IllegalArgumentException e) { - log.info("Infobox " + infoBox.getInfoboxIdentifier() + " not supported."); + log.info("Infobox {} not supported.", infoBox.getInfoboxIdentifier()); return new ErrorResponse(4002); } catch (NotActivatedException e) { log.info("Citizen card not activated.", e); @@ -122,14 +122,14 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { BKUGUIFacade.MESSAGE_WAIT); return new ErrorResponse(6001); } catch (CancelledException cx) { - log.debug("User cancelled request", cx); + log.debug("User cancelled request.", cx); return new ErrorResponse(6001); } catch (SignatureCardException e) { - log.info("Error while reading infobox: " + e); + log.info("Error while reading infobox. " + e); return new ErrorResponse(4000); } } else { - log.fatal("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 5b436d16..52804f79 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -27,8 +27,8 @@ import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.LockedException; @@ -47,14 +47,15 @@ import at.gv.egiz.stal.signedinfo.SignedInfoType; public class SignRequestHandler extends AbstractRequestHandler { - private static Log log = LogFactory.getLog(SignRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(SignRequestHandler.class); private static JAXBContext jaxbContext; static { try { jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName()); } catch (JAXBException e) { - log.fatal("Cannot init jaxbContext", e); + Logger log = LoggerFactory.getLogger(SignRequestHandler.class); + log.error("Cannot init jaxbContext", e); } } @@ -75,7 +76,7 @@ public class SignRequestHandler extends AbstractRequestHandler { InputStream is = new ByteArrayInputStream(signReq.getSignedInfo()); JAXBElement<SignedInfoType> si = (JAXBElement<SignedInfoType>) unmarshaller.unmarshal(is); String signatureMethod = si.getValue().getSignatureMethod().getAlgorithm(); - log.debug("Found signature method: " + signatureMethod); + log.debug("Found signature method: {}.", signatureMethod); KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier()); byte[] resp = card.createSignature(new ByteArrayInputStream(signReq.getSignedInfo()), kb, @@ -101,7 +102,7 @@ public class SignRequestHandler extends AbstractRequestHandler { BKUGUIFacade.MESSAGE_WAIT); return new ErrorResponse(6001); } catch (CancelledException cx) { - log.debug("User cancelled request"); + log.debug("User cancelled request."); return new ErrorResponse(6001); } catch (TimeoutException ex) { log.error("Timeout during pin entry"); @@ -116,14 +117,14 @@ public class SignRequestHandler extends AbstractRequestHandler { log.error("Error while creating signature: " + e); return new ErrorResponse(4000); } catch (JAXBException e) { - log.error("Cannot unmarshall signed info", e); + log.error("Cannot unmarshall signed info.", e); return new ErrorResponse(1000); } catch (IOException e) { log.error("Error while creating signature: " + e); return new ErrorResponse(4000); } } else { - log.fatal("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java index 56b24920..470a8255 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java @@ -24,8 +24,8 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.StatusRequest; import at.gv.egiz.stal.StatusResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; */ public class StatusRequestHandler extends AbstractRequestHandler { - protected static final Log log = LogFactory.getLog(StatusRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(StatusRequestHandler.class); @Override public void init(SignatureCard sc, BKUGUIFacade gui) { @@ -45,13 +45,13 @@ public class StatusRequestHandler extends AbstractRequestHandler { public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof StatusRequest) { - log.info("handling STATUS request"); + log.info("Handling STATUS request."); SMCCHelper smccHelper = new SMCCHelper(); StatusResponse response = new StatusResponse(); if (log.isTraceEnabled()) { - log.trace("SMCC result code: " + smccHelper.getResultCode() + - ", cardReady: " + - (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND)); + log.trace("SMCC result code: {}, cardReady: {}.", smccHelper + .getResultCode(), + (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND)); } if (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND) { response.setCardReady(Boolean.TRUE); @@ -60,7 +60,7 @@ public class StatusRequestHandler extends AbstractRequestHandler { } return response; } else { - log.error("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } |