From f63f2bdbc3d06b4a349ace8c815f4a51d92e3d1a Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Mon, 25 Jul 2011 10:40:02 +0000 Subject: [PATCH] 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 --- .../hwpf/converter/AbstractWordConverter.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java index de3b6c75c8..013954241c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java @@ -318,15 +318,26 @@ public abstract class AbstractWordConverter if ( previous != range.getStartOffset() ) { - Range subrange = new Range( previous, range.getEndOffset(), range ) + if ( previous > range.getEndOffset() ) { - @Override - public String toString() + 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 ) { - return "AfterStructureSubrange " + super.toString(); - } - }; - processCharacters( document, currentTableLevel, subrange, block ); + @Override + public String toString() + { + return "AfterStructureSubrange " + super.toString(); + } + }; + processCharacters( document, currentTableLevel, subrange, block ); + } return true; } -- 2.39.5