Bug 47261 - SlideShow.removeSlide makes PPT corrupted
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1648458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26ae1edcd8
commit
de9699fcad
@ -175,6 +175,10 @@ public final class Document extends PositionDependentRecordContainer
|
||||
// The new SlideListWithText should go in
|
||||
// just before the EndDocumentRecord
|
||||
Record endDoc = _children[_children.length - 1];
|
||||
if(endDoc.getRecordType() == RecordTypes.RoundTripCustomTableStyles12Atom.typeID) {
|
||||
// last record can optionally be a RoundTripCustomTableStyles12Atom
|
||||
endDoc = _children[_children.length - 2];
|
||||
}
|
||||
if(endDoc.getRecordType() != RecordTypes.EndDocument.typeID) {
|
||||
throw new IllegalStateException("The last child record of a Document should be EndDocument, but it was " + endDoc);
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public final class RecordTypes {
|
||||
public static final Type NamedShow = new Type(1041,null);
|
||||
public static final Type NamedShowSlides = new Type(1042,null);
|
||||
public static final Type SheetProperties = new Type(1044,null);
|
||||
public static final Type RoundTripCustomTableStyles12Atom = new Type(1064,null);
|
||||
public static final Type List = new Type(2000,null);
|
||||
public static final Type FontCollection = new Type(2005,FontCollection.class);
|
||||
public static final Type BookmarkCollection = new Type(2019,null);
|
||||
|
@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -595,4 +596,18 @@ public final class TestBugs {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug47261() throws Exception {
|
||||
InputStream inputStream = new FileInputStream(_slTests.getFile("bug47261.ppt"));
|
||||
try {
|
||||
SlideShow slideShow = new SlideShow(inputStream);
|
||||
slideShow.removeSlide(0);
|
||||
slideShow.createSlide();
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
slideShow.write(bos);
|
||||
} finally {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
test-data/slideshow/bug47261.ppt
Normal file
BIN
test-data/slideshow/bug47261.ppt
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user