poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1578929 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
Date Tue, 18 Mar 2014 14:40:27 GMT
Author: nick
Date: Tue Mar 18 14:40:27 2014
New Revision: 1578929

URL: http://svn.apache.org/r1578929
Log:
Avoid an IndexOutOfBoundsException if there are no property nodes when searching for the start
index, return -1 instead

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java?rev=1578929&r1=1578928&r2=1578929&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java Tue Mar 18 14:40:27
2014
@@ -21,8 +21,6 @@ import java.lang.ref.WeakReference;
 import java.util.List;
 import java.util.NoSuchElementException;
 
-import org.apache.poi.util.Internal;
-
 import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.hwpf.HWPFDocumentCore;
 import org.apache.poi.hwpf.model.CHPX;
@@ -37,6 +35,7 @@ import org.apache.poi.hwpf.model.TextPie
 import org.apache.poi.hwpf.sprm.CharacterSprmCompressor;
 import org.apache.poi.hwpf.sprm.ParagraphSprmCompressor;
 import org.apache.poi.hwpf.sprm.SprmBuffer;
+import org.apache.poi.util.Internal;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
@@ -1013,6 +1012,8 @@ public class Range { // TODO -instantiab
     private static int binarySearchStart( List<? extends PropertyNode<?>> rpl,
             int start )
     {
+        if ( rpl.size() == 0 )
+            return -1;
         if ( rpl.get( 0 ).getStart() >= start )
             return 0;
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message