Add some missing close() calls and fix some generics warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
82ee923858
commit
0f0c16f56d
@ -183,8 +183,12 @@ public class CellDateFormatter extends CellFormatter {
|
|||||||
Date dateObj = (Date) value;
|
Date dateObj = (Date) value;
|
||||||
int pos = toAppendTo.length();
|
int pos = toAppendTo.length();
|
||||||
Formatter formatter = new Formatter(toAppendTo);
|
Formatter formatter = new Formatter(toAppendTo);
|
||||||
|
try {
|
||||||
long msecs = dateObj.getTime() % 1000;
|
long msecs = dateObj.getTime() % 1000;
|
||||||
formatter.format(LOCALE, sFmt, msecs / 1000.0);
|
formatter.format(LOCALE, sFmt, msecs / 1000.0);
|
||||||
|
} finally {
|
||||||
|
formatter.close();
|
||||||
|
}
|
||||||
toAppendTo.delete(pos, pos + 2);
|
toAppendTo.delete(pos, pos + 2);
|
||||||
doneMillis = true;
|
doneMillis = true;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,11 @@ public class CellElapsedFormatter extends CellFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Formatter formatter = new Formatter(toAppendTo);
|
Formatter formatter = new Formatter(toAppendTo);
|
||||||
|
try {
|
||||||
formatter.format(printfFmt, parts);
|
formatter.format(printfFmt, parts);
|
||||||
|
} finally {
|
||||||
|
formatter.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,11 @@ public class CellGeneralFormatter extends CellFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Formatter formatter = new Formatter(toAppendTo);
|
Formatter formatter = new Formatter(toAppendTo);
|
||||||
|
try {
|
||||||
formatter.format(LOCALE, fmt, value);
|
formatter.format(LOCALE, fmt, value);
|
||||||
|
} finally {
|
||||||
|
formatter.close();
|
||||||
|
}
|
||||||
if (stripZeros) {
|
if (stripZeros) {
|
||||||
// strip off trailing zeros
|
// strip off trailing zeros
|
||||||
int removeFrom;
|
int removeFrom;
|
||||||
|
@ -595,7 +595,11 @@ public class CellNumberFormatter extends CellFormatter {
|
|||||||
} else {
|
} else {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
Formatter f = new Formatter(result);
|
Formatter f = new Formatter(result);
|
||||||
|
try {
|
||||||
f.format(LOCALE, printfFmt, value);
|
f.format(LOCALE, printfFmt, value);
|
||||||
|
} finally {
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
|
||||||
if (numerator == null) {
|
if (numerator == null) {
|
||||||
writeFractional(result, output);
|
writeFractional(result, output);
|
||||||
@ -866,7 +870,11 @@ public class CellNumberFormatter extends CellFormatter {
|
|||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
Formatter formatter = new Formatter(sb);
|
Formatter formatter = new Formatter(sb);
|
||||||
|
try {
|
||||||
formatter.format(LOCALE, fmt, num);
|
formatter.format(LOCALE, fmt, num);
|
||||||
|
} finally {
|
||||||
|
formatter.close();
|
||||||
|
}
|
||||||
writeInteger(sb, output, numSpecials, mods, false);
|
writeInteger(sb, output, numSpecials, mods, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class BitFieldFactory {
|
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) {
|
public static BitField getInstance(int mask) {
|
||||||
BitField f = (BitField)instances.get(Integer.valueOf(mask));
|
BitField f = instances.get(Integer.valueOf(mask));
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
f = new BitField(mask);
|
f = new BitField(mask);
|
||||||
instances.put(Integer.valueOf(mask), f);
|
instances.put(Integer.valueOf(mask), f);
|
||||||
|
@ -35,6 +35,7 @@ public class DrawingDump
|
|||||||
POIFSFileSystem fs =
|
POIFSFileSystem fs =
|
||||||
new POIFSFileSystem(new FileInputStream(args[0]));
|
new POIFSFileSystem(new FileInputStream(args[0]));
|
||||||
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
||||||
|
try {
|
||||||
System.out.println( "Drawing group:" );
|
System.out.println( "Drawing group:" );
|
||||||
wb.dumpDrawingGroupRecords(true);
|
wb.dumpDrawingGroupRecords(true);
|
||||||
|
|
||||||
@ -44,6 +45,8 @@ public class DrawingDump
|
|||||||
HSSFSheet sheet = wb.getSheetAt(sheetNum - 1);
|
HSSFSheet sheet = wb.getSheetAt(sheetNum - 1);
|
||||||
sheet.dumpDrawingRecords(true);
|
sheet.dumpDrawingRecords(true);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
wb.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class HexRead
|
|||||||
{
|
{
|
||||||
int characterCount = 0;
|
int characterCount = 0;
|
||||||
byte b = (byte) 0;
|
byte b = (byte) 0;
|
||||||
List bytes = new ArrayList();
|
List<Byte> bytes = new ArrayList<Byte>();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while ( !done )
|
while ( !done )
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ public class HexRead
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Byte[] polished = (Byte[]) bytes.toArray( new Byte[0] );
|
Byte[] polished = bytes.toArray( new Byte[0] );
|
||||||
byte[] rval = new byte[polished.length];
|
byte[] rval = new byte[polished.length];
|
||||||
for ( int j = 0; j < polished.length; j++ )
|
for ( int j = 0; j < polished.length; j++ )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user