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;
}
}
Formatter formatter = new Formatter(toAppendTo);
- formatter.format(printfFmt, parts);
+ try {
+ formatter.format(printfFmt, parts);
+ } finally {
+ formatter.close();
+ }
}
/**
}
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;
} 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);
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);
}
*/
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);
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();
}
-
}
}
{
int characterCount = 0;
byte b = (byte) 0;
- List bytes = new ArrayList();
+ List<Byte> bytes = new ArrayList<Byte>();
boolean done = false;
while ( !done )
{
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++ )
{