poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1838733 - in /poi/trunk/src: examples/src/org/apache/poi/ss/examples/ToCSV.java ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java
Date Thu, 23 Aug 2018 13:34:25 GMT
Author: centic
Date: Thu Aug 23 13:34:25 2018
New Revision: 1838733

URL: http://svn.apache.org/viewvc?rev=1838733&view=rev
Log:
Remove some IDE warnings

Modified:
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
    poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java?rev=1838733&r1=1838732&r2=1838733&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java Thu Aug 23 13:34:25 2018
@@ -27,7 +27,6 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 import java.util.ArrayList;
 
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellType;
 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
      *         to a folder that does not exist or simply does not refer to a
      *         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)
                        throws FileNotFoundException, IOException,
-                              IllegalArgumentException, InvalidFormatException {
+                              IllegalArgumentException {
 
         // Simply chain the call to the overloaded convertExcelToCSV(String,
         // 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
      *         to a folder that does not exist or simply does not refer to a
      *         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,
                                   String separator)
                        throws FileNotFoundException, IOException,
-                              IllegalArgumentException, InvalidFormatException {
+                              IllegalArgumentException {
 
         // Simply chain the call to the overloaded convertExcelToCSV(String,
         // 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
      *         one of the values defined by the constants ToCSV.EXCEL_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,
                                   String separator, int formattingConvention)
                        throws FileNotFoundException, IOException,
-                              IllegalArgumentException, InvalidFormatException {
+                              IllegalArgumentException {
         File source = new File(strSource);
         File destination = new File(strDestination);
         File[] filesList;
@@ -374,17 +364,11 @@ public class ToCSV {
      *        either binary (.xls) or SpreadsheetML (.xlsx) format.
      * @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 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,
-                                           IOException, InvalidFormatException {
-        FileInputStream fis = null;
-        try {
-            System.out.println("Opening workbook [" + file.getName() + "]");
-
-            fis = new FileInputStream(file);
+                                           IOException {
+        System.out.println("Opening workbook [" + file.getName() + "]");
+        try (FileInputStream fis = new FileInputStream(file)) {
 
             // Open the workbook and then create the FormulaEvaluator and
             // DataFormatter instances that will be needed to, respectively,
@@ -394,11 +378,6 @@ public class ToCSV {
             this.evaluator = this.workbook.getCreationHelper().createFormulaEvaluator();
             this.formatter = new DataFormatter(true);
         }
-        finally {
-            if(fis != null) {
-                fis.close();
-            }
-        }
     }
 
     /**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java?rev=1838733&r1=1838732&r2=1838733&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Thu Aug
23 13:34:25 2018
@@ -46,12 +46,12 @@ public abstract class XDDFChartData {
     private List<XDDFValueAxis> valueAxes;
 
     protected XDDFChartData() {
-        this.series = new ArrayList<Series>();
+        this.series = new ArrayList<>();
     }
 
     protected void defineAxes(CTUnsignedInt[] axes, Map<Long, XDDFChartAxis> categories,
             Map<Long, XDDFValueAxis> values) {
-        List<XDDFValueAxis> list = new ArrayList<XDDFValueAxis>(axes.length);
+        List<XDDFValueAxis> list = new ArrayList<>(axes.length);
         for (CTUnsignedInt axe : axes) {
             Long axisId = axe.getVal();
             XDDFChartAxis category = categories.get(axisId);

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java?rev=1838733&r1=1838732&r2=1838733&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestSharedStringsTable.java Thu
Aug 23 13:34:25 2018
@@ -182,6 +182,7 @@ public final class TestSharedStringsTabl
         assertEquals("Second string", sst.getItemAt(2).toString());
     }
 
+    @SuppressWarnings("deprecation")
     public void testReadWrite() throws IOException {
         XSSFWorkbook wb1 = XSSFTestDataSamples.openSampleWorkbook("sample.xlsx");
         SharedStringsTable sst1 = wb1.getSharedStringSource();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message