This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git
The following commit(s) were added to refs/heads/trunk by this push:
new 576d553 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
576d553 is described below
commit 576d5534a288b77d130eac2ba95862b112ac836c
Author: Jacques Le Roux <[email protected]>
AuthorDate: Fri Dec 10 08:49:12 2021 +0100
Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
In AbstractPricatParser::writeCommentsToFile fixes a possible null
dereferencement
Fixes 2 JavaDoc issues
---
.../java/org/apache/ofbiz/pricat/AbstractPricatParser.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
index 19643d1..673f31c 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
@@ -303,6 +303,10 @@ public abstract class AbstractPricatParser implements
InterfacePricatParser {
@Override
public void writeCommentsToFile(XSSFWorkbook workbook, XSSFSheet sheet) {
+ if (workbook == null) {
+ Debug.logError("workbook war is null; Nothing can be done",
MODULE);
+ }
+
report.println();
report.print(UtilProperties.getMessage(RESOURCE,
"WriteCommentsBackToExcel", locale), InterfaceReport.FORMAT_NOTE);
FileOutputStream fos = null;
@@ -443,12 +447,10 @@ public abstract class AbstractPricatParser implements
InterfacePricatParser {
Debug.logError(e, MODULE);
}
}
- if (workbook != null) {
- try {
- workbook.close();
- } catch (IOException e) {
- Debug.logError(e, MODULE);
- }
+ try {
+ workbook.close();
+ } catch (IOException e) {
+ Debug.logError(e, MODULE);
}
}
report.println(UtilProperties.getMessage(RESOURCE, "ok", locale),
InterfaceReport.FORMAT_OK);