correctly hangle out-of-boundaries cases for bookmarks and fields in Word-to-* converters

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1150622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-25 10:40:02 +00:00
parent 8eb1775b90
commit 89012851da

View File

@ -318,7 +318,17 @@ public abstract class AbstractWordConverter
if ( previous != range.getStartOffset() ) if ( previous != range.getStartOffset() )
{ {
Range subrange = new Range( previous, range.getEndOffset(), range ) if ( previous > range.getEndOffset() )
{
logger.log( POILogger.WARN, "Latest structure in " + range
+ " ended after range (" + previous + ")" );
return true;
}
if ( previous < range.getEndOffset() )
{
Range subrange = new Range( previous, range.getEndOffset(),
range )
{ {
@Override @Override
public String toString() public String toString()
@ -327,6 +337,7 @@ public abstract class AbstractWordConverter
} }
}; };
processCharacters( document, currentTableLevel, subrange, block ); processCharacters( document, currentTableLevel, subrange, block );
}
return true; return true;
} }