1.5.1 tweaking


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_1_5_BRANCH@352698 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/module.xml b/module.xml
index e4bff67..503da0f 100644
--- a/module.xml
+++ b/module.xml
@@ -69,7 +69,7 @@
      <version major="1"
              minor="5"   
 	     fix  ="1"   
-	     tag="dev"/>
+	     tag="final"/>
              
     <package>org.apache.poi</package>
 
@@ -87,7 +87,7 @@
     <depend project="junit"/>
     <depend project="IzPress"/>
     <!-- needed for POI -->
-    <depend project="commons-logging"/>
+    <!-- <depend project="commons-logging"/> -->
     
     <!-- Project jars POI build can use  -->    
     <option project="jakarta-log4j"/>
diff --git a/src/documentation/xdocs/changes.xml b/src/documentation/xdocs/changes.xml
index 36223b2..9540dcf 100644
--- a/src/documentation/xdocs/changes.xml
+++ b/src/documentation/xdocs/changes.xml
@@ -11,7 +11,11 @@
         <person id="NKB" name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
         <person id="POI-DEVELOPERS" name="Poi Developers"    email="poi-dev@jakarta.apache.org"/>
     </devs>
-    <release version="1.5" date="Coming Soon">
+    <release version="1.5.1" date="16 June 2002">
+        <action dev="GJS" type="update">Removed depedency on commons logging.  Now define poi.logging system property to enable logging to standard out.</action>
+        <action dev="GJS" type="fix">Fixed SST string handling so that spreadsheets with rich text or extended text will be read correctly.</action>
+    </release>
+    <release version="1.5" date="06 May 2002">
         <action dev="NKB" type="update">New project build.</action>
         <action dev="NKB" type="update">New project documentation system based on Cocoon.</action>
         <action dev="POI-DEVELOPERS" type="update">Package rename</action>
diff --git a/src/documentation/xdocs/hssf/how-to.xml b/src/documentation/xdocs/hssf/how-to.xml
index 8c5d930..2ad13be 100644
--- a/src/documentation/xdocs/hssf/how-to.xml
+++ b/src/documentation/xdocs/hssf/how-to.xml
@@ -397,55 +397,20 @@
 <ul>
 	<li>Type:
 	<code>java org.apache.poi.hssf.dev.HSSF ~/input.xls output.xls</code>
-    <p>
+    <br/>
+    <br/>
 This is the read/write/modify test.  It reads in the spreadsheet, modifies a cell, and writes it back out.
 Failing this test is not necessarily a bad thing.  If HSSF tries to modify a non-existant sheet then this will
-most likely fail.  No big deal.  </p></li>
+most likely fail.  No big deal.  </li>
 </ul>
      </section>
-                <section title="HSSF Logging facility">
-<p>HSSF now has a logging facility (using
- <link href="http://jakarta.apache.org/commons/logging.html">commons logging</link>)
-that will record massive amounts of debugging information. Its mostly
-useful to us hssf-developing geeks, but might be useful in tracking
-down problems.
-</p>
-<p>So Why use commons logging rather than log4j? Well the following discussion from
-the jakarta-general mailing list sums it up pretty well.  (Thanks Morgan)
-</p>
-<p><em>Here's the problem, as I see it.</em>
-</p>
-<p><em>Suppose Commons component A decides to adopt Log4J, Commons component B
-decides to adopt LogKit, and Commons component C adopts JDK1.4 logging.
-They will all minimally function with the right jars in the classpath.
-However you (the end-user) are left with maintaining configuration for 3
-different logging APIs, which is tedious at best.  When you take into
-account cool features like variable log levels, Log4J appenders and the
-like, you're pretty much guaranteed to swallow up useful configuration
-options because sophisticated configurations are too difficult to maintain
-over mutiple logging implementations.</em>
-</p>
+                <section title="HSSF Logging Facility">
 <p>
