Untitled
unknown
plain_text
2 years ago
2.6 kB
8
Indexable
private void addDcBcpReportLogic(List<Map<String, Object>> list, XSSFSheet hssfSheet, XSSFCellStyle h11,
int startRow1, int startColumn, XSSFWorkbook wb, String reportDate, List<Map<String, Object>> list2,
int startRow0) {
XSSFCellStyle ws = wb.createCellStyle();
ws.setFillForegroundColor(HSSFColor.ROYAL_BLUE.index);
ws.setBorderLeft(XSSFCellStyle.BORDER_THIN);
ws.setBorderBottom(XSSFCellStyle.BORDER_THIN);
ws.setBorderRight(XSSFCellStyle.BORDER_THIN);
ws.setBorderTop(XSSFCellStyle.BORDER_THIN);
ws.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
ws.setAlignment(HSSFCellStyle.ALIGN_CENTER);
XSSFFont wf = wb.createFont();
wf.setColor(HSSFColor.WHITE.index);
ws.setFont(wf);
hssfSheet.createRow(0);
XSSFCell cell0 = hssfSheet.getRow(0).createCell(0);
cell0.setCellValue(LiteralConstants.REP_DATE);
cell0.setCellStyle(ws);
cell0 = hssfSheet.getRow(0).createCell(1);
cell0.setCellValue(reportDate);
cell0.setCellStyle(ws);
CellStyle style = wb.createCellStyle();
style.setBorderLeft(XSSFCellStyle.BORDER_THIN);
style.setBorderBottom(XSSFCellStyle.BORDER_THIN);
style.setBorderRight(XSSFCellStyle.BORDER_THIN);
style.setBorderTop(XSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setDataFormat(wb.createDataFormat().getFormat(LiteralConstants.ZERO_PERCENT));
Set<String> keys = list.get(0).keySet();
addBcpShareSplTwo(list, hssfSheet, h11, startRow1, startColumn, keys);
Set<String> keys2 = list2.get(0).keySet();
for (int i = 0; i < list2.size(); i++) {
int j = 2;
for (String key : keys2) {
XSSFCell cell = hssfSheet.getRow(startRow0 + i).createCell(j);
addDcBcpReportLogicOne(h11, list2, style, i, key, cell);
cell.setCellStyle(style);
addDcBcpReportLogicIfRefract(h11, list2, i, j, key, cell);
}
}
}
private void addDcBcpReportLogicIfRefract(XSSFCellStyle h11, List<Map<String, Object>> list2, int i, int j,
String key, XSSFCell cell) {
if (j == 2) {
if (null == list2.get(i).get(key) || list2.get(i).get(key).toString().isEmpty()) {
cell.setCellValue(String.valueOf(' '));
} else {
// LOG.info(list2.get(i).get(key).toString());
// LOG.info(Integer.parseInt(list2.get(i).get(key).toString()));
cell.setCellValue(Float.parseFloat(list2.get(i).get(key).toString()));
}
cell.setCellStyle(h11);
/* j++; */
}
}
In the above code I'm getting SAST error that Dead Code: Expression is Always false for "if (j == 2) " can you modify the above code and give me solution
Editor is loading...
Leave a Comment