diff options
author | Andreas Sewe | 2016-08-19 14:06:28 +0000 |
---|---|---|
committer | Andreas Sewe | 2016-08-19 14:24:07 +0000 |
commit | eddd793e2f23907996725b67ed03025ea72a5821 (patch) | |
tree | 97a6c7c5759128ae175a44564c8f4a5069234fd5 | |
parent | 8885f588d4e1ca5b80f9f596d2e24177c4e1d2bb (diff) | |
download | rt.equinox.framework-eddd793e2f23907996725b67ed03025ea72a5821.tar.gz rt.equinox.framework-eddd793e2f23907996725b67ed03025ea72a5821.tar.xz rt.equinox.framework-eddd793e2f23907996725b67ed03025ea72a5821.zip |
Bug 499971 - Enrich IOExceptions thrown by ZipBundleEntryInputStreamY20160825-1000I20160830-0800I20160824-1429I20160823-1359I20160823-0759
To aid debugging, this wraps any IOExceptions (e.g., ZIPExceptions)
thrown by the underlying (Zip)InputStream in IOExceptions indicating
which file is broken.
Change-Id: I21d447b3aafa36b3d83a1f22bcc2fe776d6f9737
Signed-off-by: Andreas Sewe <andreas.sewe@codetrails.com>
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleEntry.java | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleEntry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleEntry.java index 2c8671a4d..75f7f1a92 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleEntry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleEntry.java @@ -115,21 +115,27 @@ public class ZipBundleEntry extends BundleEntry { return null; } - private class ZipBundleEntryInputStream extends InputStream { - private final InputStream stream; + private class ZipBundleEntryInputStream extends FilterInputStream { + private boolean closed = false; public ZipBundleEntryInputStream(InputStream stream) { - this.stream = stream; + super(stream); } public int available() throws IOException { - return stream.available(); + try { + return super.available(); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } } public void close() throws IOException { try { - stream.close(); + super.close(); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); } finally { synchronized (this) { if (closed) @@ -140,32 +146,48 @@ public class ZipBundleEntry extends BundleEntry { } } - public void mark(int var0) { - stream.mark(var0); - } - - public boolean markSupported() { - return stream.markSupported(); - } - public int read() throws IOException { - return stream.read(); + try { + return super.read(); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } } public int read(byte[] var0, int var1, int var2) throws IOException { - return stream.read(var0, var1, var2); + try { + return super.read(var0, var1, var2); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } } public int read(byte[] var0) throws IOException { - return stream.read(var0); + try { + return super.read(var0); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } } public void reset() throws IOException { - stream.reset(); + try { + super.reset(); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } } public long skip(long var0) throws IOException { - return stream.skip(var0); + try { + return super.skip(var0); + } catch (IOException e) { + throw enrichExceptionWithBaseFile(e); + } + } + + private IOException enrichExceptionWithBaseFile(IOException e) { + return new IOException(bundleFile.getBaseFile().toString(), e); } } } |