summaryrefslogtreecommitdiff
path: root/smcc
diff options
context:
space:
mode:
Diffstat (limited to 'smcc')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SWCard.java8
-rw-r--r--smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java2
2 files changed, 8 insertions, 2 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
index 7150c8b4..81b347c3 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
@@ -224,7 +224,13 @@ public class SWCard implements SignatureCard {
}
return sb.toString().trim().toCharArray();
} catch (IOException e) {
- throw new SignatureCardException("Failed to read file '" + passwordFileName + "'.");
+ throw new SignatureCardException("Failed to read file '" + passwordFileName + "'.", e);
+ } finally {
+ try {
+ keyStorePasswordFile.close();
+ } catch (IOException e) {
+ throw new SignatureCardException("Failed to close file '" + passwordFileName + "'.", e);
+ }
}
}
diff --git a/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java b/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java
index 09833fd3..5acc7e10 100644
--- a/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java
+++ b/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java
@@ -63,7 +63,7 @@ public class CreateSignature {
byte[] signature = createSignature(signatureCard, KeyboxName.SECURE_SIGNATURE_KEYPAIR, data);
Formatter printf = new Formatter(System.out);
printf.format("Signature: %1$x", new BigInteger(signature));
-
+ printf.close();
}
public static byte[] createSignature(SignatureCard signatureCard, KeyboxName keyboxName, InputStream data) throws SignatureCardException, InterruptedException, IOException {