You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ye...@apache.org on 2007/04/12 09:40:17 UTC
svn commit: r527820 - in
/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record:
Document.java FontCollection.java PPDrawing.java PersistPtrHolder.java
Record.java StyleTextPropAtom.java
Author: yegor
Date: Thu Apr 12 00:40:15 2007
New Revision: 527820
URL: http://svn.apache.org/viewvc?view=rev&rev=527820
Log:
use POILogger instead of System.err in hslf records. If users want verbose output they should explicitly enable it through -Dorg.apache.poi.util.POILogger option. P.S. I think this should be done through the whole HSLF, i.e. no direct calls of System.out and Sysrtem.err
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java Thu Apr 12 00:40:15 2007
@@ -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 @@
// (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
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java Thu Apr 12 00:40:15 2007
@@ -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 @@
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]);
}
}
}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java Thu Apr 12 00:40:15 2007
@@ -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 @@
// 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;
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java Thu Apr 12 00:40:15 2007
@@ -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 @@
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;
}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Record.java Thu Apr 12 00:40:15 2007
@@ -24,6 +24,8 @@
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 @@
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)?
*/
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java?view=diff&rev=527820&r1=527819&r2=527820
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java Thu Apr 12 00:40:15 2007
@@ -25,6 +25,8 @@
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 @@
}
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 @@
}
}
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
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/