findbugs: DocumentInputStream.skip(long) result not checked; close DocumentInputStream even if exception is thrown
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751020 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6645d8a80f
commit
d7900beec3
@ -198,6 +198,7 @@ public class VBAMacroReader implements Closeable {
|
||||
String name = entry.getName();
|
||||
DocumentNode document = (DocumentNode)entry;
|
||||
DocumentInputStream dis = new DocumentInputStream(document);
|
||||
try {
|
||||
if ("dir".equalsIgnoreCase(name)) {
|
||||
// process DIR
|
||||
RLEDecompressingInputStream in = new RLEDecompressingInputStream(dis);
|
||||
@ -255,7 +256,10 @@ public class VBAMacroReader implements Closeable {
|
||||
in = dis;
|
||||
} else {
|
||||
// we know the offset already, so decompress immediately on-the-fly
|
||||
dis.skip(module.offset);
|
||||
long skippedBytes = dis.skip(module.offset);
|
||||
if (skippedBytes != module.offset) {
|
||||
throw new IOException("tried to skip " + module.offset + " bytes, but actually skipped " + skippedBytes + " bytes");
|
||||
}
|
||||
in = new RLEDecompressingInputStream(dis);
|
||||
}
|
||||
final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
@ -265,5 +269,9 @@ public class VBAMacroReader implements Closeable {
|
||||
module.buf = out.toByteArray();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
dis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user