]> source.dussan.org Git - poi.git/commitdiff
fix 51944 - PAPFormattedDiskPage.getPAPX - IndexOutOfBounds
authorSergey Vladimirov <sergey@apache.org>
Sun, 30 Oct 2011 00:04:38 +0000 (00:04 +0000)
committerSergey Vladimirov <sergey@apache.org>
Sun, 30 Oct 2011 00:04:38 +0000 (00:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1195079 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java
src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
test-data/document/Bug51944.doc [new file with mode: 0644]

index bd1d4d89268bbff2ef7576cdab37307cd86d3761..0ff1959b25b259b0402eb630d2dcb82aba5e16e8 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta5" date="2011-??-??">
+           <action dev="poi-developers" type="fix">51944 - PAPFormattedDiskPage.getPAPX - IndexOutOfBounds</action>
            <action dev="poi-developers" type="fix">52032 - HWPF - ArrayIndexOutofBoundsException with no stack trace (broken after revision 1178063)</action>
            <action dev="poi-developers" type="add">support for converting pptx files into images with a PPTX2PNG tool</action>
            <action dev="poi-developers" type="add">52050 - Support for the Excel RATE function</action>
index 4b9038d4f713a0891c3be308060034ec414e5dd5..bc3f4869bce5fccb65d95756e5b94be87f3f0476 100644 (file)
@@ -59,14 +59,11 @@ public final class OldCHPBinTable extends CHPBinTable
       CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream,
         pageOffset, tpt);
 
-      int fkpSize = cfkp.size();
-
-      for (int y = 0; y < fkpSize; y++)
-      {
-        CHPX chpx = cfkp.getCHPX(y);
-        if (chpx != null)
-            _textRuns.add(chpx);
-      }
+            for ( CHPX chpx : cfkp.getCHPXs() )
+            {
+                if ( chpx != null )
+                    _textRuns.add( chpx );
+            }
     }
     Collections.sort( _textRuns, PropertyNode.StartComparator.instance );
   }
index 658e6671564fc87d73f132b1c934f7b6349ca8ea..0a4ae67ae8aba46b2a0d8e88831233c95bb457b5 100644 (file)
@@ -51,15 +51,11 @@ public final class OldPAPBinTable extends PAPBinTable
       PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(documentStream,
         documentStream, pageOffset, tpt);
 
-      int fkpSize = pfkp.size();
-
-      for (int y = 0; y < fkpSize; y++)
-      {
-       PAPX papx = pfkp.getPAPX(y);
-        if (papx != null) {
-            _paragraphs.add(papx);
-        }
-      }
+            for ( PAPX papx : pfkp.getPAPXs() )
+            {
+                if ( papx != null )
+                    _paragraphs.add( papx );
+            }
     }
     Collections.sort( _paragraphs, PropertyNode.StartComparator.instance );
   }
index bc243cdbb276b2703038e75b79146d4aadaf0b53..593bd8419d41548731ed4088049bf4fa1ad5197a 100644 (file)
@@ -720,6 +720,14 @@ public class TestBugs extends TestCase
                 .openSampleFile( "Bug51834.doc" ) );
     }
 
+    /**
+     * Bug 51944 - PAPFormattedDiskPage.getPAPX - IndexOutOfBounds
+     */
+    public void testBug51944() throws Exception
+    {
+        HWPFTestDataSamples.openOldSampleFile( "Bug51944.doc" );
+    }
+
     /**
      * Bug 52032 - [BUG] & [partial-PATCH] HWPF - ArrayIndexOutofBoundsException
      * with no stack trace (broken after revision 1178063)
diff --git a/test-data/document/Bug51944.doc b/test-data/document/Bug51944.doc
new file mode 100644 (file)
index 0000000..2598dc1
Binary files /dev/null and b/test-data/document/Bug51944.doc differ