You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/24 07:36:28 UTC

[GitHub] [dolphinscheduler] CalvinKirs commented on a change in pull request #8168: close excel file output stream

CalvinKirs commented on a change in pull request #8168:
URL: https://github.com/apache/dolphinscheduler/pull/8168#discussion_r790473993



##########
File path: dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java
##########
@@ -74,8 +75,10 @@ public static void genExcelFile(String content, String title, String xlsFilePath
         for (Map.Entry<String, Object> en : headerMap.entrySet()) {
             headerList.add(en.getKey());
         }
-        try (SXSSFWorkbook wb = new SXSSFWorkbook(XLSX_WINDOW_ROW);
-             FileOutputStream fos = new FileOutputStream(String.format("%s/%s.xlsx", xlsFilePath, title))) {
+        FileOutputStream fos = null ;
+        try  {
+            SXSSFWorkbook wb = new SXSSFWorkbook(XLSX_WINDOW_ROW);
+            fos = new FileOutputStream(String.format("%s/%s.xlsx", xlsFilePath, title));

Review comment:
       best to use ` try with resources`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org