Fix some Eclipse warnings and adjust use of Generics, Comments, close()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691308 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c54cc66158
commit
0c410544a9
@ -50,5 +50,7 @@ public class CreateCells {
|
|||||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||||
wb.write(fileOut);
|
wb.write(fileOut);
|
||||||
fileOut.close();
|
fileOut.close();
|
||||||
|
|
||||||
|
wb.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,25 +168,29 @@ public class BigGridDemo {
|
|||||||
private static void substitute(File zipfile, File tmpfile, String entry, OutputStream out) throws IOException {
|
private static void substitute(File zipfile, File tmpfile, String entry, OutputStream out) throws IOException {
|
||||||
ZipFile zip = ZipHelper.openZipFile(zipfile);
|
ZipFile zip = ZipHelper.openZipFile(zipfile);
|
||||||
|
|
||||||
ZipOutputStream zos = new ZipOutputStream(out);
|
try {
|
||||||
|
ZipOutputStream zos = new ZipOutputStream(out);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
|
Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
|
||||||
while (en.hasMoreElements()) {
|
while (en.hasMoreElements()) {
|
||||||
ZipEntry ze = en.nextElement();
|
ZipEntry ze = en.nextElement();
|
||||||
if(!ze.getName().equals(entry)){
|
if(!ze.getName().equals(entry)){
|
||||||
zos.putNextEntry(new ZipEntry(ze.getName()));
|
zos.putNextEntry(new ZipEntry(ze.getName()));
|
||||||
InputStream is = zip.getInputStream(ze);
|
InputStream is = zip.getInputStream(ze);
|
||||||
copyStream(is, zos);
|
copyStream(is, zos);
|
||||||
is.close();
|
is.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
zos.putNextEntry(new ZipEntry(entry));
|
||||||
|
InputStream is = new FileInputStream(tmpfile);
|
||||||
|
copyStream(is, zos);
|
||||||
|
is.close();
|
||||||
|
|
||||||
|
zos.close();
|
||||||
|
} finally {
|
||||||
|
zip.close();
|
||||||
}
|
}
|
||||||
zos.putNextEntry(new ZipEntry(entry));
|
|
||||||
InputStream is = new FileInputStream(tmpfile);
|
|
||||||
copyStream(is, zos);
|
|
||||||
is.close();
|
|
||||||
|
|
||||||
zos.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void copyStream(InputStream in, OutputStream out) throws IOException {
|
private static void copyStream(InputStream in, OutputStream out) throws IOException {
|
||||||
|
@ -285,7 +285,7 @@ public class Section
|
|||||||
/*
|
/*
|
||||||
* Extract the dictionary (if available).
|
* Extract the dictionary (if available).
|
||||||
*/
|
*/
|
||||||
dictionary = (Map) getProperty(0);
|
dictionary = (Map<Long,String>) getProperty(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public final class OperandResolver {
|
|||||||
*/
|
*/
|
||||||
public static ValueEval getSingleValue(ValueEval arg, int srcCellRow, int srcCellCol)
|
public static ValueEval getSingleValue(ValueEval arg, int srcCellRow, int srcCellCol)
|
||||||
throws EvaluationException {
|
throws EvaluationException {
|
||||||
ValueEval result;
|
final ValueEval result;
|
||||||
if (arg instanceof RefEval) {
|
if (arg instanceof RefEval) {
|
||||||
result = chooseSingleElementFromRef((RefEval) arg);
|
result = chooseSingleElementFromRef((RefEval) arg);
|
||||||
} else if (arg instanceof AreaEval) {
|
} else if (arg instanceof AreaEval) {
|
||||||
|
@ -491,7 +491,7 @@ public final class Countif extends Fixed2ArgFunction {
|
|||||||
*/
|
*/
|
||||||
private static ValueEval evaluateCriteriaArg(ValueEval arg, int srcRowIndex, int srcColumnIndex) {
|
private static ValueEval evaluateCriteriaArg(ValueEval arg, int srcRowIndex, int srcColumnIndex) {
|
||||||
try {
|
try {
|
||||||
return OperandResolver.getSingleValue(arg, srcRowIndex, (short)srcColumnIndex);
|
return OperandResolver.getSingleValue(arg, srcRowIndex, srcColumnIndex);
|
||||||
} catch (EvaluationException e) {
|
} catch (EvaluationException e) {
|
||||||
return e.getErrorEval();
|
return e.getErrorEval();
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ public final class Sumifs implements FreeRefFunction {
|
|||||||
public static final FreeRefFunction instance = new Sumifs();
|
public static final FreeRefFunction instance = new Sumifs();
|
||||||
|
|
||||||
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
|
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
|
||||||
|
// need at least 3 arguments and need to have an odd number of arguments (sum-range plus x*(criteria_range, criteria))
|
||||||
if(args.length < 3 || args.length % 2 == 0) {
|
if(args.length < 3 || args.length % 2 == 0) {
|
||||||
return ErrorEval.VALUE_INVALID;
|
return ErrorEval.VALUE_INVALID;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user