aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-11-12 00:52:10 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-11-12 00:52:10 +0000
commitb7173825488fe9109b46da47a5745f3ee10571fa (patch)
tree6ab2b75eab0ea32ada6487e38a7228cdb2838485 /src/examples
parent446ed93c4a0a6d0fc7127670f7fe1f38b00db4be (diff)
downloadpoi-b7173825488fe9109b46da47a5745f3ee10571fa.tar.gz
poi-b7173825488fe9109b46da47a5745f3ee10571fa.zip
SonarCube fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1769366 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java4
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/ToCSV.java36
2 files changed, 20 insertions, 20 deletions
diff --git a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java
index d6f846a6bb..5ed404e2d3 100644
--- a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java
+++ b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java
@@ -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);
}
diff --git a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
index 532b89c0f7..b6c5ea9729 100644
--- a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
+++ b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
@@ -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));
+ }
}
}