Some Eclipse warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1647269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-12-22 09:16:16 +00:00
parent e34ea114ff
commit bd9594151a
3 changed files with 96 additions and 78 deletions

View File

@ -96,7 +96,7 @@ final class OperationEvaluatorFactory {
private static void put(Map<OperationPtg, Function> m, OperationPtg ptgKey,
Function instance) {
// make sure ptg has single private constructor because map lookups assume singleton keys
Constructor[] cc = ptgKey.getClass().getDeclaredConstructors();
Constructor<?>[] cc = ptgKey.getClass().getDeclaredConstructors();
if (cc.length > 1 || !Modifier.isPrivate(cc[0].getModifiers())) {
throw new RuntimeException("Failed to verify instance ("
+ ptgKey.getClass().getName() + ") is a singleton.");

View File

@ -118,8 +118,9 @@ public final class TestXSSFCell extends BaseTestCell {
assertEquals(XSSFCell.CELL_TYPE_BLANK, cell_1.getCellType());
}
public void testFormulaString() {
public void testFormulaString() throws IOException {
XSSFWorkbook wb = new XSSFWorkbook();
try {
XSSFCell cell = wb.createSheet().createRow(0).createCell(0);
CTCell ctCell = cell.getCTCell(); //low-level bean holding cell's xml
@ -150,6 +151,9 @@ public final class TestXSSFCell extends BaseTestCell {
assertEquals(XSSFCell.CELL_TYPE_BLANK, cell.getCellType());
assertEquals(STCellType.N, ctCell.getT());
assertEquals("", cell.getStringCellValue());
} finally {
wb.close();
}
}
/**
@ -183,15 +187,20 @@ public final class TestXSSFCell extends BaseTestCell {
/**
* Cell with the formula that returns error must return error code(There was
* an problem that cell could not return error value form formula cell).
* @throws IOException
*/
public void testGetErrorCellValueFromFormulaCell() {
public void testGetErrorCellValueFromFormulaCell() throws IOException {
XSSFWorkbook wb = new XSSFWorkbook();
try {
XSSFSheet sheet = wb.createSheet();
XSSFRow row = sheet.createRow(0);
XSSFCell cell = row.createCell(0);
cell.setCellFormula("SQRT(-1)");
wb.getCreationHelper().createFormulaEvaluator().evaluateFormulaCell(cell);
assertEquals(36, cell.getErrorCellValue());
} finally {
wb.close();
}
}
public void testMissingRAttribute() {
@ -214,8 +223,8 @@ public final class TestXSSFCell extends BaseTestCell {
assertCellsWithMissingR(row);
wb = (XSSFWorkbook)_testDataProvider.writeOutAndReadBack(wb);
row = wb.getSheetAt(0).getRow(0);
XSSFWorkbook wbNew = (XSSFWorkbook)_testDataProvider.writeOutAndReadBack(wb);
row = wbNew.getSheetAt(0).getRow(0);
assertCellsWithMissingR(row);
}
@ -335,6 +344,7 @@ public final class TestXSSFCell extends BaseTestCell {
public void test56170Reproduce() throws IOException {
final Workbook wb = new XSSFWorkbook();
try {
final Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
@ -362,6 +372,9 @@ public final class TestXSSFCell extends BaseTestCell {
// now check again
validateRow(row);
} finally {
wb.close();
}
}
private void validateRow(Row row) {

View File

@ -16,11 +16,14 @@
==================================================================== */
package org.apache.poi.ss.format;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.*;
import javax.swing.JLabel;
import junit.framework.TestCase;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
@ -29,8 +32,6 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import junit.framework.TestCase;
public class TestCellFormat extends TestCase {
private static final String _255_POUND_SIGNS;
@ -825,15 +826,19 @@ public class TestCellFormat extends TestCase {
}
public void testSimpleFractionFormat() {
public void testSimpleFractionFormat() throws IOException {
CellFormat cf1 = CellFormat.getInstance("# ?/?");
// Create a workbook, row and cell to test with
Workbook wb = new HSSFWorkbook();
try {
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
cell.setCellValue(123456.6);
System.out.println(cf1.apply(cell).text);
assertEquals("123456 3/5", cf1.apply(cell).text);
} finally {
wb.close();
}
}
}