-<em>Contrarily, if all three Commons components use a logging facade, you can
-focus all your configuration efforts on one logging implementation.  Sure,
-there is a trade-off; you don't have access to all the features, and the
-interface between the facade and the implementation must be maintained.  But
-the benefits are not just political; they potentially make the end-users
-configuration much easier.</em>
-</p>
-<p><em>Even if all Commons components used the same logging implementation (Log4J
-for example), other projects in Jakarta-land may choose otherwise.  If you
-add enough Jakarta projects to your environment, you eventually end up with
-the scenario described above.  It's a worthwhile effort to attempt a logging
-solution that plays well with the Jakarta community at large.  I think in
-many cases the Commons Logging component can fill that role.</em>
-</p>
-<p>
-Refer to the commons logging package level javadoc for more information concerning how to
-<link href="http://jakarta.apache.org/commons/logging/api/index.html">configure commons logging.</link>
+    POI has a small amount of logging code embedded within it.  Defining the system property
+    poi.logging will enable logging to standard out.
 </p>
      </section>
-                <section title="HSSF Developer's tools">
+                <section title="HSSF Developer's Tools">
 
 <p>HSSF has a number of tools useful for developers to debug/develop
 stuff using HSSF (and more generally XLS files). We've already
diff --git a/src/java/org/apache/poi/util/POILogFactory.java b/src/java/org/apache/poi/util/POILogFactory.java
index 2378ab8..8c52a36 100644
--- a/src/java/org/apache/poi/util/POILogFactory.java
+++ b/src/java/org/apache/poi/util/POILogFactory.java
@@ -1,4 +1,3 @@
-
 /*
  * ====================================================================
  * The Apache Software License, Version 1.1
@@ -55,12 +54,8 @@
  */
 package org.apache.poi.util;
 
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import java.util.*;
-
-import org.apache.commons.logging.*;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Provides logging without clients having to mess with
@@ -73,10 +68,10 @@
 
 public class POILogFactory
 {
-    private static LogFactory   _creator = LogFactory.getFactory();
+//    private static LogFactory _creator = LogFactory.getFactory();
 
     // map of POILogger instances, with classes as keys
-    private static Map          _loggers = new HashMap();;
+    private static Map _loggers = new HashMap();;
 
 
     /**
@@ -95,11 +90,11 @@
      * @return a POILogger for the specified class
      */
 
-    public static POILogger getLogger(final Class theclass)
+    public static POILogger getLogger( final Class theclass )
     {
-        return getLogger(theclass.getName());
+        return getLogger( theclass.getName() );
     }
-    
+
     /**
      * Get a logger, based on a String
      *
@@ -108,20 +103,20 @@
      * @return a POILogger for the specified class
      */
 
-    public static POILogger getLogger(final String cat)
+    public static POILogger getLogger( final String cat )
     {
         POILogger logger = null;
 
-        if (_loggers.containsKey(cat))
+        if ( _loggers.containsKey( cat ) )
         {
-            logger = ( POILogger ) _loggers.get(cat);
+            logger = (POILogger) _loggers.get( cat );
         }
         else
         {
-            logger = new POILogger(_creator.getInstance(cat));
-            _loggers.put(cat, logger);
+            logger = new POILogger( );
+            _loggers.put( cat, logger );
         }
         return logger;
     }
-        
+
 }   // end public class POILogFactory
diff --git a/src/java/org/apache/poi/util/POILogger.java b/src/java/org/apache/poi/util/POILogger.java
index a6d066c..b47a380 100644
--- a/src/java/org/apache/poi/util/POILogger.java
+++ b/src/java/org/apache/poi/util/POILogger.java
@@ -55,8 +55,6 @@
  */
 package org.apache.poi.util;
 
-import org.apache.commons.logging.Log;
-
 import java.util.*;
 
 /**
@@ -72,7 +70,7 @@
 
 public class POILogger
 {
-    private Log             log   = null;
+//    private Log             log   = null;
     public static final int DEBUG = 1;
     public static final int INFO  = 3;
     public static final int WARN  = 5;
@@ -82,13 +80,10 @@
     /**
      * package scope so it cannot be instantiated outside of the util
      * package. You need a POILogger? Go to the POILogFactory for one
-     *
-     * @param log the object that does the real work of logging
      */
 
