From 69036c64eaeff5dc01d8f28c4639ed886c3caf43 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 10 Jul 2022 14:32:49 +0000 Subject: [PATCH] remove ignoreInvalidColors param git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902634 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/XSSFCellStyle.java | 12 +++----- .../poi/hssf/usermodel/HSSFCellStyle.java | 12 +++----- .../apache/poi/ss/usermodel/CellStyle.java | 30 ++----------------- 3 files changed, 10 insertions(+), 44 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index 40949f4415..9fea94baff 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -833,16 +833,14 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { * Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value. *
* @param color org.apache.poi.ss.usermodel.Color to set - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * HSSFColor on a XSSFCellStyle * @throws IllegalArgumentException if you provide a Color instance that is not a {@link XSSFColor} * @since POI 5.2.3 */ @Override - public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color, boolean ignoreInvalidColors) { + public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color) { if (color == null || color instanceof XSSFColor) { setFillBackgroundColor((XSSFColor)color); - } else if (!ignoreInvalidColors) { + } else { throw new IllegalArgumentException("XSSFCellStyle only accepts XSSFColor instances"); } } @@ -905,16 +903,14 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { * Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value. *
* @param color the color to use - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * HSSFColor on a XSSFCellStyle * @throws IllegalArgumentException if you provide a Color instance that is not a {@link XSSFColor} * @since POI 5.2.3 */ @Override - public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color, boolean ignoreInvalidColors) { + public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color) { if (color == null || color instanceof XSSFColor) { setFillForegroundColor((XSSFColor)color); - } else if (!ignoreInvalidColors) { + } else { throw new IllegalArgumentException("XSSFCellStyle only accepts XSSFColor instances"); } } diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index b16d795174..55621d9095 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -642,18 +642,16 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable { * Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value. *
* @param color the color to use - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * XSSFColor on a HSSFCellStyle * @throws IllegalArgumentException if you provide a Color instance that is not a {@link HSSFColor} * @since POI 5.2.3 */ @Override - public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color, boolean ignoreInvalidColors) + public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color) { if (color instanceof HSSFColor) { short index2 = ((HSSFColor)color).getIndex2(); if (index2 != -1) setFillBackgroundColor(index2); - } else if (color != null && !ignoreInvalidColors) { + } else if (color != null) { throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances"); } } @@ -703,18 +701,16 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable { * Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value. *
* @param color the color to use - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * XSSFColor on a HSSFCellStyle * @throws IllegalArgumentException if you provide a Color instance that is not a {@link HSSFColor} * @since POI 5.2.3 */ @Override - public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color, boolean ignoreInvalidColors) + public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color) { if (color instanceof HSSFColor) { short index2 = ((HSSFColor)color).getIndex2(); if (index2 != -1) setFillForegroundColor(index2); - } else if (color != null && !ignoreInvalidColors) { + } else if (color != null) { throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances"); } } diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java b/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java index cc446886c0..89908b10c8 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -318,20 +318,7 @@ public interface CellStyle { * @param color org.apache.poi.ss.usermodel.Color to set * @since POI 5.2.3 */ - default void setFillBackgroundColor(Color color) { - setFillBackgroundColor(color, false); - } - - /** - * Set the background fill color. - * Uses a {@link org.apache.poi.ss.usermodel.Color} instead of an indexed color. - * - * @param color org.apache.poi.ss.usermodel.Color to set - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * HSSFColor on a XSSFCellStyle - * @since POI 5.2.3 - */ - void setFillBackgroundColor(Color color, boolean ignoreInvalidColors); + void setFillBackgroundColor(Color color); /** * get the background fill color, if the fill @@ -363,20 +350,7 @@ public interface CellStyle { * @param color org.apache.poi.ss.usermodel.Color to set * @since POI 5.2.3 */ - default void setFillForegroundColor(Color color) { - setFillForegroundColor(color, false); - } - - /** - * Set the foreground fill color. - * Uses a {@link org.apache.poi.ss.usermodel.Color} instead of an indexed color. - * - * @param color org.apache.poi.ss.usermodel.Color to set - * @param ignoreInvalidColors when set to true, the method will ignore issues like trying to set a - * HSSFColor on a XSSFCellStyle - * @since POI 5.2.3 - */ - void setFillForegroundColor(Color color, boolean ignoreInvalidColors); + void setFillForegroundColor(Color color); /** * get the foreground fill color, if the fill