]> source.dussan.org Git - poi.git/commitdiff
use POILogger instead of System.err in hslf records. If users want verbose output...
authorYegor Kozlov <yegor@apache.org>
Thu, 12 Apr 2007 07:40:15 +0000 (07:40 +0000)
committerYegor Kozlov <yegor@apache.org>
Thu, 12 Apr 2007 07:40:15 +0000 (07:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@527820 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/Document.java
src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
src/scratchpad/src/org/apache/poi/hslf/record/Record.java
src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java

index cbbb2f90e93fce40e76a678baa526b2eb3919176..f6252840ccd40040f7e74f13baa3069e97b12d55 100644 (file)
@@ -19,6 +19,8 @@
 
 package org.apache.poi.hslf.record;
 
+import org.apache.poi.util.POILogger;
+
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -132,10 +134,10 @@ public class Document extends PositionDependentRecordContainer
                //  (normally it's 2, or 3 if you have notes)
                // Complain if it's not
                if(slwtcount == 0) {
-                       System.err.println("No SlideListWithText's found - there should normally be at least one!");
+                       logger.log(POILogger.WARN, "No SlideListWithText's found - there should normally be at least one!");
                }
                if(slwtcount > 3) {
-                       System.err.println("Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
+                       logger.log(POILogger.WARN, "Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
                }
                
                // Now grab all the SLWTs
index be096a6409dac189f509ba0203e5cfaaacda2975..a89422a1e366569d9d36da1d57b5f7082fc79d93 100644 (file)
@@ -19,6 +19,8 @@
 package org.apache.poi.hslf.record;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
 import java.io.*;
 import java.util.*;
 
@@ -47,7 +49,7 @@ public class FontCollection extends RecordContainer {
                    FontEntityAtom atom = (FontEntityAtom)_children[i];
                    fonts.add(atom.getFontName());
                        } else {
-                               System.err.println("Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
+                               logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
                        }
                }
        }
index b8857f4adae89c9260e9c6988bc761858cb0957d..e34e9d841ffc117b8c0fa0c9c4f3c63a88cfc8e6 100644 (file)
@@ -20,6 +20,7 @@
 package org.apache.poi.hslf.record;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.model.ShapeTypes;
@@ -128,7 +129,7 @@ public class PPDrawing extends RecordAtom
                // Wind on
                int size = r.getRecordSize();
                if(size < 8) {
-                       System.err.println("Hit short DDF record at " + startPos + " - " + size);
+                       logger.log(POILogger.WARN, "Hit short DDF record at " + startPos + " - " + size);
                }
                startPos += size;
                lenToGo -= size;
index 95cd1b69888f6007e3742c098dcf46f513f418d9..68b8b7cafee2fb6394dc42cfb58e4832d6c5e2ac 100644 (file)
@@ -20,6 +20,8 @@
 package org.apache.poi.hslf.record;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Enumeration;
@@ -193,8 +195,8 @@ public class PersistPtrHolder extends PositionDependentRecordAtom
                        Integer newPos = (Integer)oldToNewReferencesLookup.get(oldPos);
 
                        if(newPos == null) {
-                               System.err.println("Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
-                               System.err.println("Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
+                               logger.log(POILogger.WARN, "Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
+                               logger.log(POILogger.WARN, "Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
                                newPos = oldPos;
                        }
 
index 7094d3db318998076dc46f58aeecd9c7e034bf42..79d08ea65ea8e8ba4e9703b24304ce0349515c53 100644 (file)
@@ -24,6 +24,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Vector;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.util.POILogFactory;
 import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 
 
@@ -37,7 +39,10 @@ import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 
 public abstract class Record
 {
-       /** 
+    // For logging
+    protected POILogger logger = POILogFactory.getLogger(this.getClass());
+
+       /**
         * Is this record type an Atom record (only has data),
         *  or is it a non-Atom record (has other records)?
         */
index 1c7859903055f9875fae33949994044bdda3d5b8..41fbb698b61b5ff4990a9b9721f7d5e0c5431a6e 100644 (file)
@@ -25,6 +25,8 @@ import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
 import org.apache.poi.hslf.model.textproperties.TextProp;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.ByteArrayOutputStream;
@@ -265,7 +267,7 @@ public class StyleTextPropAtom extends RecordAtom
 
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            System.err.println("Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+            logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
         }
 
                // Now do the character stylings
@@ -300,7 +302,7 @@ public class StyleTextPropAtom extends RecordAtom
                        }
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            System.err.println("Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+            logger.log(POILogger.WARN, "Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
         }
 
                // Handle anything left over