update paragraph rebuilding for case when empty papx [n; n) happens at the end of file

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1160589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-08-23 09:07:30 +00:00
parent 93156c819e
commit 983ef6fd96
1 changed files with 7 additions and 0 deletions

View File

@ -208,10 +208,12 @@ public class PAPBinTable
final int startInclusive = lastParStart; final int startInclusive = lastParStart;
final int endExclusive = charIndex + 1; final int endExclusive = charIndex + 1;
boolean broken = false;
List<PAPX> papxs = new LinkedList<PAPX>(); List<PAPX> papxs = new LinkedList<PAPX>();
for ( int papxIndex = lastPapxIndex; papxIndex < oldPapxSortedByEndPos for ( int papxIndex = lastPapxIndex; papxIndex < oldPapxSortedByEndPos
.size(); papxIndex++ ) .size(); papxIndex++ )
{ {
broken = false;
PAPX papx = oldPapxSortedByEndPos.get( papxIndex ); PAPX papx = oldPapxSortedByEndPos.get( papxIndex );
assert startInclusive == 0 assert startInclusive == 0
@ -221,11 +223,16 @@ public class PAPBinTable
if ( papx.getEnd() - 1 > charIndex ) if ( papx.getEnd() - 1 > charIndex )
{ {
lastPapxIndex = papxIndex; lastPapxIndex = papxIndex;
broken = true;
break; break;
} }
papxs.add( papx ); papxs.add( papx );
} }
if ( !broken )
{
lastPapxIndex = oldPapxSortedByEndPos.size() - 1;
}
if ( papxs.size() == 0 ) if ( papxs.size() == 0 )
{ {