From 83c757f1cb17fee0386dd9ace3b61d2554847028 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Tue, 12 Jul 2011 09:09:05 +0000 Subject: [PATCH] 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 --- .../src/org/apache/poi/hwpf/model/CHPBinTable.java | 10 ++++++++-- .../src/org/apache/poi/hwpf/model/PAPBinTable.java | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) 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 ae1b9736b..05e685ad5 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 7627b2e0b..4aaa8e226 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();