You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ni...@apache.org on 2006/11/28 16:54:40 UTC

svn commit: r480102 - in /jakarta/poi/trunk/src/scratchpad/src/org/apache/poi: POIDocument.java hslf/usermodel/SlideShow.java

Author: nick
Date: Tue Nov 28 07:54:39 2006
New Revision: 480102

URL: http://svn.apache.org/viewvc?view=rev&rev=480102
Log:
Ditch a few calls to System.out, in favour of calls to POILogger

Modified:
    jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/POIDocument.java
    jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java

Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/POIDocument.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/POIDocument.java?view=diff&rev=480102&r1=480101&r2=480102
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/POIDocument.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/POIDocument.java Tue Nov 28 07:54:39 2006
@@ -27,6 +27,8 @@
 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 @@
  * @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 @@
 		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");
 		}

Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java?view=diff&rev=480102&r1=480101&r2=480102
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java Tue Nov 28 07:54:39 2006
@@ -46,6 +46,8 @@
 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 @@
   private Notes[] _notes;
   private FontCollection _fonts;
 
+  // For logging
+  private POILogger logger = POILogFactory.getLogger(this.getClass());
+
   
   /* ===============================================================
    *                       Setup Code
@@ -336,7 +341,7 @@
 			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 @@
   		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 @@
   		// (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);



---------------------------------------------------------------------
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/