-    POILogger(final Log log)
+    POILogger()
     {
-        this.log = log;
     }
 
     /**
@@ -100,91 +95,73 @@
 
     public void log(final int level, final Object obj1)
     {
-        if(level==FATAL)
-        {
-          if(log.isFatalEnabled())
-          {
-            log.fatal(obj1);
-          }
-        }
-        else if(level==ERROR)
-        {
-          if(log.isErrorEnabled())
-          {
-            log.error(obj1);
-          }
-        }
-        else if(level==WARN)
-        {
-          if(log.isWarnEnabled())
-          {
-            log.warn(obj1);
-          }
-        }
-        else if(level==INFO)
-        {
-          if(log.isInfoEnabled())
-          {
-            log.info(obj1);
-          }
-        }
-        else if(level==DEBUG)
-        {
-          if(log.isDebugEnabled())
-          {
-            log.debug(obj1);
-          }
-        }
-        else
-        {
-          if(log.isTraceEnabled())
-          {
-            log.trace(obj1);
-          }
-        }
+        if (check(level))
+            System.out.println( obj1 );
+    }
 
+    private boolean isDebugEnabled()
+    {
+        return System.getProperty("poi.logging") != null;
+    }
+
+    private boolean isInfoEnabled()
+    {
+        return false;
+    }
+
+    private boolean isWarnEnabled()
+    {
+        return System.getProperty("poi.logging") != null;
+    }
+
+    private boolean isErrorEnabled()
+    {
+        return System.getProperty("poi.logging") != null;
+    }
+
+    private boolean isFatalEnabled()
+    {
+        return System.getProperty("poi.logging") != null;
     }
 
     /**
      * Check if a logger is enabled to log at the specified level
      *
      * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
-     * @param obj1 The logger to check.
      */
-
-    public boolean check(final Log log, final int level)
+    public boolean check(final int level)
     {
         if(level==FATAL)
         {
-          if(log.isFatalEnabled())
+          if(isFatalEnabled())
           {
             return true;
           }
         }
         else if(level==ERROR)
         {
-          if(log.isErrorEnabled())
+          if(isErrorEnabled())
           {
             return true;
           }
         }
         else if(level==WARN)
         {
-          if(log.isWarnEnabled())
+          if(isWarnEnabled())
           {
             return true;
           }
         }
         else if(level==INFO)
         {
-          if(log.isInfoEnabled())
+          if(isInfoEnabled())
           {
             return true;
           }
         }
         else if(level==DEBUG)
         {
-          if(log.isDebugEnabled())
+          if(isDebugEnabled())
           {
             return true;
           }
@@ -204,7 +181,7 @@
 
     public void log(final int level, final Object obj1, final Object obj2)
     {
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(32).append(obj1).append(obj2));
         }
@@ -222,13 +199,9 @@
     public void log(final int level, final Object obj1, final Object obj2,
                     final Object obj3)
     {
-        
-
-        if (check(log, level))
+        if (check( level))
         {
-            log(level,
-                    new StringBuffer(48).append(obj1).append(obj2)
-                        .append(obj3));
+            log(level, new StringBuffer(48).append(obj1).append(obj2 ).append(obj3));
         }
     }
 
@@ -247,7 +220,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level,
                     new StringBuffer(64).append(obj1).append(obj2)
@@ -271,7 +244,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level,
                     new StringBuffer(80).append(obj1).append(obj2)
@@ -297,7 +270,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level ,
                     new StringBuffer(96).append(obj1).append(obj2)
@@ -324,7 +297,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level,
                     new StringBuffer(112).append(obj1).append(obj2)
@@ -353,7 +326,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level,
                     new StringBuffer(128).append(obj1).append(obj2)
@@ -390,7 +363,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(32).append(obj1).append(obj2),
                     exception);
@@ -412,7 +385,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(48).append(obj1).append(obj2)
                 .append(obj3), exception);
@@ -436,7 +409,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(64).append(obj1).append(obj2)
                 .append(obj3).append(obj4), exception);
@@ -461,7 +434,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(80).append(obj1).append(obj2)
                 .append(obj3).append(obj4).append(obj5), exception);
