]> source.dussan.org Git - poi.git/commitdiff
more WARNs in log
authorSergey Vladimirov <sergey@apache.org>
Sun, 10 Jul 2011 12:56:36 +0000 (12:56 +0000)
committerSergey Vladimirov <sergey@apache.org>
Sun, 10 Jul 2011 12:56:36 +0000 (12:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144852 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java
src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java
src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java

index 93090d35aa2c19a7a1c3df861ab57eae7c266465..6fe191fb84324e03ebc91bda15455c62dd51f546 100644 (file)
@@ -21,6 +21,8 @@ import java.util.Collections;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 
 /**
  * This class holds all of the character formatting 
@@ -32,6 +34,9 @@ import org.apache.poi.util.LittleEndian;
  */
 public final class OldCHPBinTable extends CHPBinTable
 {
+    private static final POILogger logger = POILogFactory
+            .getLogger( OldCHPBinTable.class );
+
   /**
    * Constructor used to read an old-style binTable
    *  in from a Word document.
@@ -62,8 +67,14 @@ public final class OldCHPBinTable extends CHPBinTable
       for (int y = 0; y < fkpSize; y++)
       {
         CHPX chpx = cfkp.getCHPX(y);
-        if (chpx != null && tpt.isIndexInTable( chpx.getStartBytes(), chpx.getEndBytes() ))
+        if (chpx != null && tpt.isIndexInTable( chpx.getStartBytes(), chpx.getEndBytes() )) {
             _textRuns.add(chpx);
+        } else {
+                    logger.log( POILogger.WARN, "CHPX [",
+                            chpx.getStartBytes(), "; ", chpx.getEndBytes(),
+                            ") (bytes) doesn't have corresponding text pieces "
+                                    + "and will be skipped" );
+        }
       }
     }
     Collections.sort( _textRuns, PropertyNode.StartComparator.instance );
index 9771e5efc9fdc2b1f7a45c758ec013f20ee43fa3..0331b997e43569a86b022ce9b63a9ea7255ff6b9 100644 (file)
@@ -21,6 +21,8 @@ import java.util.Collections;
 
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 
 /**
  * This class holds all of the paragraph formatting 
@@ -32,6 +34,9 @@ import org.apache.poi.util.LittleEndian;
  */
 public final class OldPAPBinTable extends PAPBinTable
 {
+    private static final POILogger logger = POILogFactory
+            .getLogger( OldPAPBinTable.class );
+
   public OldPAPBinTable(byte[] documentStream, int offset,
                      int size, int fcMin, TextPieceTable tpt)
   {
@@ -53,8 +58,14 @@ public final class OldPAPBinTable extends PAPBinTable
       for (int y = 0; y < fkpSize; y++)
       {
        PAPX papx = pfkp.getPAPX(y);
-        if (papx != null && tpt.isIndexInTable( papx.getStartBytes(), papx.getEndBytes() ))
+        if (papx != null && tpt.isIndexInTable( papx.getStartBytes(), papx.getEndBytes() )) {
             _paragraphs.add(papx);
+        } else {
+            logger.log( POILogger.WARN, "PAPX [", papx.getStartBytes(),
+                    "; ", papx.getEndBytes(),
+                    ") (bytes) doesn't have corresponding text pieces "
+                            + "and will be skipped" );
+        }
       }
     }
     Collections.sort( _paragraphs, PropertyNode.StartComparator.instance );
index 2c212a6e33a0a02e50d3343524924f84f82cea48..95ea86a630fdda86114fcbfdd3b42c1bcf477893 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.poi.hwpf.model;
 import java.util.Collections;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 
 /**
  * This class holds all of the section formatting 
@@ -31,6 +33,9 @@ import org.apache.poi.util.LittleEndian;
  */
 public final class OldSectionTable extends SectionTable
 {
+    private static final POILogger logger = POILogFactory
+            .getLogger( OldSectionTable.class );
+    
   public OldSectionTable(byte[] documentStream, int offset,
                       int size, int fcMin,
                       TextPieceTable tpt)
@@ -69,8 +74,17 @@ public final class OldSectionTable extends SectionTable
         sepx = new SEPX(sed, startAt, endAt, charConv, buf);
       }
 
-      if (tpt.isIndexInTable( sepx.getStartBytes(), sepx.getEndBytes() ))
-        _sections.add(sepx);
+            if ( tpt.isIndexInTable( sepx.getStartBytes(), sepx.getEndBytes() ) )
+            {
+                _sections.add( sepx );
+            }
+            else
+            {
+                logger.log( POILogger.WARN, "Section [", sepx.getStartBytes(),
+                        "; ", sepx.getEndBytes(),
+                        ") (bytes) doesn't have corresponding text pieces "
+                                + "and will be skipped" );
+            }
     }
     Collections.sort( _sections, PropertyNode.StartComparator.instance );
   }