Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-06-13 09:46:36 -0400
committerThomas Watson2011-06-13 09:46:36 -0400
commitf76cc33b27f25dd63336c3151fe8876cec3fdff9 (patch)
treed0387bb79a0764f76d2906b75611617e4e4062b6
parente2171752cd585cf13e7539c1df2d998e1893251b (diff)
downloadrt.equinox.framework-f76cc33b27f25dd63336c3151fe8876cec3fdff9.tar.gz
rt.equinox.framework-f76cc33b27f25dd63336c3151fe8876cec3fdff9.tar.xz
rt.equinox.framework-f76cc33b27f25dd63336c3151fe8876cec3fdff9.zip
Bug 349121 - SignatureBlockProcessor.readIntoArray(BundleEntry) does not close input stream
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
index 30f43f882..2a937ffca 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2011 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -467,12 +467,16 @@ public class SignatureBlockProcessor implements SignedContentConstants {
private static byte[] readIntoArray(BundleEntry be) throws IOException {
int size = (int) be.getSize();
InputStream is = be.getInputStream();
- byte b[] = new byte[size];
- int rc = readFully(is, b);
- if (rc != size) {
- throw new IOException("Couldn't read all of " + be.getName() + ": " + rc + " != " + size); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ try {
+ byte b[] = new byte[size];
+ int rc = readFully(is, b);
+ if (rc != size) {
+ throw new IOException("Couldn't read all of " + be.getName() + ": " + rc + " != " + size); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return b;
+ } finally {
+ is.close();
}
- return b;
}
private static int readFully(InputStream is, byte b[]) throws IOException {

Back to the top