Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
3
Indexable
	private void addDataFromSplitTwo(List<Map<String, Object>> riskRegisterLOV, HSSFSheet lovs, HSSFCellStyle c2,
			HSSFCellStyle c1, int startRow, int startColumn, String sheet, ResourceBundle rb, Set<String> keys, int i)
			throws NumberFormatException {
		lovs.createRow(startRow + i);
		int j = startColumn;
		for (String key : keys) {
			addDatFromSplitOne(riskRegisterLOV, lovs, c2, c1, startRow, sheet, rb, i, j, key);
		}
	}

	private void addDatFromSplitOne(List<Map<String, Object>> riskRegisterLOV, HSSFSheet lovs, HSSFCellStyle c2,
			HSSFCellStyle c1, int startRow, String sheet, ResourceBundle rb, int i, int j, String key)
			throws NumberFormatException {
		HSSFCell cell = lovs.getRow(startRow + i).createCell(j);
		if (null != riskRegisterLOV.get(i).get(key)) {
			if (riskRegisterLOV.get(i).get(key) instanceof BigDecimal
					|| riskRegisterLOV.get(i).get(key) instanceof Integer) {
				cell.setCellValue(Double.valueOf("" + riskRegisterLOV.get(i).get(key)));
			} else {
				cell.setCellValue(ParsingUtil.validateString(String.valueOf(riskRegisterLOV.get(i).get(key))));
			}
		} else {
			cell.setCellValue("NA");
		}
		cell.setCellStyle(c2);
		j++;
		if (j == 17 && LiteralConstants.GOVERNANCE.equalsIgnoreCase(sheet)) {
			lovs.protectSheet("Pass123");
			while (j <= 20) {
				cell = lovs.getRow(startRow + i).createCell(j);
				cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
				cell.setCellFormula(rb.getString("" + j));
				cell.setCellStyle(c1);
				j++;
			}
		}
	}

In the above code I'm getting SAST error that Dead Code: Expression is Always false for "if (j == 17 && LiteralConstants.GOVERNANCE.equalsIgnoreCase(sheet))" can you modify the above code and give me solution
Editor is loading...
Leave a Comment