From: Sergey Vladimirov Date: Tue, 12 Jul 2011 09:09:05 +0000 (+0000) Subject: for test cases: do not reconstruct binary tables for read-write tests X-Git-Tag: REL_3_8_BETA4~194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c8bb9f4d4d15cdc5163130a04b7fec0e2e1457f;p=poi.git for test cases: do not reconstruct binary tables for read-write tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145499 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java index ae1b9736ba..05e685ad5a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java @@ -74,7 +74,7 @@ public class CHPBinTable */ public CHPBinTable( byte[] documentStream, byte[] tableStream, int offset, int size, ComplexFileTable complexFileTable, TextPieceTable tpt, - boolean ignoreChpxWithoutTextPieces ) + boolean reconstructChpxTable ) { /* * Page 35: @@ -96,7 +96,7 @@ public class CHPBinTable int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum; CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream, - pageOffset, tpt, ignoreChpxWithoutTextPieces); + pageOffset, tpt, reconstructChpxTable); int fkpSize = cfkp.size(); @@ -108,6 +108,12 @@ public class CHPBinTable } } + if ( !reconstructChpxTable ) + { + Collections.sort( _textRuns ); + return; + } + if ( complexFileTable != null ) { SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java index 7627b2e0b4..4aaa8e2268 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java @@ -20,6 +20,7 @@ package org.apache.poi.hwpf.model; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -69,7 +70,7 @@ public class PAPBinTable public PAPBinTable( byte[] documentStream, byte[] tableStream, byte[] dataStream, int offset, int size, ComplexFileTable complexFileTable, - TextPieceTable tpt, boolean ignorePapxWithoutTextPieces ) + TextPieceTable tpt, boolean reconstructPapxTable ) { PlexOfCps binTable = new PlexOfCps(tableStream, offset, size, 4); this.tpt = tpt; @@ -83,7 +84,7 @@ public class PAPBinTable int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum; PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(documentStream, - dataStream, pageOffset, tpt, ignorePapxWithoutTextPieces); + dataStream, pageOffset, tpt, reconstructPapxTable); int fkpSize = pfkp.size(); @@ -96,6 +97,12 @@ public class PAPBinTable } } + if ( !reconstructPapxTable ) + { + Collections.sort( _paragraphs ); + return; + } + if ( complexFileTable != null ) { SprmBuffer[] sprmBuffers = complexFileTable.getGrpprls();