]> source.dussan.org Git - poi.git/commitdiff
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-63924...
authorNick Burch <nick@apache.org>
Mon, 14 Apr 2008 15:11:54 +0000 (15:11 +0000)
committerNick Burch <nick@apache.org>
Mon, 14 Apr 2008 15:11:54 +0000 (15:11 +0000)
https://svn.apache.org:443/repos/asf/poi/trunk

........
  r647824 | yegor | 2008-04-14 15:58:18 +0100 (Mon, 14 Apr 2008) | 1 line

  make sure all hslf classes use POI loggers
........

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@647834 13f79535-47bb-0310-9956-ffa450edef68

22 files changed:
src/java/org/apache/poi/ddf/UnknownEscherRecord.java
src/java/org/apache/poi/hssf/dev/BiffViewer.java
src/java/org/apache/poi/hssf/model/TextboxShape.java
src/java/org/apache/poi/hssf/record/TextObjectRecord.java
src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
src/scratchpad/src/org/apache/poi/hslf/model/Picture.java
src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
src/scratchpad/src/org/apache/poi/hslf/record/Document.java
src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java
src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
src/scratchpad/src/org/apache/poi/hslf/record/Record.java
src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java

index 9d8ceb316728c376a205c90c8f58ddbde837c137..cc7ee0457bc1aca80ac4f04ffd4ee5213275790c 100644 (file)
@@ -170,7 +170,7 @@ public class UnknownEscherRecord extends EscherRecord
         {
             if (thedata.length != 0)
             {
-                theDumpHex = "  Extra Data:" + nl;
+                theDumpHex = "  Extra Data("+thedata.length+"):" + nl;
                 theDumpHex += HexDump.dump(thedata, 0, 0);
             }
         }
index 242a85f45f8e4bf1275d8ceb8a444be51ce41e60..8263d1b9b9c64cc530e6ec82bf0e720d6cde2d24 100644 (file)
@@ -122,7 +122,7 @@ public class BiffViewer {
 
     private static void dumpNormal(Record record, int startloc, short rectype, short recsize)
     {
-        System.out.println("Offset 0x" + Integer.toHexString(startloc) + " (" + startloc + ")");
+        //System.out.println("Offset 0x" + Integer.toHexString(startloc) + " (" + startloc + ")");
         System.out.println( "recordid = 0x" + Integer.toHexString( rectype ) + ", size = " + recsize );
         System.out.println( record.toString() );
 
index e55fcacbc378e4a15c12ff5b3e444dd4a06d6b21..b1d3370fbf0d5e94fa9b82e4717fbd646b800ed2 100644 (file)
@@ -103,6 +103,11 @@ public class TextboxShape
         opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.TEXT__TEXTRIGHT, shape.getMarginRight() ) );
         opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.TEXT__TEXTBOTTOM, shape.getMarginBottom() ) );
         opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.TEXT__TEXTTOP, shape.getMarginTop() ) );
+
+        opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.TEXT__WRAPTEXT, 0 ) );
+        opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.TEXT__ANCHORTEXT, 0 ) );
+        opt.addEscherProperty( new EscherSimpleProperty( EscherProperties.GROUPSHAPE__PRINT, 0x00080000 ) );
+
         addStandardOptions( shape, opt );
         HSSFAnchor userAnchor = shape.getAnchor();
         //        if (userAnchor.isHorizontallyFlipped())
index c8f6669b0f2ec9e1ac4938aaa678a4c0e4c5a23e..5201a7292b926cfc16c94c9f2df7a608b75f9e1c 100644 (file)
@@ -248,6 +248,10 @@ public class TextObjectRecord
 
         buffer.append( "    .string = " ).append(str).append('\n');
 
+        for (int i = 0; i < str.numFormattingRuns(); i++) {
+            buffer.append( "    .textrun = " ).append(str.getFontOfFormattingRun(i)).append('\n');
+
+        }
         buffer.append( "[/TXO]\n" );
         return buffer.toString();
     }
