https://bz.apache.org/bugzilla/show_bug.cgi?id=66052
--- Comment #10 from XL <x...@ijoinery.com> --- When the CellUtil class of r1902633 is used, the following issue occurs. If a cell style has a fill foreground color that is initially null, then the color remains null after calling CellUtil.setCellStyleProperty. The error cause is in CellUtil.styleMapsMatch in this expression : final boolean foreColorsMatch = foreColor1 == null || foreColor2 == null || foreColor1.equals(foreColor2); The previous expression can be corrected as follows : final boolean foreColorsMatch = Objects.equals(foreColor1, foreColor2); The issue can be reproduced by executing the following JUnit test, in which the assertNotNull call throws an error. package test; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellUtil; import org.apache.poi.xssf.usermodel.XSSFColor; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.jupiter.api.Test; import java.io.IOException; public class CellUtilTest { @Test public void testSetCellStyleProperty() throws IOException, DecoderException { try (Workbook workbook = new XSSFWorkbook()) { final Sheet sheet = workbook.createSheet("Sheet"); final Row row = sheet.createRow(0); final Cell cell = row.createCell(0); final XSSFColor color = new XSSFColor(Hex.decodeHex("AAAAAA")); assertNull(cell.getCellStyle().getFillForegroundColorColor()); CellUtil.setCellStyleProperty( cell, CellUtil.FILL_FOREGROUND_COLOR_COLOR, color); assertNotNull(cell.getCellStyle().getFillForegroundColorColor()); } } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org