SonarCube fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1769366 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-11-12 00:52:10 +00:00
parent fc86b15f13
commit a6f005de81
6 changed files with 28 additions and 25 deletions

View File

@ -318,9 +318,7 @@ public class ExcelComparator {
if (!name1.equals(name2)) { if (!name1.equals(name2)) {
String str = String.format(Locale.ROOT, "%s\nworkbook1 -> %s [%d] != workbook2 -> %s [%d]", String str = String.format(Locale.ROOT, "%s\nworkbook1 -> %s [%d] != workbook2 -> %s [%d]",
"Name of the sheets do not match ::", "Name of the sheets do not match ::", name1, i+1, name2, i+1
loc1.sheet.getSheetName(), name1, i+1,
loc2.sheet.getSheetName(), name2, i+1
); );
listOfDifferences.add(str); listOfDifferences.add(str);
} }

View File

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

View File

@ -58,7 +58,7 @@ final class NetworkdaysFunction implements FreeRefFunction {
* *
* @return {@link ValueEval} for the number of days between two dates. * @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) { if (args.length < 2 || args.length > 3) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

View File

@ -47,7 +47,7 @@ public final class FunctionMetadata {
_minParams = minParams; _minParams = minParams;
_maxParams = maxParams; _maxParams = maxParams;
_returnClassCode = returnClassCode; _returnClassCode = returnClassCode;
_parameterClassCodes = parameterClassCodes; _parameterClassCodes = (parameterClassCodes == null) ? null : parameterClassCodes.clone();
} }
public int getIndex() { public int getIndex() {
return _index; return _index;

View File

@ -49,7 +49,7 @@ public final class FunctionMetadataRegistry {
} }
/* package */ FunctionMetadataRegistry(FunctionMetadata[] functionDataByIndex, Map<String, FunctionMetadata> functionDataByName) { /* package */ FunctionMetadataRegistry(FunctionMetadata[] functionDataByIndex, Map<String, FunctionMetadata> functionDataByName) {
_functionDataByIndex = functionDataByIndex; _functionDataByIndex = (functionDataByIndex == null) ? null : functionDataByIndex.clone();
_functionDataByName = functionDataByName; _functionDataByName = functionDataByName;
} }

View File

@ -207,8 +207,11 @@ public final class OOXMLLite {
private static void collectTests(File root, File arg, List<Class<?>> out, String ptrn, String exclude) private static void collectTests(File root, File arg, List<Class<?>> out, String ptrn, String exclude)
throws ClassNotFoundException { throws ClassNotFoundException {
if (arg.isDirectory()) { if (arg.isDirectory()) {
for (File f : arg.listFiles()) { File files[] = arg.listFiles();
collectTests(root, f, out, ptrn, exclude); if (files != null) {
for (File f : files) {
collectTests(root, f, out, ptrn, exclude);
}
} }
} else { } else {
String path = arg.getAbsolutePath(); String path = arg.getAbsolutePath();