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/07/12 09:50:14 UTC

[GitHub] [dolphinscheduler] didiaode18 opened a new issue, #10903: [Bug][Alert] SXSSFWorkbook bug

didiaode18 opened a new issue, #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   ![image](https://user-images.githubusercontent.com/22792154/178461062-6a35e588-76cc-47af-b631-2d1d03fb461e.png)
   When I set the alarm instance to attach or table attachement mode, I found that the alarm does not trigger
   
   ### What you expected to happen
   
   Able to receive alert emails
   
   ### How to reproduce
   
   When I debug remotely, I found that I jumped directly to finally when I walked to the annotation part of the screenshot.
   ![image](https://user-images.githubusercontent.com/22792154/178462468-86f6697c-ef54-49bd-9302-362384c54140.png)
   When I replace SXSSFWorkbook with HSSFWorkbook, the alarm can be triggered
   
   
   
   
   ### Anything else
   
    public static void genExcelFile(String content, String title, String xlsFilePath) {
           List<LinkedHashMap> itemsList;
   
           //The JSONUtils.toList has been try catch ex
           itemsList = JSONUtils.toList(content, LinkedHashMap.class);
   
           if (CollectionUtils.isEmpty(itemsList)) {
               logger.error("itemsList is null");
               throw new AlertEmailException("itemsList is null");
           }
   
           LinkedHashMap<String, Object> headerMap = itemsList.get(0);
   
           List<String> headerList = new ArrayList<>();
   
           for (Map.Entry<String, Object> en : headerMap.entrySet()) {
               headerList.add(en.getKey());
           }
   
           HSSFWorkbook wb = null;
           FileOutputStream fos = null;
           try {
               // declare a workbook
               wb = new HSSFWorkbook();
               // generate a table
               HSSFSheet sheet = wb.createSheet();
               HSSFRow row = sheet.createRow(0);
               //set the height of the first line
               row.setHeight((short) 500);
   
               //set Horizontal right
               CellStyle cellStyle = wb.createCellStyle();
               cellStyle.setAlignment(HorizontalAlignment.RIGHT);
   
               //setting excel headers
               for (int i = 0; i < headerList.size(); i++) {
                   HSSFCell cell = row.createCell(i);
                   cell.setCellStyle(cellStyle);
                   cell.setCellValue(headerList.get(i));
               }
   
               //setting excel body
               int rowIndex = 1;
               for (LinkedHashMap<String, Object> itemsMap : itemsList) {
                   Object[] values = itemsMap.values().toArray();
                   row = sheet.createRow(rowIndex);
                   //setting excel body height
                   row.setHeight((short) 500);
                   rowIndex++;
                   for (int j = 0; j < values.length; j++) {
                       HSSFCell cell1 = row.createCell(j);
                       cell1.setCellStyle(cellStyle);
                       cell1.setCellValue(String.valueOf(values[j]));
                   }
               }
   
               for (int i = 0; i < headerList.size(); i++) {
                   sheet.setColumnWidth(i, headerList.get(i).length() * 800);
               }
   
               File file = new File(xlsFilePath);
               if (!file.exists()) {
                   file.mkdirs();
               }
   
               //setting file output
               fos = new FileOutputStream(xlsFilePath + EmailConstants.SINGLE_SLASH + title + EmailConstants.EXCEL_SUFFIX_XLSX);
   
               wb.write(fos);
   
           } catch (Exception e) {
               throw new AlertEmailException("generate excel error", e);
           } finally {
               if (wb != null) {
                   try {
                       wb.close();
                   } catch (IOException e) {
                       logger.error(e.getMessage(), e);
                   }
               }
               if (fos != null) {
                   try {
                       fos.close();
                   } catch (IOException e) {
                       logger.error(e.getMessage(), e);
                   }
               }
           }
       }
   
   The above code can trigger the alarm
   
   ### Version
   
   2.0.5
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.apache.org

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


[GitHub] [dolphinscheduler] didiaode18 commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
didiaode18 commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1181556842

   @ruanwenjun 


-- 
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


[GitHub] [dolphinscheduler] didiaode18 commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
didiaode18 commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1182900883

   Thank you ruanwenjun, I have tested ExcelUtilsTest#testGenExcelFile in both linux and windows, it can generate EXCEL. But in the officially deployed 2.0.5 environment, I passed the debug code, and when the genExcelFile method finished wb.write(fos), it directly reported an exception and could not go to the next step. @ruanwenjun 


-- 
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


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1181574738

   Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
   * In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
   * If you haven't received a reply for a long time, you can [join our slack](https://s.apache.org/dolphinscheduler-slack) and send your question to channel `#troubleshooting`


-- 
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


[GitHub] [dolphinscheduler] github-actions[bot] closed issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #10903: [Bug][Alert] SXSSFWorkbook bug
URL: https://github.com/apache/dolphinscheduler/issues/10903


-- 
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


[GitHub] [dolphinscheduler] ruanwenjun commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1182730646

   I just test the method `ExcelUtils#genExcelFile`, this can work well,  you can use `ExcelUtilsTest#testGenExcelFile` or write a test to test this method. You may need to provide more information.


-- 
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


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1227881481

   This issue has been closed because it has not received response for too long time. You could reopen it if you encountered similar problems in the future.


-- 
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


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #10903: [Bug][Alert] SXSSFWorkbook bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903#issuecomment-1213610745

   This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.


-- 
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