poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhei...@apache.org
Subject svn commit: r425376 - /jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java
Date Tue, 25 Jul 2006 11:50:56 GMT
Author: jheight
Date: Tue Jul 25 04:50:55 2006
New Revision: 425376

URL: http://svn.apache.org/viewvc?rev=425376&view=rev
Log:
Clean up of HSSFDataFormat. Whilst Bug 22456 was probably not an issue with the previous code,
these changes are even better ;-) Squashing Bug 22456 now.

Modified:
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java?rev=425376&r1=425375&r2=425376&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java Tue Jul 25
04:50:55 2006
@@ -80,7 +80,7 @@
 
 public class HSSFDataFormat
 {
-    private static Vector builtinFormats;
+    private static List builtinFormats = createBuiltinFormats();
 
     private Vector formats = new Vector();
     private Workbook workbook;
@@ -97,7 +97,6 @@
     public HSSFDataFormat( Workbook workbook )
     {
         this.workbook = workbook;
-        if ( builtinFormats == null ) populateBuiltinFormats();
         Iterator i = workbook.getFormats().iterator();
         while ( i.hasNext() )
         {
@@ -111,9 +110,9 @@
 
     }
 
-    private static synchronized void populateBuiltinFormats()
+    private static synchronized List createBuiltinFormats()
     {
-        builtinFormats = new Vector();
+        List builtinFormats = new Vector();
         builtinFormats.add( 0, "General" );
         builtinFormats.add( 1, "0" );
         builtinFormats.add( 2, "0.00" );
@@ -169,14 +168,11 @@
         builtinFormats.add( 0x2f, "mm:ss.0" );
         builtinFormats.add( 0x30, "##0.0E+0" );
         builtinFormats.add( 0x31, "@" );
+        return builtinFormats;
     }
 
     public static List getBuiltinFormats()
     {
-        if ( builtinFormats == null )
-        {
-            populateBuiltinFormats();
-        }
         return builtinFormats;
     }
 
@@ -192,10 +188,6 @@
 	if (format.toUpperCase().equals("TEXT")) 
 		format = "@";
 
-        if ( builtinFormats == null )
-        {
-            populateBuiltinFormats();
-        }
         short retval = -1;
 
         for (short k = 0; k <= 0x31; k++)
@@ -282,10 +274,6 @@
 
     public static String getBuiltinFormat( short index )
     {
-        if ( builtinFormats == null )
-        {
-            populateBuiltinFormats();
-        }
         return (String) builtinFormats.get( index );
     }
 
@@ -296,10 +284,6 @@
 
     public static int getNumberOfBuiltinBuiltinFormats()
     {
-        if ( builtinFormats == null )
-        {
-            populateBuiltinFormats();
-        }
         return builtinFormats.size();
     }
 }



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


Mime
View raw message