index 00fc374fccc82d88bfa6bb322c9e80d3eb49f840..29f01b31549c6abef090f8131288af1f96984f76 100644 (file)
@@ -52,8 +52,7 @@ import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.poi.util.POILogger;
 
 /**
  * This class contains the main functionality for the Powerpoint file 
@@ -65,7 +64,7 @@ import org.apache.commons.logging.LogFactory;
 public class HSLFSlideShow extends POIDocument
 {
     // For logging
-    private static final Log logger = LogFactory.getLog(HSLFSlideShow.class);
+    private POILogger logger = POILogFactory.getLogger(this.getClass());
 
        private InputStream istream;
 
@@ -291,7 +290,7 @@ public class HSLFSlideShow extends POIDocument
                try {
                        currentUser = new CurrentUserAtom(directory);
                } catch(IOException ie) {
-                       logger.error("Error finding Current User Atom:\n" + ie);
+                       logger.log(POILogger.ERROR, "Error finding Current User Atom:\n" + ie);
                        currentUser = new CurrentUserAtom();
                }
        }
@@ -346,8 +345,8 @@ public class HSLFSlideShow extends POIDocument
 
                        // If they type (including the bonus 0xF018) is 0, skip it
                        if(type == 0) {
-                               logger.error("Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
-                               logger.error("" + pos);
+                               logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
+                               logger.log(POILogger.ERROR, "" + pos);
                        } else {
                    // Copy the data, ready to pass to PictureData
                    byte[] imgdata = new byte[imgsize];
@@ -362,7 +361,7 @@ public class HSLFSlideShow extends POIDocument
                                        pict.setOffset(offset);
                                        p.add(pict);
                                } catch(IllegalArgumentException e) {
-                                       logger.error("Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
+                                       logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
                                }
                        }
             
index 436b5188f3d57ae6fd0c493bc3949e7508ed77a3..c4df7b6779bd4ebc23806d3ae2989190a8f974f8 100644 (file)
@@ -23,8 +23,8 @@ import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.exceptions.HSLFException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.util.POILogFactory;
 
 import java.awt.*;
 import java.util.*;
@@ -36,7 +36,7 @@ import java.util.*;
  */
 public class Fill {
     // For logging
-    protected Log log = LogFactory.getLog(this.getClass());
+    protected POILogger logger = POILogFactory.getLogger(this.getClass());
 
     /**
      *  Fill with a solid color
@@ -213,7 +213,7 @@ public class Fill {
         java.util.List lst = bstore.getChildRecords();
         int idx = p.getPropertyValue();
         if (idx == 0){
-            log.error("no reference to picture data found ");
+            logger.log(POILogger.WARN, "no reference to picture data found ");
         } else {
             EscherBSERecord bse = (EscherBSERecord)lst.get(idx - 1);
             for ( int i = 0; i < pict.length; i++ ) {
index 502363346388f51509aec39e0f5725467706f816..e34d651b3da67bcd37d10271b404a13ac73f506d 100755 (executable)
@@ -18,6 +18,7 @@ package org.apache.poi.hslf.model;
 \r
 import org.apache.poi.ddf.*;\r
 import org.apache.poi.util.LittleEndian;\r
+import org.apache.poi.util.POILogger;\r
 \r
 import java.awt.geom.*;\r
 import java.util.ArrayList;\r
@@ -96,7 +97,7 @@ public class Freeform extends AutoShape {
                     segInfo.add(new byte[]{0x01, 0x20 });\r
                     break;\r
                 case PathIterator.SEG_QUADTO:\r
-                    System.err.println("SEG_QUADTO is not supported");\r
+                    logger.log(POILogger.WARN, "SEG_QUADTO is not supported");\r
                     break;\r
                 case PathIterator.SEG_CLOSE:\r
                     pntInfo.add(pntInfo.get(0));\r
index cb001ccf9c7e8e972e9a536136840ec304253fcc..23088f056b5ff34dc1403e4e87134f4e7f392bb1 100644 (file)
@@ -30,8 +30,8 @@ import java.util.Map;
 import java.util.ArrayList;
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.exceptions.HSLFException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.util.POILogFactory;
 
 /**
  * Translates Graphics2D calls into PowerPoint.
@@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFactory;
  */
 public class PPGraphics2D extends Graphics2D implements Cloneable {
 
-    private static final Log log = LogFactory.getLog(PPGraphics2D.class);
+    protected POILogger log = POILogFactory.getLogger(this.getClass());
 
     //The ppt object to write into.
     private ShapeGroup group;
@@ -356,7 +356,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      *          this method clears the current <code>Clip</code>.
      */
     public void clip(Shape s){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -376,7 +376,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @since       JDK1.1
      */
     public Shape getClip(){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return null;
     }
 
@@ -644,7 +644,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
     public boolean drawImage(Image img, int x, int y,
                              Color bgcolor,
                              ImageObserver observer){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
 
         return false;
     }
@@ -691,7 +691,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
                              int width, int height,
                              Color bgcolor,
                              ImageObserver observer){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
 
         return false;
     }
@@ -748,7 +748,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              ImageObserver observer){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return false;
     }
 
@@ -810,7 +810,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
                              int sx1, int sy1, int sx2, int sy2,
                              Color bgcolor,
                              ImageObserver observer){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return false;
     }
 
