summaryrefslogtreecommitdiff
path: root/smccSTAL
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-05-05 15:29:01 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-05-05 15:29:01 +0000
commitb1c8641a63a67e3c64d948f9e8dce5c01e11e2dd (patch)
tree0883f08a408f89f758e9a1be629232e3dd055c3a /smccSTAL
parent83a9b613836910f7edc370c2fe60fa2268dc4461 (diff)
downloadmocca-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')
-rw-r--r--smccSTAL/pom.xml16
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java11
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java24
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java20
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java14
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java21
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java19
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java7
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java35
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java26
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java17
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java16
12 files changed, 109 insertions, 117 deletions
diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml
index 22d6558a..5864e122 100644
--- a/smccSTAL/pom.xml
+++ b/smccSTAL/pom.xml
@@ -1,14 +1,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>bku</artifactId>
+ <artifactId>mocca</artifactId>
<groupId>at.gv.egiz</groupId>
- <version>1.2.14-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>at.gv.egiz</groupId>
<artifactId>smccSTAL</artifactId>
<name>smcc STAL</name>
- <version>1.2.14-SNAPSHOT</version>
+ <version>${project.parent.version}</version>
<build>
<plugins>
<plugin>
@@ -24,25 +24,25 @@
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>STAL</artifactId>
- <version>1.2.14-SNAPSHOT</version>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>smcc</artifactId>
- <version>1.2.14-SNAPSHOT</version>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>at.gv.egiz</groupId>
<artifactId>BKUCommonGUI</artifactId>
- <version>1.2.14-SNAPSHOT</version>
+ <version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>iaik</groupId>
<artifactId>iaik_jce_me4se</artifactId>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java
index 00738188..05f9c176 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java
@@ -17,11 +17,10 @@
package at.gv.egiz.bku.pin.gui;
-import at.gv.egiz.smcc.pin.gui.PINProvider;
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;
/**
* common super class providing action listener for all PIN GUIs
@@ -29,7 +28,7 @@ import org.apache.commons.logging.LogFactory;
*/
public abstract class AbstractPINProvider implements ActionListener {
- protected static final Log log = LogFactory.getLog(AbstractPINProvider.class);
+ private final Logger log = LoggerFactory.getLogger(AbstractPINProvider.class);
protected String action;
protected boolean actionPerformed;
@@ -40,7 +39,7 @@ public abstract class AbstractPINProvider implements ActionListener {
this.wait();
}
} catch (InterruptedException e) {
- log.error("[" + Thread.currentThread().getName() + "] interrupt in waitForAction");
+ log.error("[{}] interrupt in waitForAction.", Thread.currentThread().getName());
throw e;
}
actionPerformed = false;
@@ -53,7 +52,7 @@ public abstract class AbstractPINProvider implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
- log.debug("[" + Thread.currentThread().getName() + "] action performed - " + e.getActionCommand());
+ log.debug("[{}] action performed - {}", Thread.currentThread().getName(), e.getActionCommand());
action = e.getActionCommand();
actionPerformed();
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java
index 81db0e90..0199dab0 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java
@@ -19,12 +19,12 @@ package at.gv.egiz.bku.pin.gui;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.smccstal.SecureViewer;
import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.PINGUI;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
import java.security.DigestException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The number of retries is not fixed and there is no way (?) to obtain this value.
@@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class SignPINGUI extends SignPINProvider implements PINGUI {
- protected static final Log log = LogFactory.getLog(SignPINGUI.class);
+ private final Logger log = LoggerFactory.getLogger(SignPINGUI.class);
private boolean retry = false;
@@ -48,7 +48,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI {
}
@Override
- public void enterPINDirect(PINSpec spec, int retries)
+ public void enterPINDirect(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
if (retry) {
gui.showEnterPINDirect(spec, retries);
@@ -60,7 +60,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI {
}
@Override
- public void enterPIN(PINSpec spec, int retries)
+ public void enterPIN(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
if (retry) {
gui.showEnterPIN(spec, retries);
@@ -71,7 +71,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI {
}
}
- private void showSignatureData(PINSpec spec)
+ private void showSignatureData(PinInfo spec)
throws CancelledException, InterruptedException {
gui.showSignatureDataDialog(spec,
@@ -80,20 +80,20 @@ public class SignPINGUI extends SignPINProvider implements PINGUI {
this, "secureViewer");
do {
- log.trace("[" + Thread.currentThread().getName() + "] wait for action");
+ log.trace("[{}] wait for action.", Thread.currentThread().getName());
waitForAction();
- log.trace("[" + Thread.currentThread().getName() + "] received action " + action);
+ log.trace("[{}] received action {}.", Thread.currentThread().getName(), action);
if ("secureViewer".equals(action)) {
try {
viewer.displayDataToBeSigned(signedInfo, this, "signatureData");
} catch (DigestException ex) {
- log.error("Bad digest value: " + ex.getMessage());
+ log.error("Bad digest value: {}", ex.getMessage());
gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
new Object[]{ex.getMessage()},
this, "error");
} catch (Exception ex) {
- log.error("Could not display hashdata inputs: " +
+ log.error("Could not display hashdata inputs: {}.",
ex.getMessage());
gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
new Object[]{ex.getMessage()},
@@ -113,7 +113,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI {
throw new CancelledException(spec.getLocalizedName() +
" entry cancelled");
} else {
- log.error("unknown action command " + action);
+ log.error("Unknown action command {}.", action);
}
} while (true);
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java
index fc1d39af..d09eebb9 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java
@@ -19,12 +19,12 @@ package at.gv.egiz.bku.pin.gui;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.smccstal.SecureViewer;
import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.PINProvider;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
import java.security.DigestException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The number of retries is not fixed and there is no way (?) to obtain this value.
@@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class SignPINProvider extends AbstractPINProvider implements PINProvider {
- protected static final Log log = LogFactory.getLog(SignPINProvider.class);
+ private final Logger log = LoggerFactory.getLogger(SignPINProvider.class);
protected BKUGUIFacade gui;
protected SecureViewer viewer;
@@ -53,7 +53,7 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider
}
@Override
- public char[] providePIN(PINSpec spec, int retries)
+ public char[] providePIN(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
gui.showSignaturePINDialog(spec, (retry) ? retries : -1,
@@ -62,20 +62,20 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider
this, "secureViewer");
do {
- log.trace("[" + Thread.currentThread().getName() + "] wait for action");
+ log.trace("[{}] wait for action.", Thread.currentThread().getName());
waitForAction();
- log.trace("[" + Thread.currentThread().getName() + "] received action " + action);
+ log.trace("[{}] received action {}.", Thread.currentThread().getName(), action);
if ("secureViewer".equals(action)) {
try {
viewer.displayDataToBeSigned(signedInfo, this, "pinEntry");
} catch (DigestException ex) {
- log.error("Bad digest value: " + ex.getMessage());
+ log.error("Bad digest value: {}", ex.getMessage());
gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
new Object[]{ex.getMessage()},
this, "error");
} catch (Exception ex) {
- log.error("Could not display hashdata inputs: " +
+ log.error("Could not display hashdata inputs: {}",
ex.getMessage());
gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
new Object[]{ex.getMessage()},
@@ -98,7 +98,7 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider
throw new CancelledException(spec.getLocalizedName() +
" entry cancelled");
} else {
- log.error("unknown action command " + action);
+ log.error("Unknown action command {}.", action);
}
} while (true);
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java
index dc21492e..89ab1e21 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java
@@ -18,10 +18,8 @@ package at.gv.egiz.bku.pin.gui;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.PINGUI;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* The number of retries is not fixed and there is no way (?) to obtain this value.
@@ -36,8 +34,6 @@ import org.apache.commons.logging.LogFactory;
*/
public class VerifyPINGUI extends VerifyPINProvider implements PINGUI {
- protected static final Log log = LogFactory.getLog(VerifyPINGUI.class);
-
private boolean retry = false;
public VerifyPINGUI(BKUGUIFacade gui) {
@@ -45,15 +41,15 @@ public class VerifyPINGUI extends VerifyPINProvider implements PINGUI {
}
@Override
- public void enterPINDirect(PINSpec spec, int retries)
+ public void enterPINDirect(PinInfo pinInfo, int retries)
throws CancelledException, InterruptedException {
- gui.showEnterPINDirect(spec, (retry) ? retries : -1);
+ gui.showEnterPINDirect(pinInfo, (retry) ? retries : -1);
retry = true;
}
@Override
- public void enterPIN(PINSpec spec, int retries) {
- gui.showEnterPIN(spec, (retry) ? retries : -1);
+ public void enterPIN(PinInfo pinInfo, int retries) {
+ gui.showEnterPIN(pinInfo, (retry) ? retries : -1);
retry = true;
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java
index fda1e402..f9300932 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java
@@ -18,10 +18,10 @@ package at.gv.egiz.bku.pin.gui;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.PINProvider;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The number of retries is not fixed and there is no way (?) to obtain this value.
@@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class VerifyPINProvider extends AbstractPINProvider implements PINProvider {
- protected static final Log log = LogFactory.getLog(VerifyPINProvider.class);
+ private final Logger log = LoggerFactory.getLogger(VerifyPINProvider.class);
protected BKUGUIFacade gui;
private boolean retry = false;
@@ -46,26 +46,25 @@ public class VerifyPINProvider extends AbstractPINProvider implements PINProvide
}
@Override
- public char[] providePIN(PINSpec spec, int retries)
+ public char[] providePIN(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
gui.showVerifyPINDialog(spec, (retry) ? retries : -1,
this, "verify",
this, "cancel");
- log.trace("[" + Thread.currentThread().getName() + "] wait for action");
+ log.trace("[{}] wait for action.", Thread.currentThread().getName());
waitForAction();
- log.trace("[" + Thread.currentThread().getName() + "] received action " + action);
+ log.trace("[{}] received action {}.", Thread.currentThread().getName(), action);
+
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
if ("cancel".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
throw new CancelledException(spec.getLocalizedName() +
" entry cancelled");
}
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
retry = true;
return gui.getPin();
}
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);
}
}