diff --git a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtil.java b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtil.java index 716da2d65c..096cd0c1ba 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtil.java +++ b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtil.java @@ -28,7 +28,6 @@ import org.apache.poi.ss.util.CellUtil; import org.apache.poi.xssf.XSSFITestDataProvider; import org.apache.poi.xssf.usermodel.XSSFColor; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.IOException; @@ -41,7 +40,6 @@ class TestXSSFCellUtil extends BaseTestCellUtil { super(XSSFITestDataProvider.instance); } - @Disabled("see bug-66052 comment 10") @Test public void testSetForegroundColorCellStyleProperty() throws IOException, DecoderException { try (Workbook workbook = new XSSFWorkbook()) { diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java index 29c2f2a524..89e0fc74fd 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.apache.logging.log4j.LogManager; @@ -415,16 +416,16 @@ public final class CellUtil { cell.setCellStyle(newStyle); } - private static boolean styleMapsMatch(final Map map1, final Map map2) { - final Map map1Copy = new HashMap<>(map1); - final Map map2Copy = new HashMap<>(map2); + private static boolean styleMapsMatch(final Map newProps, final Map storedProps) { + final Map map1Copy = new HashMap<>(newProps); + final Map map2Copy = new HashMap<>(storedProps); final Object backColor1 = map1Copy.remove(FILL_BACKGROUND_COLOR_COLOR); final Object backColor2 = map2Copy.remove(FILL_BACKGROUND_COLOR_COLOR); final Object foreColor1 = map1Copy.remove(FILL_FOREGROUND_COLOR_COLOR); final Object foreColor2 = map2Copy.remove(FILL_FOREGROUND_COLOR_COLOR); if (map1Copy.equals(map2Copy)) { - final boolean backColorsMatch = backColor1 == null || backColor2 == null || backColor1.equals(backColor2); - final boolean foreColorsMatch = foreColor1 == null || foreColor2 == null || foreColor1.equals(foreColor2); + final boolean backColorsMatch = backColor2 == null || Objects.equals(backColor1, backColor2); + final boolean foreColorsMatch = foreColor2 == null || Objects.equals(foreColor1, foreColor2); return backColorsMatch && foreColorsMatch; } return false;