Author: kiwiwings
Date: Sat Nov 12 00:52:10 2016
New Revision: 1769366

URL: http://svn.apache.org/viewvc?rev=1769366&view=rev
Log:
SonarCube fixes

Modified:
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
    poi/trunk/src/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java
    poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadata.java
    
poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java
    poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java

Modified: 
poi/trunk/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java?rev=1769366&r1=1769365&r2=1769366&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java 
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java 
Sat Nov 12 00:52:10 2016
@@ -318,9 +318,7 @@ public class ExcelComparator {
             
             if (!name1.equals(name2)) {
                 String str = String.format(Locale.ROOT, "%s\nworkbook1 -> %s 
[%d] != workbook2 -> %s [%d]",
-                    "Name of the sheets do not match ::",
-                    loc1.sheet.getSheetName(), name1, i+1,
-                    loc2.sheet.getSheetName(), name2, i+1
+                    "Name of the sheets do not match ::", name1, i+1, name2, 
i+1
                 );
                 listOfDifferences.add(str);
             }

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=1769366&r1=1769365&r2=1769366&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 Sat Nov 12 
00:52:10 2016
@@ -344,23 +344,25 @@ public class ToCSV {
         // (.xls) and the other a SpreadsheetML file (.xlsx), then the names
         // for both CSV files will be identical and one CSV file will,
         // therefore, over-write the other.
-        for(File excelFile : filesList) {
-            // Open the workbook
-            this.openWorkbook(excelFile);
-
-            // Convert it's contents into a CSV file
-            this.convertToCSV();
-
-            // Build the name of the csv folder from that of the Excel 
workbook.
-            // Simply replace the .xls or .xlsx file extension with .csv
-            destinationFilename = excelFile.getName();
-            destinationFilename = destinationFilename.substring(
-                    0, destinationFilename.lastIndexOf(".")) +
-                    ToCSV.CSV_FILE_EXTENSION;
-
-            // Save the CSV file away using the newly constricted file name
-            // and to the specified directory.
-            this.saveCSVFile(new File(destination, destinationFilename));
+        if (filesList != null) {
+            for(File excelFile : filesList) {
+                // Open the workbook
+                this.openWorkbook(excelFile);
+    
+                // Convert it's contents into a CSV file
+                this.convertToCSV();
+    
+                // Build the name of the csv folder from that of the Excel 
workbook.
+                // Simply replace the .xls or .xlsx file extension with .csv
+                destinationFilename = excelFile.getName();
+                destinationFilename = destinationFilename.substring(
+                        0, destinationFilename.lastIndexOf(".")) +
+                        ToCSV.CSV_FILE_EXTENSION;
+    
+                // Save the CSV file away using the newly constricted file name
+                // and to the specified directory.
+                this.saveCSVFile(new File(destination, destinationFilename));
+            }
         }
     }
 

Modified: 
poi/trunk/src/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java?rev=1769366&r1=1769365&r2=1769366&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java 
Sat Nov 12 00:52:10 2016
@@ -58,7 +58,7 @@ final class NetworkdaysFunction implemen
      * 
      * @return {@link ValueEval} for the number of days between two dates.
      */
-    public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) 
{
+    public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) 
{ // NOSONAR
         if (args.length < 2 || args.length > 3) {
             return ErrorEval.VALUE_INVALID;
         }

Modified: 
poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadata.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadata.java?rev=1769366&r1=1769365&r2=1769366&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadata.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadata.java 
Sat Nov 12 00:52:10 2016
@@ -47,7 +47,7 @@ public final class FunctionMetadata {
                _minParams = minParams;
                _maxParams = maxParams;
                _returnClassCode = returnClassCode;
-               _parameterClassCodes = parameterClassCodes;
+               _parameterClassCodes = (parameterClassCodes == null) ? null : 
parameterClassCodes.clone();
        }
        public int getIndex() {
                return _index;

Modified: 
poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java?rev=1769366&r1=1769365&r2=1769366&view=diff
==============================================================================
--- 
poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java
 (original)
+++ 
poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java
 Sat Nov 12 00:52:10 2016
@@ -49,7 +49,7 @@ public final class FunctionMetadataRegis
        }
 
        /* package */ FunctionMetadataRegistry(FunctionMetadata[] 
functionDataByIndex, Map<String, FunctionMetadata> functionDataByName) {
-               _functionDataByIndex = functionDataByIndex;
+               _functionDataByIndex = (functionDataByIndex == null) ? null : 
functionDataByIndex.clone();
                _functionDataByName = functionDataByName;
        }
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java?rev=1769366&r1=1769365&r2=1769366&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java Sat Nov 12 
00:52:10 2016
@@ -207,8 +207,11 @@ public final class OOXMLLite {
     private static void collectTests(File root, File arg, List<Class<?>> out, 
String ptrn, String exclude)
     throws ClassNotFoundException {
         if (arg.isDirectory()) {
-            for (File f : arg.listFiles()) {
-                collectTests(root, f, out, ptrn, exclude);
+            File files[] = arg.listFiles();
+            if (files != null) {
+                for (File f : files) {
+                    collectTests(root, f, out, ptrn, exclude);
+                }
             }
         } else {
             String path = arg.getAbsolutePath();



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to