From d5de2ed9a5cb22c64d3df28d818117bf7462e423 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 28 Nov 2006 15:54:39 +0000 Subject: [PATCH] Ditch a few calls to System.out, in favour of calls to POILogger git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@480102 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/POIDocument.java | 15 ++++++++++++--- .../org/apache/poi/hslf/usermodel/SlideShow.java | 11 ++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/POIDocument.java b/src/scratchpad/src/org/apache/poi/POIDocument.java index 7336b15d08..a679ffbb3f 100644 --- a/src/scratchpad/src/org/apache/poi/POIDocument.java +++ b/src/scratchpad/src/org/apache/poi/POIDocument.java @@ -27,6 +27,8 @@ import org.apache.poi.hpsf.PropertySetFactory; import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.util.POILogFactory; +import org.apache.poi.util.POILogger; /** * This holds the common functionality for all POI @@ -36,12 +38,17 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; * @author Nick Burch */ public abstract class POIDocument { - // Holds metadata on our document + /** Holds metadata on our document */ protected SummaryInformation sInf; + /** Holds further metadata on our document */ protected DocumentSummaryInformation dsInf; - + /** The open POIFS FileSystem that contains our document */ protected POIFSFileSystem filesystem; + /** For our own logging use */ + protected POILogger logger = POILogFactory.getLogger(this.getClass()); + + /** * Fetch the Document Summary Information of the document */ @@ -116,11 +123,13 @@ public abstract class POIDocument { try { MutablePropertySet mSet = new MutablePropertySet(set); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); + mSet.write(bOut); byte[] data = bOut.toByteArray(); ByteArrayInputStream bIn = new ByteArrayInputStream(data); outFS.createDocument(bIn,name); - System.out.println("Wrote property set " + name + " of size " + data.length); + + logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length); } catch(org.apache.poi.hpsf.WritingNotSupportedException wnse) { System.err.println("Couldn't write property set with name " + name + " as not supported by HPSF yet"); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java index 449ba5c012..0e91cc7ebf 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java @@ -46,6 +46,8 @@ import org.apache.poi.hslf.record.PersistPtrHolder; import org.apache.poi.hslf.record.PositionDependentRecord; import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException; import org.apache.poi.util.ArrayUtil; +import org.apache.poi.util.POILogFactory; +import org.apache.poi.util.POILogger; /** * This class is a friendly wrapper on top of the more scary HSLFSlideShow. @@ -85,6 +87,9 @@ public class SlideShow private Notes[] _notes; private FontCollection _fonts; + // For logging + private POILogger logger = POILogFactory.getLogger(this.getClass()); + /* =============================================================== * Setup Code @@ -336,7 +341,7 @@ public class SlideShow if(r instanceof org.apache.poi.hslf.record.Notes) { notesRecords[i] = (org.apache.poi.hslf.record.Notes)r; } else { - System.err.println("A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r); + logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r); } // Record the match between slide id and these notes @@ -584,7 +589,7 @@ public class SlideShow System.arraycopy(_slides, 0, s, 0, _slides.length); s[_slides.length] = slide; _slides = s; - System.out.println("Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier()); + logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier()); // Add the core records for this new Slide to the record tree org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord(); @@ -620,7 +625,7 @@ public class SlideShow // (Also need to tell it where it is) slideRecord.setLastOnDiskOffset(slideOffset); ptr.addSlideLookup(sp.getRefID(), slideOffset); - System.out.println("New slide ended up at " + slideOffset); + logger.log(POILogger.INFO, "New slide ended up at " + slideOffset); // Last view is now of the slide usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW); -- 2.39.5