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:
parent
0230ab6fa3
commit
f09b28bcd5
@ -27,6 +27,8 @@ import org.apache.poi.hpsf.PropertySetFactory;
|
|||||||
import org.apache.poi.hpsf.SummaryInformation;
|
import org.apache.poi.hpsf.SummaryInformation;
|
||||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
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
|
* This holds the common functionality for all POI
|
||||||
@ -36,12 +38,17 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
|||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
*/
|
*/
|
||||||
public abstract class POIDocument {
|
public abstract class POIDocument {
|
||||||
// Holds metadata on our document
|
/** Holds metadata on our document */
|
||||||
protected SummaryInformation sInf;
|
protected SummaryInformation sInf;
|
||||||
|
/** Holds further metadata on our document */
|
||||||
protected DocumentSummaryInformation dsInf;
|
protected DocumentSummaryInformation dsInf;
|
||||||
|
/** The open POIFS FileSystem that contains our document */
|
||||||
protected POIFSFileSystem filesystem;
|
protected POIFSFileSystem filesystem;
|
||||||
|
|
||||||
|
/** For our own logging use */
|
||||||
|
protected POILogger logger = POILogFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the Document Summary Information of the document
|
* Fetch the Document Summary Information of the document
|
||||||
*/
|
*/
|
||||||
@ -116,11 +123,13 @@ public abstract class POIDocument {
|
|||||||
try {
|
try {
|
||||||
MutablePropertySet mSet = new MutablePropertySet(set);
|
MutablePropertySet mSet = new MutablePropertySet(set);
|
||||||
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
|
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
|
||||||
|
|
||||||
mSet.write(bOut);
|
mSet.write(bOut);
|
||||||
byte[] data = bOut.toByteArray();
|
byte[] data = bOut.toByteArray();
|
||||||
ByteArrayInputStream bIn = new ByteArrayInputStream(data);
|
ByteArrayInputStream bIn = new ByteArrayInputStream(data);
|
||||||
outFS.createDocument(bIn,name);
|
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) {
|
} catch(org.apache.poi.hpsf.WritingNotSupportedException wnse) {
|
||||||
System.err.println("Couldn't write property set with name " + name + " as not supported by HPSF yet");
|
System.err.println("Couldn't write property set with name " + name + " as not supported by HPSF yet");
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ import org.apache.poi.hslf.record.PersistPtrHolder;
|
|||||||
import org.apache.poi.hslf.record.PositionDependentRecord;
|
import org.apache.poi.hslf.record.PositionDependentRecord;
|
||||||
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
|
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
|
||||||
import org.apache.poi.util.ArrayUtil;
|
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.
|
* This class is a friendly wrapper on top of the more scary HSLFSlideShow.
|
||||||
@ -85,6 +87,9 @@ public class SlideShow
|
|||||||
private Notes[] _notes;
|
private Notes[] _notes;
|
||||||
private FontCollection _fonts;
|
private FontCollection _fonts;
|
||||||
|
|
||||||
|
// For logging
|
||||||
|
private POILogger logger = POILogFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
* Setup Code
|
* Setup Code
|
||||||
@ -336,7 +341,7 @@ public class SlideShow
|
|||||||
if(r instanceof org.apache.poi.hslf.record.Notes) {
|
if(r instanceof org.apache.poi.hslf.record.Notes) {
|
||||||
notesRecords[i] = (org.apache.poi.hslf.record.Notes)r;
|
notesRecords[i] = (org.apache.poi.hslf.record.Notes)r;
|
||||||
} else {
|
} 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
|
// Record the match between slide id and these notes
|
||||||
@ -584,7 +589,7 @@ public class SlideShow
|
|||||||
System.arraycopy(_slides, 0, s, 0, _slides.length);
|
System.arraycopy(_slides, 0, s, 0, _slides.length);
|
||||||
s[_slides.length] = slide;
|
s[_slides.length] = slide;
|
||||||
_slides = s;
|
_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
|
// Add the core records for this new Slide to the record tree
|
||||||
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
|
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
|
||||||
@ -620,7 +625,7 @@ public class SlideShow
|
|||||||
// (Also need to tell it where it is)
|
// (Also need to tell it where it is)
|
||||||
slideRecord.setLastOnDiskOffset(slideOffset);
|
slideRecord.setLastOnDiskOffset(slideOffset);
|
||||||
ptr.addSlideLookup(sp.getRefID(), 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
|
// Last view is now of the slide
|
||||||
usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW);
|
usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW);
|
||||||
|
Loading…
Reference in New Issue
Block a user