summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java2
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java3
-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
-rw-r--r--utils/src/test/java/at/gv/egiz/bku/utils/URLEncodingOutputStreamTest.java4
5 files changed, 13 insertions, 6 deletions
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
index 244e2666..4eb7ea66 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
@@ -133,7 +133,7 @@ public class ResultServlet extends HttpServlet {
outputStream = resp.getOutputStream();
}
bp.writeResultTo(outputStream, responseEncoding);
- outputStream.flush();
+ outputStream.close();
} finally {
bindingProcessorManager.removeBindingProcessor(id);
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java
index 0c648a7e..4a715eee 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java
@@ -181,7 +181,8 @@ public class XWWWFormUrlInputIterator implements Iterator<FormParameter> {
// fill buffer if empty
if (pos >= count) {
if ((count = in.read(buf)) == -1) {
- throw new IOException("Invalid URL encoding.");
+ urldec.close();
+ throw new IOException("Invalid URL encoding.");
}
pos = 0;
}
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 {
diff --git a/utils/src/test/java/at/gv/egiz/bku/utils/URLEncodingOutputStreamTest.java b/utils/src/test/java/at/gv/egiz/bku/utils/URLEncodingOutputStreamTest.java
index c470e28a..1ab876ef 100644
--- a/utils/src/test/java/at/gv/egiz/bku/utils/URLEncodingOutputStreamTest.java
+++ b/utils/src/test/java/at/gv/egiz/bku/utils/URLEncodingOutputStreamTest.java
@@ -78,7 +78,7 @@ public class URLEncodingOutputStreamTest {
URLEncodingOutputStream urlEnc = new URLEncodingOutputStream(writer);
OutputStreamWriter streamWriter = new OutputStreamWriter(urlEnc, UTF_8);
streamWriter.append(buf);
- streamWriter.flush();
+ streamWriter.close();
out1 = writer.toString();
// URLEncoder
@@ -114,7 +114,7 @@ public class URLEncodingOutputStreamTest {
}
}
System.out.println("Time " + dt + "ms");
-
+ streamWriter.close();
}
@Ignore