poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1637703 - in /poi/trunk/src/java/org/apache/poi: ss/format/ util/
Date Sun, 09 Nov 2014 17:53:11 GMT
Author: centic
Date: Sun Nov  9 17:53:10 2014
New Revision: 1637703

URL: http://svn.apache.org/r1637703
Log:
Add some missing close() calls and fix some generics warnings

Modified:
    poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellGeneralFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
    poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java
    poi/trunk/src/java/org/apache/poi/util/DrawingDump.java
    poi/trunk/src/java/org/apache/poi/util/HexRead.java

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java Sun Nov  9 17:53:10
2014
@@ -183,8 +183,12 @@ public class CellDateFormatter extends C
                     Date dateObj = (Date) value;
                     int pos = toAppendTo.length();
                     Formatter formatter = new Formatter(toAppendTo);
-                    long msecs = dateObj.getTime() % 1000;
-                    formatter.format(LOCALE, sFmt, msecs / 1000.0);
+                    try {
+                        long msecs = dateObj.getTime() % 1000;
+                        formatter.format(LOCALE, sFmt, msecs / 1000.0);
+                    } finally {
+                        formatter.close();
+                    }
                     toAppendTo.delete(pos, pos + 2);
                     doneMillis = true;
                 }

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellElapsedFormatter.java Sun Nov  9 17:53:10
2014
@@ -201,7 +201,11 @@ public class CellElapsedFormatter extend
         }
 
         Formatter formatter = new Formatter(toAppendTo);
-        formatter.format(printfFmt, parts);
+        try {
+            formatter.format(printfFmt, parts);
+        } finally {
+            formatter.close();
+        }
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellGeneralFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellGeneralFormatter.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellGeneralFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellGeneralFormatter.java Sun Nov  9 17:53:10
2014
@@ -57,7 +57,11 @@ public class CellGeneralFormatter extend
             }
 
             Formatter formatter = new Formatter(toAppendTo);
-            formatter.format(LOCALE, fmt, value);
+            try {
+                formatter.format(LOCALE, fmt, value);
+            } finally {
+                formatter.close();
+            }
             if (stripZeros) {
                 // strip off trailing zeros
                 int removeFrom;

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellNumberFormatter.java Sun Nov  9 17:53:10
2014
@@ -595,7 +595,11 @@ public class CellNumberFormatter extends
         } else {
             StringBuffer result = new StringBuffer();
             Formatter f = new Formatter(result);
-            f.format(LOCALE, printfFmt, value);
+            try {
+                f.format(LOCALE, printfFmt, value);
+            } finally {
+                f.close();
+            }
 
             if (numerator == null) {
                 writeFractional(result, output);
@@ -866,7 +870,11 @@ public class CellNumberFormatter extends
 
         StringBuffer sb = new StringBuffer();
         Formatter formatter = new Formatter(sb);
-        formatter.format(LOCALE, fmt, num);
+        try {
+            formatter.format(LOCALE, fmt, num);
+        } finally {
+            formatter.close();
+        }
         writeInteger(sb, output, numSpecials, mods, false);
     }
 

Modified: poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/BitFieldFactory.java Sun Nov  9 17:53:10 2014
@@ -27,10 +27,10 @@ import java.util.*;
  */
 
 public class BitFieldFactory {
-    private static Map instances = new HashMap();
+    private static Map<Integer, BitField> instances = new HashMap<Integer, BitField>();
 
     public static BitField getInstance(int mask) {
-      BitField f = (BitField)instances.get(Integer.valueOf(mask));
+      BitField f = instances.get(Integer.valueOf(mask));
       if (f == null) {
         f = new BitField(mask);
         instances.put(Integer.valueOf(mask), f);

Modified: poi/trunk/src/java/org/apache/poi/util/DrawingDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/DrawingDump.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/DrawingDump.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/DrawingDump.java Sun Nov  9 17:53:10 2014
@@ -35,15 +35,18 @@ public class DrawingDump
         POIFSFileSystem fs      =
                 new POIFSFileSystem(new FileInputStream(args[0]));
         HSSFWorkbook wb = new HSSFWorkbook(fs);
-        System.out.println( "Drawing group:" );
-        wb.dumpDrawingGroupRecords(true);
-
-        for (int sheetNum = 1; sheetNum <= wb.getNumberOfSheets(); sheetNum++)
-        {
-            System.out.println( "Sheet " + sheetNum + ":" );
-            HSSFSheet sheet = wb.getSheetAt(sheetNum - 1);
-            sheet.dumpDrawingRecords(true);
+        try {
+            System.out.println( "Drawing group:" );
+            wb.dumpDrawingGroupRecords(true);
+    
+            for (int sheetNum = 1; sheetNum <= wb.getNumberOfSheets(); sheetNum++)
+            {
+                System.out.println( "Sheet " + sheetNum + ":" );
+                HSSFSheet sheet = wb.getSheetAt(sheetNum - 1);
+                sheet.dumpDrawingRecords(true);
+            }
+        } finally {
+            wb.close();
         }
-
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/util/HexRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/HexRead.java?rev=1637703&r1=1637702&r2=1637703&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/HexRead.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/HexRead.java Sun Nov  9 17:53:10 2014
@@ -109,7 +109,7 @@ public class HexRead
     {
         int characterCount = 0;
         byte b = (byte) 0;
-        List bytes = new ArrayList();
+        List<Byte> bytes = new ArrayList<Byte>();
         boolean done = false;
         while ( !done )
         {
@@ -163,7 +163,7 @@ public class HexRead
                     break;
             }
         }
-        Byte[] polished = (Byte[]) bytes.toArray( new Byte[0] );
+        Byte[] polished = bytes.toArray( new Byte[0] );
         byte[] rval = new byte[polished.length];
         for ( int j = 0; j < polished.length; j++ )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message