Remove some IDE warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1838733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78dac9bd50
commit
5acb18ac04
@ -27,7 +27,6 @@ import java.io.FilenameFilter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellType;
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||||
@ -182,13 +181,10 @@ public class ToCSV {
|
|||||||
* exist or if the value passed to the strDestination paramater refers
|
* exist or if the value passed to the strDestination paramater refers
|
||||||
* to a folder that does not exist or simply does not refer to a
|
* to a folder that does not exist or simply does not refer to a
|
||||||
* folder.
|
* folder.
|
||||||
* @throws org.apache.poi.openxml4j.exceptions.InvalidFormatException Thrown
|
|
||||||
* if the xml markup encountered whilst parsing a SpreadsheetML
|
|
||||||
* file (.xlsx) is invalid.
|
|
||||||
*/
|
*/
|
||||||
public void convertExcelToCSV(String strSource, String strDestination)
|
public void convertExcelToCSV(String strSource, String strDestination)
|
||||||
throws FileNotFoundException, IOException,
|
throws FileNotFoundException, IOException,
|
||||||
IllegalArgumentException, InvalidFormatException {
|
IllegalArgumentException {
|
||||||
|
|
||||||
// Simply chain the call to the overloaded convertExcelToCSV(String,
|
// Simply chain the call to the overloaded convertExcelToCSV(String,
|
||||||
// String, String, int) method, pass the default separator and ensure
|
// String, String, int) method, pass the default separator and ensure
|
||||||
@ -226,14 +222,11 @@ public class ToCSV {
|
|||||||
* exist or if the value passed to the strDestination paramater refers
|
* exist or if the value passed to the strDestination paramater refers
|
||||||
* to a folder that does not exist or simply does not refer to a
|
* to a folder that does not exist or simply does not refer to a
|
||||||
* folder.
|
* folder.
|
||||||
* @throws org.apache.poi.openxml4j.exceptions.InvalidFormatException Thrown
|
|
||||||
* if the xml markup encounetered whilst parsing a SpreadsheetML
|
|
||||||
* file (.xlsx) is invalid.
|
|
||||||
*/
|
*/
|
||||||
public void convertExcelToCSV(String strSource, String strDestination,
|
public void convertExcelToCSV(String strSource, String strDestination,
|
||||||
String separator)
|
String separator)
|
||||||
throws FileNotFoundException, IOException,
|
throws FileNotFoundException, IOException,
|
||||||
IllegalArgumentException, InvalidFormatException {
|
IllegalArgumentException {
|
||||||
|
|
||||||
// Simply chain the call to the overloaded convertExcelToCSV(String,
|
// Simply chain the call to the overloaded convertExcelToCSV(String,
|
||||||
// String, String, int) method and ensure that certain embedded
|
// String, String, int) method and ensure that certain embedded
|
||||||
@ -275,14 +268,11 @@ public class ToCSV {
|
|||||||
* value passed to the formattingConvention parameter is other than
|
* value passed to the formattingConvention parameter is other than
|
||||||
* one of the values defined by the constants ToCSV.EXCEL_STYLE_ESCAPING
|
* one of the values defined by the constants ToCSV.EXCEL_STYLE_ESCAPING
|
||||||
* and ToCSV.UNIX_STYLE_ESCAPING.
|
* and ToCSV.UNIX_STYLE_ESCAPING.
|
||||||
* @throws org.apache.poi.openxml4j.exceptions.InvalidFormatException Thrown
|
|
||||||
* if the xml markup encounetered whilst parsing a SpreadsheetML
|
|
||||||
* file (.xlsx) is invalid.
|
|
||||||
*/
|
*/
|
||||||
public void convertExcelToCSV(String strSource, String strDestination,
|
public void convertExcelToCSV(String strSource, String strDestination,
|
||||||
String separator, int formattingConvention)
|
String separator, int formattingConvention)
|
||||||
throws FileNotFoundException, IOException,
|
throws FileNotFoundException, IOException,
|
||||||
IllegalArgumentException, InvalidFormatException {
|
IllegalArgumentException {
|
||||||
File source = new File(strSource);
|
File source = new File(strSource);
|
||||||
File destination = new File(strDestination);
|
File destination = new File(strDestination);
|
||||||
File[] filesList;
|
File[] filesList;
|
||||||
@ -374,17 +364,11 @@ public class ToCSV {
|
|||||||
* either binary (.xls) or SpreadsheetML (.xlsx) format.
|
* either binary (.xls) or SpreadsheetML (.xlsx) format.
|
||||||
* @throws java.io.FileNotFoundException Thrown if the file cannot be located.
|
* @throws java.io.FileNotFoundException Thrown if the file cannot be located.
|
||||||
* @throws java.io.IOException Thrown if a problem occurs in the file system.
|
* @throws java.io.IOException Thrown if a problem occurs in the file system.
|
||||||
* @throws org.apache.poi.openxml4j.exceptions.InvalidFormatException Thrown
|
|
||||||
* if invalid xml is found whilst parsing an input SpreadsheetML
|
|
||||||
* file.
|
|
||||||
*/
|
*/
|
||||||
private void openWorkbook(File file) throws FileNotFoundException,
|
private void openWorkbook(File file) throws FileNotFoundException,
|
||||||
IOException, InvalidFormatException {
|
IOException {
|
||||||
FileInputStream fis = null;
|
|
||||||
try {
|
|
||||||
System.out.println("Opening workbook [" + file.getName() + "]");
|
System.out.println("Opening workbook [" + file.getName() + "]");
|
||||||
|
try (FileInputStream fis = new FileInputStream(file)) {
|
||||||
fis = new FileInputStream(file);
|
|
||||||
|
|
||||||
// Open the workbook and then create the FormulaEvaluator and
|
// Open the workbook and then create the FormulaEvaluator and
|
||||||
// DataFormatter instances that will be needed to, respectively,
|
// DataFormatter instances that will be needed to, respectively,
|
||||||
@ -394,11 +378,6 @@ public class ToCSV {
|
|||||||
this.evaluator = this.workbook.getCreationHelper().createFormulaEvaluator();
|
this.evaluator = this.workbook.getCreationHelper().createFormulaEvaluator();
|
||||||
this.formatter = new DataFormatter(true);
|
this.formatter = new DataFormatter(true);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
if(fis != null) {
|
|
||||||
fis.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,12 +46,12 @@ public abstract class XDDFChartData {
|
|||||||
private List<XDDFValueAxis> valueAxes;
|
private List<XDDFValueAxis> valueAxes;
|
||||||
|
|
||||||
protected XDDFChartData() {
|
protected XDDFChartData() {
|
||||||
this.series = new ArrayList<Series>();
|
this.series = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void defineAxes(CTUnsignedInt[] axes, Map<Long, XDDFChartAxis> categories,
|
protected void defineAxes(CTUnsignedInt[] axes, Map<Long, XDDFChartAxis> categories,
|
||||||
Map<Long, XDDFValueAxis> values) {
|
Map<Long, XDDFValueAxis> values) {
|
||||||
List<XDDFValueAxis> list = new ArrayList<XDDFValueAxis>(axes.length);
|
List<XDDFValueAxis> list = new ArrayList<>(axes.length);
|
||||||
for (CTUnsignedInt axe : axes) {
|
for (CTUnsignedInt axe : axes) {
|
||||||
Long axisId = axe.getVal();
|
Long axisId = axe.getVal();
|
||||||
XDDFChartAxis category = categories.get(axisId);
|
XDDFChartAxis category = categories.get(axisId);
|
||||||
|
@ -182,6 +182,7 @@ public final class TestSharedStringsTable extends TestCase {
|
|||||||
assertEquals("Second string", sst.getItemAt(2).toString());
|
assertEquals("Second string", sst.getItemAt(2).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void testReadWrite() throws IOException {
|
public void testReadWrite() throws IOException {
|
||||||
XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("sample.xlsx");
|
XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("sample.xlsx");
|
||||||
SharedStringsTable sst1 = wb1.getSharedStringSource();
|
SharedStringsTable sst1 = wb1.getSharedStringSource();
|
||||||
|
Loading…
Reference in New Issue
Block a user