mirror of https://github.com/apache/poi.git
bug 59858: describe why VBA macro reading failed
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1752778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
416641d986
commit
dee56fc6c0
src
java/org/apache/poi/poifs/macros
testcases/org/apache/poi/poifs/macros
|
@ -218,6 +218,10 @@ public class VBAMacroReader implements Closeable {
|
||||||
modules.put(name, module);
|
modules.put(name, module);
|
||||||
module.read(dis);
|
module.read(dis);
|
||||||
} else {
|
} else {
|
||||||
|
if (module.offset == null) {
|
||||||
|
//This should not happen. bug 59858
|
||||||
|
throw new IOException("Module offset for '" + name + "' was never read.");
|
||||||
|
}
|
||||||
// we know the offset already, so decompress immediately on-the-fly
|
// we know the offset already, so decompress immediately on-the-fly
|
||||||
long skippedBytes = dis.skip(module.offset);
|
long skippedBytes = dis.skip(module.offset);
|
||||||
if (skippedBytes != module.offset) {
|
if (skippedBytes != module.offset) {
|
||||||
|
|
|
@ -269,10 +269,15 @@ public class TestVBAMacroReader {
|
||||||
try {
|
try {
|
||||||
fromFile(POIDataSamples.getSpreadSheetInstance(), "59858.xls");
|
fromFile(POIDataSamples.getSpreadSheetInstance(), "59858.xls");
|
||||||
fail("This test passes now. Please update the unit test and bug 59858.");
|
fail("This test passes now. Please update the unit test and bug 59858.");
|
||||||
} catch (NullPointerException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
if (e.getMessage().matches("Module offset for '.+' was never read.")) {
|
||||||
|
//e.printStackTrace();
|
||||||
// NPE when reading module.offset in VBAMacroReader.readMacros (approx line 258)
|
// NPE when reading module.offset in VBAMacroReader.readMacros (approx line 258)
|
||||||
assumeTrue("This test currently fails with an NPE. See stdout.", false);
|
assumeTrue("This test currently fails. See stdout.", false);
|
||||||
|
} else {
|
||||||
|
// something unexpected failed
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue