poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1145281 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
Date Mon, 11 Jul 2011 18:39:18 GMT
Author: sergey
Date: Mon Jul 11 18:39:18 2011
New Revision: 1145281

URL: http://svn.apache.org/viewvc?rev=1145281&view=rev
Log:
ignore PAPX references zero-length text pieces

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java?rev=1145281&r1=1145280&r2=1145281&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java Mon Jul
11 18:39:18 2011
@@ -82,20 +82,32 @@ public final class PAPFormattedDiskPage 
         {
             int startAt = getStart( x );
             int endAt = getEnd( x );
-            if ( !ignorePapxWithoutTextPieces
-                    || tpt.isIndexInTable( startAt, endAt ) )
-                _papxList.add( new PAPX( startAt, endAt, tpt, getGrpprl( x ),
-                        getParagraphHeight( x ), dataStream ) );
-            else
+
+            if ( ignorePapxWithoutTextPieces
+                    && !tpt.isIndexInTable( startAt, endAt ) )
             {
                 logger.log( POILogger.WARN, "PAPX [",
                         Integer.valueOf( startAt ), "; ",
                         Integer.valueOf( endAt ),
                         ") (bytes) doesn't have corresponding text pieces "
                                 + "and will be skipped" );
+                _papxList.add( null );
+                continue;
+            }
 
+            PAPX papx = new PAPX( startAt, endAt, tpt, getGrpprl( x ),
+                    getParagraphHeight( x ), dataStream );
+
+            if ( ignorePapxWithoutTextPieces
+                    && papx.getStart() == papx.getEnd() )
+            {
+                logger.log( POILogger.WARN, papx
+                        + " references zero-length range and will be skipped" );
                 _papxList.add( null );
+                continue;
             }
+
+            _papxList.add( papx );
         }
         _fkp = null;
         _dataStream = dataStream;



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


Mime
View raw message