@@ -848,7 +848,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      */
     public boolean drawImage(Image img, int x, int y,
                              ImageObserver observer) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return false;
     }
 
@@ -1033,7 +1033,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @since       JDK1.1
      */
     public void setClip(Shape clip) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1331,7 +1331,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see java.awt.AlphaComposite
      */
     public void setComposite(Composite comp){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1342,7 +1342,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setComposite
      */
     public Composite getComposite(){
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return null;
     }
 
@@ -1483,7 +1483,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setClip
      */
     public void drawString(AttributedCharacterIterator iterator, float x, float y) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1586,7 +1586,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setClip(Shape)
      */
      public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return false;
     }
 
@@ -1629,7 +1629,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
     public boolean drawImage(Image img, int x, int y,
                              int width, int height,
                              ImageObserver observer) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
         return false;
     }
 
@@ -1675,7 +1675,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @param     c1 the XOR alternation color
      */
     public void setXORMode(Color c1) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1686,7 +1686,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * overwrite the destination with the current color.
      */
     public void setPaintMode() {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1721,7 +1721,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #drawRenderedImage
      */
      public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     /**
@@ -1746,7 +1746,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setClip
      */
     public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
-        log.warn("Not implemented");
+        log.log(POILogger.WARN, "Not implemented");
     }
 
     protected void applyStroke(SimpleShape shape) {
index 4866779b92cfc6a04f2e42213a07f7673a2b7b70..90efd5f3ee5a1f41348ede304f5097b43861fc97 100644 (file)
@@ -21,6 +21,7 @@ import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.record.Document;
 import org.apache.poi.hslf.blip.Bitmap;
+import org.apache.poi.util.POILogger;
 
 import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
@@ -178,7 +179,7 @@ public class Picture extends SimpleShape {
         List lst = bstore.getChildRecords();
         int idx = getPictureIndex();
         if (idx == 0){
-            log.error("no reference to picture data found ");
+            logger.log(POILogger.ERROR, "no reference to picture data found ");
         } else {
             EscherBSERecord bse = (EscherBSERecord)lst.get(idx-1);
             for ( int i = 0; i < pict.length; i++ ) {
@@ -186,7 +187,7 @@ public class Picture extends SimpleShape {
                     return pict[i];
                 }
             }
-            log.error("no picture found for our BSE offset " + bse.getOffset());
+            logger.log(POILogger.ERROR, "no picture found for our BSE offset " + bse.getOffset());
         }
         return null;
     }
index 220a512dc5ee14ad588cb58584f5f49cff63503a..f93392a9a9bb601bc51eece34294e63b21c5e62e 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.poi.hslf.model;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.model.ShapeTypes;
 import org.apache.poi.hslf.record.ColorSchemeAtom;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.poi.util.POILogger;
+import org.apache.poi.util.POILogFactory;
 
 import java.util.Iterator;
 import java.awt.*;
@@ -45,7 +45,7 @@ import java.awt.geom.Rectangle2D;
 public abstract class Shape {
 
     // For logging
-    protected Log log = LogFactory.getLog(this.getClass());
+    protected POILogger logger = POILogFactory.getLogger(this.getClass());
 
     /**
      * In Escher absolute distances are specified in
index 7b79ebad976463449ef5f7bc87c7a2e71c2113a4..dbcc8069c24e04a2702f9858c848f0aeb55055f8 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -70,7 +71,7 @@ public class ShapeGroup extends Shape{
                } else {
                        // Should we do anything special with these non
                        //  Container records?
-                       log.error("Shape contained non container escher record, was " + r.getClass().getName());
+                       logger.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
                }
         }
         
index 8a54e079c694d439eb210bfba6b0de1ec7bd03ab..1f9a489a78be29eb2b08babd6e1922e6a487a5f0 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.exceptions.HSLFException;
+import org.apache.poi.util.POILogger;
 
 import java.awt.*;
 import java.awt.font.FontRenderContext;
@@ -479,7 +480,7 @@ public class TextBox extends SimpleShape {
                 }
             }
             if(_txtrun == null) {
-                log.warn("text run not found for OutlineTextRefAtom.TextIndex=" + idx);
+                logger.log(POILogger.WARN, "text run not found for OutlineTextRefAtom.TextIndex=" + idx);
             }
         } else {
             int shapeId = _escherContainer.getChildById(EscherSpRecord.RECORD_ID).getShapeId();
index c5b217b367dba147162ff082a2640cbd20d5dc13..f6252840ccd40040f7e74f13baa3069e97b12d55 100644 (file)
@@ -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 @@ public class Document extends PositionDependentRecordContainer
                //  (normally it's 2, or 3 if you have notes)
                // Complain if it's not
                if(slwtcount == 0) {
-                       logger.warn("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) {
-                       logger.warn("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
index 57c79afe111c28a54a1a568805bc46e383b001be..9e58e8ae187a0d63659b2a8ad4555bd5f5d8e512 100644 (file)
@@ -21,6 +21,7 @@ import java.io.OutputStream;
 import java.io.IOException;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
 
 /**
  * This data represents an embedded object in the document.
@@ -93,14 +94,14 @@ public class ExEmbed extends RecordContainer {
         if(_children[0] instanceof ExEmbedAtom) {
             embedAtom = (ExEmbedAtom)_children[0];
         } else {
-            logger.error("First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
+            logger.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
         }
 
         // Second child should be the ExOleObjAtom
         if (_children[1] instanceof ExOleObjAtom) {
             oleObjAtom = (ExOleObjAtom)_children[1];
         } else {
-            logger.error("Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
+            logger.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
         }
 
         for (int i = 2; i < _children.length; i++) {
@@ -109,7 +110,7 @@ public class ExEmbed extends RecordContainer {
                 else if (progId == null) progId = (CString)_children[i];
                 else if (clipboardName == null) clipboardName = (CString)_children[i];
             } else {
-                logger.error("Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
+                logger.log(POILogger.ERROR, "Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
             }
         }
     }
index 1832e090199e7c6d590c8fd61e94d27c34b55023..8ba58cdb61efaef31b13eee0da202a0cebd5f01c 100644 (file)
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
 
 /**
  * This class represents the data of a link in the document. 
@@ -107,7 +108,7 @@ public class ExHyperlink extends RecordContainer {
                if(_children[0] instanceof ExHyperlinkAtom) {
                        linkAtom = (ExHyperlinkAtom)_children[0];
                } else {
-                       logger.error("First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
+                       logger.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
                }
 
         for (int i = 1; i < _children.length; i++) {
@@ -115,7 +116,7 @@ public class ExHyperlink extends RecordContainer {
                 if ( linkDetailsA == null) linkDetailsA = (CString)_children[i];
                 else linkDetailsB = (CString)_children[i];
             } else {
-                logger.error("Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
+                logger.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
             }
 
         }
index 17ab338414d5adf3016c253d77d1abbcceea338e..521e8468b3cd2302bf0c7f1baf94987adb3bdcf4 100644 (file)
@@ -18,6 +18,8 @@
 
 package org.apache.poi.hslf.record;
 
+import org.apache.poi.util.POILogger;
+
 import java.io.*;
 import java.util.*;
 
@@ -46,7 +48,7 @@ public class FontCollection extends RecordContainer {
                    FontEntityAtom atom = (FontEntityAtom)_children[i];
                    fonts.add(atom.getFontName());
                        } else {
-                               logger.warn("Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
+                               logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
                        }
                }
        }
index b0602bc4605919060e7b01174ac2cf8937788a0c..e42b358b89df78cf2230de8ac01e160473faa166 100644 (file)
@@ -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;
@@ -131,7 +132,7 @@ public class PPDrawing extends RecordAtom
                // Wind on
                int size = r.getRecordSize();
                if(size < 8) {
-                       logger.warn("Hit short DDF record at " + startPos + " - " + size);
+                       logger.log(POILogger.WARN, "Hit short DDF record at " + startPos + " - " + size);
                }
 
         /**
@@ -141,7 +142,7 @@ public class PPDrawing extends RecordAtom
          * Sometimes it is not so, see an example in bug #44770. Most likely reason is that one of ddf records calculates wrong size. 
          */
         if(size != escherBytes){
-            logger.warn("Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
+            logger.log(POILogger.WARN, "Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
             size = escherBytes;
         }
                startPos += size;
index 7f9d6468025a0c1698fcc2d439ff083a0ceb83e1..68b8b7cafee2fb6394dc42cfb58e4832d6c5e2ac 100644 (file)
@@ -20,6 +20,7 @@
 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;
@@ -194,8 +195,8 @@ public class PersistPtrHolder extends PositionDependentRecordAtom
                        Integer newPos = (Integer)oldToNewReferencesLookup.get(oldPos);
 
                        if(newPos == null) {
-                               logger.warn("Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
-                               logger.warn("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;
                        }
 
index 44cde7595bdae9027ae854b936156a7d4b93f1b9..46cb7479e22e37071c398edd3760e87aafde9307 100644 (file)
@@ -24,10 +24,9 @@ import java.io.IOException;
 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;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 
 /**
  * This abstract class represents a record in the PowerPoint document.
@@ -40,7 +39,7 @@ import org.apache.commons.logging.LogFactory;
 public abstract class Record
 {
     // For logging
-    protected Log logger = LogFactory.getLog(this.getClass());
+    protected POILogger logger = POILogFactory.getLogger(this.getClass());
 
        /**
         * Is this record type an Atom record (only has data),
index 72e17722ce8a628c5468031e5a8a33c3857afaef..fdaa9eec2c41f3a3134466bf430638ced4d42fb6 100644 (file)
@@ -31,6 +31,7 @@ import org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp;
 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;
 
 /**
  * A StyleTextPropAtom (type 4001). Holds basic character properties 
@@ -292,7 +293,7 @@ public class StyleTextPropAtom extends RecordAtom
 
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            logger.warn("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
@@ -327,7 +328,7 @@ public class StyleTextPropAtom extends RecordAtom
                        }
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            logger.warn("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
index 105bca5d43b13a824f5f19a2f236da1523a46450..9ce9a12c9d794380e0350bbf037c11b8194aa756 100644 (file)
@@ -37,8 +37,8 @@ import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.util.ArrayUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+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.
@@ -80,7 +80,7 @@ public class SlideShow
   private FontCollection _fonts;
 
   // For logging
-  private static final Log logger = LogFactory.getLog(SlideShow.class);
+    private POILogger logger = POILogFactory.getLogger(this.getClass());
 
   
   /* ===============================================================
@@ -275,7 +275,7 @@ public class SlideShow
                        Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
                        return r;
                } else {
-                       logger.error("We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
+                       logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
                        return null;
                }
        }
@@ -378,7 +378,7 @@ public class SlideShow
                 Integer slideId = new Integer(spa.getSlideIdentifier());
                 slideIdToNotes.put(slideId, new Integer(i));
                        } else {
-                               logger.error("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);
                        }
                }
                notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
@@ -404,7 +404,7 @@ public class SlideShow
                        if(r instanceof org.apache.poi.hslf.record.Slide) {
                                slidesRecords[i] = (org.apache.poi.hslf.record.Slide)r;
                        } else {
-                               logger.error("A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+                               logger.log(POILogger.ERROR, "A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
                        }
                }
        }
@@ -429,7 +429,7 @@ public class SlideShow
         if (noteId != 0){
             Integer notesPos = (Integer)slideIdToNotes.get(new Integer(noteId));
             if (notesPos != null) notes = _notes[notesPos.intValue()];
-            else logger.error("Notes not found for noteId=" + noteId);
+            else logger.log(POILogger.ERROR, "Notes not found for noteId=" + noteId);
         }
 
                // Now, build our slide
@@ -622,7 +622,7 @@ public class SlideShow
                System.arraycopy(_slides, 0, s, 0, _slides.length);
                s[_slides.length] = slide;
                _slides = s;
-               logger.info("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();
@@ -658,7 +658,7 @@ public class SlideShow
                // (Also need to tell it where it is)
                slideRecord.setLastOnDiskOffset(slideOffset);
                ptr.addSlideLookup(sp.getRefID(), slideOffset);
-               logger.info("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);
index 64e087a554137e438dc45ed52854911efdb1c264..8f16516ca97fb5a990333ab89a94840a3bded155 100644 (file)
@@ -77,9 +77,9 @@ public class TestTextObjectRecord extends TestCase {
         record.setReserved7( 0 );\r
 \r
         byte [] ser = record.serialize();\r
-        assertEquals(ser.length , data.length);\r
+        //assertEquals(ser.length , data.length);\r
 \r
-        assertTrue(Arrays.equals(data, ser));\r
+        //assertTrue(Arrays.equals(data, ser));\r
 \r
         //read again\r
         RecordInputStream is = new RecordInputStream(new ByteArrayInputStream(data));\r