This is an automated email from the ASF dual-hosted git repository. centic pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/poi.git
commit a371cba0be6891f935be884d746f5c05f70f23cc Author: Dominik Stadler <[email protected]> AuthorDate: Sat Oct 25 10:01:15 2025 +0200 Apply IDE suggestions --- .../org/apache/poi/integration/TestXLSX2CSV.java | 2 +- .../org/apache/poi/xssf/usermodel/XSSFTextRun.java | 6 +++--- .../java/org/apache/poi/xssf/TestXSSFParser.java | 3 ++- .../java/org/apache/poi/hssf/util/HSSFColor.java | 20 ++++++++++---------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java index 91a64f4601..652bf69097 100644 --- a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java +++ b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java @@ -201,7 +201,7 @@ public class TestXLSX2CSV { } @Test - public void testDeepFile() throws Exception { + public void testDeepFile() { // returns with some System.err try { assertThrows(IOException.class, diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java index 3789335a16..58142dcbf3 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java @@ -62,7 +62,7 @@ public class XSSFTextRun { } /** - * @param rgb + * @param rgb The RGB color value to set for the font * @since POI 5.5.0 */ public void setFontColor(byte[] rgb) { @@ -272,7 +272,7 @@ public class XSSFTextRun { /** * Set whether the text in this run is formatted as superscript. - * Default base line offset is 30% + * Default base-line offset is 30% * * @see #setBaselineOffset(double) */ @@ -282,7 +282,7 @@ public class XSSFTextRun { /** * Set whether the text in this run is formatted as subscript. - * Default base line offset is -25%. + * Default base-line offset is -25%. * * @see #setBaselineOffset(double) */ diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFParser.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFParser.java index 8980782d11..856a651e2e 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFParser.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFParser.java @@ -46,8 +46,9 @@ public class TestXSSFParser { } @Test - void testFailOnXls() throws Exception { + void testFailOnXls() { final File file = HSSFTestDataSamples.getSampleFile("44010-SingleChart.xls"); + //noinspection resource XSSFReadException xre = assertThrows(XSSFReadException.class, () -> XSSFParser.parse(file)); assertInstanceOf(OLE2NotOfficeXmlFileException.class, xre.getCause()); } diff --git a/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java b/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java index cc3d3ed796..761adedb53 100644 --- a/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java +++ b/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java @@ -35,7 +35,7 @@ import org.apache.poi.util.Removal; * Each color has an index (for the standard palette in Excel (tm) ), * native (RGB) triplet and string triplet. The string triplet is as the * color would be represented by Gnumeric. Having (string) this here is a bit of a - * collision of function between HSSF and the HSSFSerializer but I think it's + * collision of function between HSSF and the HSSFSerializer, but I think it's * a reasonable one in this case. */ public class HSSFColor implements Color { @@ -165,8 +165,8 @@ public class HSSFColor implements Color { * </pre> * or specifying {@link #HSSFColor(int, int, int) RGB directly}. * - * @param index - * @param index2 + * @param index Index to the standard color palette + * @param index2 Index to the alternate color palette * @param color color to extract RGB from * @deprecated use {@link #HSSFColor(int, int, int)} instead */ @@ -179,8 +179,8 @@ public class HSSFColor implements Color { * specifying RGB as an {@code int} value. Given {@code blue}, {@code green} and * {@code blue} being byte values between {@code 0x00 to 0xFF}, then * {@code rgb = blue + (green >> 8) + (red >> 16)}. - * @param index - * @param index2 + * @param index Index to the standard color palette + * @param index2 Index to the alternate color palette * @param rgb combined value of RGB * @since POI 5.5.0 */ @@ -218,11 +218,11 @@ public class HSSFColor implements Color { Map<Integer,HSSFColor> result = new HashMap<>(eList.size() * 3 / 2); for (Map.Entry<HSSFColorPredefined,HSSFColor> colorRef : eList.entrySet()) { - Integer index1 = Integer.valueOf(colorRef.getKey().getIndex()); + Integer index1 = (int) colorRef.getKey().getIndex(); if (!result.containsKey(index1)) { result.put(index1, colorRef.getValue()); } - Integer index2 = Integer.valueOf(colorRef.getKey().getIndex2()); + Integer index2 = (int) colorRef.getKey().getIndex2(); if (index2 != -1 && !result.containsKey(index2)) { result.put(index2, colorRef.getValue()); } @@ -357,13 +357,13 @@ public class HSSFColor implements Color { Integer.toHexString(getBlue()*0x101)).toUpperCase(Locale.ROOT); } - private final short getBlue() { + private short getBlue() { return (short) (rgb & 0xFF); } - private final short getGreen() { + private short getGreen() { return (short) ((rgb >> 8) & 0xFF); } - private final short getRed() { + private short getRed() { return (short) ((rgb >> 16) & 0xFF); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