@@ -487,7 +460,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level , new StringBuffer(96).append(obj1)
                 .append(obj2).append(obj3).append(obj4).append(obj5)
@@ -516,7 +489,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(112).append(obj1).append(obj2)
                 .append(obj3).append(obj4).append(obj5).append(obj6)
@@ -546,7 +519,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             log(level, new StringBuffer(128).append(obj1).append(obj2)
                 .append(obj3).append(obj4).append(obj5).append(obj6)
@@ -703,7 +676,7 @@
     {
         
 
-        if (check(log, level))
+        if (check( level))
         {
             Object[] params = flattenArrays(unflatParams);
 
diff --git a/src/testcases/org/apache/poi/util/TestPOILogFactory.java b/src/testcases/org/apache/poi/util/TestPOILogFactory.java
index 82aef5d..2e27e6a 100644
--- a/src/testcases/org/apache/poi/util/TestPOILogFactory.java
+++ b/src/testcases/org/apache/poi/util/TestPOILogFactory.java
@@ -1,4 +1,3 @@
-
 /* ====================================================================
  * The Apache Software License, Version 1.1
  *
@@ -55,11 +54,9 @@
 
 package org.apache.poi.util;
 
-import org.apache.log4j.Category;
+import junit.framework.TestCase;
 
-import junit.framework.*;
-
-import java.io.*;
+import java.io.IOException;
 
 /**
  * @author Marc Johnson (mjohnson at apache dot org)
@@ -68,7 +65,7 @@
  */
 
 public class TestPOILogFactory
-    extends TestCase
+        extends TestCase
 {
     /**
      * Creates new TestPOILogFactory
@@ -76,9 +73,9 @@
      * @param name
      */
 
-    public TestPOILogFactory(String name)
+    public TestPOILogFactory( String name )
     {
-        super(name);
+        super( name );
     }
 
     /**
@@ -88,26 +85,26 @@
      */
 
     public void testLog()
-        throws IOException
+            throws IOException
     {
         //NKB Testing only that logging classes use gives no exception
         //    Since logging can be disabled, no checking of logging
         //    output is done.
-                 
-        POILogger     l1 = POILogFactory.getLogger("org.apache.poi.hssf.test");
-        POILogger     l2 = POILogFactory.getLogger("org.apache.poi.hdf.test");
 
-        l1.log(POILogger.FATAL, "testing cat org.apache.poi.hssf.*:FATAL");
-        l1.log(POILogger.ERROR, "testing cat org.apache.poi.hssf.*:ERROR");
-        l1.log(POILogger.WARN,  "testing cat org.apache.poi.hssf.*:WARN");
-        l1.log(POILogger.INFO,  "testing cat org.apache.poi.hssf.*:INFO");
-        l1.log(POILogger.DEBUG, "testing cat org.apache.poi.hssf.*:DEBUG");
+        POILogger l1 = POILogFactory.getLogger( "org.apache.poi.hssf.test" );
+        POILogger l2 = POILogFactory.getLogger( "org.apache.poi.hdf.test" );
 
-        l2.log(POILogger.FATAL, "testing cat org.apache.poi.hdf.*:FATAL");
-        l2.log(POILogger.ERROR, "testing cat org.apache.poi.hdf.*:ERROR");
-        l2.log(POILogger.WARN,  "testing cat org.apache.poi.hdf.*:WARN");
-        l2.log(POILogger.INFO,  "testing cat org.apache.poi.hdf.*:INFO");
-        l2.log(POILogger.DEBUG, "testing cat org.apache.poi.hdf.*:DEBUG");
+        l1.log( POILogger.FATAL, "testing cat org.apache.poi.hssf.*:FATAL" );
+        l1.log( POILogger.ERROR, "testing cat org.apache.poi.hssf.*:ERROR" );
+        l1.log( POILogger.WARN, "testing cat org.apache.poi.hssf.*:WARN" );
+        l1.log( POILogger.INFO, "testing cat org.apache.poi.hssf.*:INFO" );
+        l1.log( POILogger.DEBUG, "testing cat org.apache.poi.hssf.*:DEBUG" );
+
+        l2.log( POILogger.FATAL, "testing cat org.apache.poi.hdf.*:FATAL" );
+        l2.log( POILogger.ERROR, "testing cat org.apache.poi.hdf.*:ERROR" );
+        l2.log( POILogger.WARN, "testing cat org.apache.poi.hdf.*:WARN" );
+        l2.log( POILogger.INFO, "testing cat org.apache.poi.hdf.*:INFO" );
+        l2.log( POILogger.DEBUG, "testing cat org.apache.poi.hdf.*:DEBUG" );
 
     }
 
@@ -117,9 +114,9 @@
      * @param ignored_args
      */
 
-    public static void main(String [] ignored_args)
+    public static void main( String[] ignored_args )
     {
-        System.out.println("Testing basic util.POILogFactory functionality");
-        junit.textui.TestRunner.run(TestPOILogFactory.class);
+        System.out.println( "Testing basic util.POILogFactory functionality" );
+        junit.textui.TestRunner.run( TestPOILogFactory.class );
     }
 }
diff --git a/src/testcases/org/apache/poi/util/TestPOILogger.java b/src/testcases/org/apache/poi/util/TestPOILogger.java
index 62b47a2..46248b5 100644
--- a/src/testcases/org/apache/poi/util/TestPOILogger.java
+++ b/src/testcases/org/apache/poi/util/TestPOILogger.java
@@ -1,4 +1,3 @@
-
 /* ====================================================================
  * The Apache Software License, Version 1.1
  *
@@ -57,19 +56,16 @@
 
 import junit.framework.TestCase;
 
-import java.io.File;
-import java.io.FileInputStream;
-
 /**
  * Tests the log class.
  *
  * @author Glen Stampoultzis (glens at apache.org)
  * @author Marc Johnson (mjohnson at apache dot org)
- * @author Nicola Ken Barozzi (nicolaken at apache.org) 
+ * @author Nicola Ken Barozzi (nicolaken at apache.org)
  */
 
 public class TestPOILogger
-    extends TestCase
+        extends TestCase
 {
     /**
      * Constructor TestPOILogger
@@ -79,23 +75,9 @@
      *
      */
 
-    public TestPOILogger(String s)
+    public TestPOILogger( String s )
     {
-        super(s);
-    }
-
-    /**
-     * Method setUp
-     *
-     *
-     * @exception Exception
-     *
-     */
-
-    protected void setUp()
-        throws Exception
-    {
-        super.setUp();
+        super( s );
     }
 
     /**
@@ -103,29 +85,20 @@
      *
      * @exception Exception
      */
-
     public void testVariousLogTypes()
-        throws Exception
+            throws Exception
     {
         //NKB Testing only that logging classes use gives no exception
         //    Since logging can be disabled, no checking of logging
         //    output is done.
-        
-        POILogger     log = POILogFactory.getLogger("foo");
 
-        log.log(POILogger.WARN, "Test = ", new Integer(1));
-        log.logFormatted(POILogger.ERROR, "Test param 1 = %, param 2 = %",
-                         "2", new Integer(3));
-        log.logFormatted(POILogger.ERROR, "Test param 1 = %, param 2 = %",
-                         new int[]
-        {
-            4, 5
-        });
-        log.logFormatted(POILogger.ERROR,
-                         "Test param 1 = %1.1, param 2 = %0.1", new double[]
-        {
-            4, 5.23
-        });
+        POILogger log = POILogFactory.getLogger( "foo" );
+
+        log.log( POILogger.WARN, "Test = ", new Integer( 1 ) );
+        log.logFormatted( POILogger.ERROR, "Test param 1 = %, param 2 = %", "2", new Integer( 3 ) );
+        log.logFormatted( POILogger.ERROR, "Test param 1 = %, param 2 = %", new int[]{4, 5} );
+        log.logFormatted( POILogger.ERROR,
+                "Test param 1 = %1.1, param 2 = %0.1", new double[]{4, 5.23} );
 
     }
 }