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
This commit is contained in:
Nick Burch 2006-11-28 15:54:39 +00:00
parent 0230ab6fa3
commit f09b28bcd5
2 changed files with 20 additions and 6 deletions

View File

@ -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");
}

View File

@ -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);