Bug 56240 - Handle PP97_DUALSTORAGE streams
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1648466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
de9699fcad
commit
b2a69b6152
@ -173,9 +173,8 @@ public final class HSLFSlideShow extends POIDocument {
|
||||
* @param dir the POIFS directory to read from
|
||||
* @throws IOException if there is a problem while parsing the document.
|
||||
*/
|
||||
public HSLFSlideShow(DirectoryNode dir) throws IOException
|
||||
{
|
||||
super(dir);
|
||||
public HSLFSlideShow(DirectoryNode dir) throws IOException {
|
||||
super(handleDualStorage(dir));
|
||||
|
||||
// First up, grab the "Current User" stream
|
||||
// We need this before we can detect Encrypted Documents
|
||||
@ -192,7 +191,13 @@ public final class HSLFSlideShow extends POIDocument {
|
||||
readOtherStreams();
|
||||
}
|
||||
|
||||
|
||||
private static DirectoryNode handleDualStorage(DirectoryNode dir) throws IOException {
|
||||
// when there's a dual storage entry, use it, as the outer document can't be read quite probably ...
|
||||
String dualName = "PP97_DUALSTORAGE";
|
||||
if (!dir.hasEntry(dualName)) return dir;
|
||||
dir = (DirectoryNode)dir.getEntry(dualName);
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty, Powerpoint document.
|
||||
|
@ -610,4 +610,19 @@ public final class TestBugs {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug56240() throws Exception {
|
||||
InputStream inputStream = new FileInputStream(_slTests.getFile("bug56240.ppt"));
|
||||
try {
|
||||
SlideShow slideShow = new SlideShow(inputStream);
|
||||
int slideCnt = slideShow.getSlides().length;
|
||||
assertEquals(105, slideCnt);
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
slideShow.write(bos);
|
||||
bos.close();
|
||||
} finally {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
test-data/slideshow/bug56240.ppt
Normal file
BIN
test-data/slideshow/bug56240.ppt
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user