]> source.dussan.org Git - poi.git/commitdiff
remove unnecessary short casts for getCellStyleAt
authorPJ Fanning <fanningpj@apache.org>
Mon, 12 Dec 2022 18:14:49 +0000 (18:14 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 12 Dec 2022 18:14:49 +0000 (18:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1905938 13f79535-47bb-0310-9956-ffa450edef68

poi-examples/src/main/java/org/apache/poi/examples/ss/html/ToHtml.java
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestBugs.java
poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestCell.java

index cf9eeaf5c0930598edcf162b5af103714e928cf5..004400c1ec8c16cea9dc5ea13d0104960e1f9a30 100644 (file)
@@ -320,7 +320,7 @@ public final class ToHtml {
 
     private String styleName(CellStyle style) {
         if (style == null) {
-            style = wb.getCellStyleAt((short) 0);
+            style = wb.getCellStyleAt(0);
         }
         StringBuilder sb = new StringBuilder();
         try (Formatter fmt = new Formatter(sb, Locale.ROOT)) {
index 081adc516a8908bd352b35a7eabe8776a465157d..7dec27835450b4c837886e12ab7d7656b474dc3d 100644 (file)
@@ -989,7 +989,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
     @Override
     public CellStyle getColumnStyle(int column) {
         int idx = columnHelper.getColDefaultStyle(column);
-        return getWorkbook().getCellStyleAt((short)(idx == -1 ? 0 : idx));
+        return getWorkbook().getCellStyleAt(idx == -1 ? 0 : idx);
     }
 
     /**
index 8a2802f1b9d0c4ac26e713c93846b40b372721d9..f700d98a9351bf1a16d74d5d5f91dce55e6966cf 100644 (file)
@@ -1094,7 +1094,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         try (XSSFWorkbook wb = new XSSFWorkbook()) {
             XSSFSheet s = wb.createSheet();
 
-            CellStyle defaultStyle = wb.getCellStyleAt((short) 0);
+            CellStyle defaultStyle = wb.getCellStyleAt(0);
             assertEquals(0, defaultStyle.getIndex());
 
             CellStyle blueStyle = wb.createCellStyle();
index b21ff6ec4a3e5d07e4ceeaabc93adac1ff92f5ca..9a48429f0bf7b2a86ec486709c2c9b95bef4d239 100644 (file)
@@ -597,7 +597,7 @@ class TestXSSFCellStyle {
         assertEquals(1, wb.getNumCellStyles());
         assertEquals(2, styles.getFills().size());
 
-        XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0);
+        XSSFCellStyle defaultStyle = wb.getCellStyleAt(0);
         assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
         assertNull(defaultStyle.getFillForegroundXSSFColor());
         assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
index 4a11860161035ecfce4c77298ab23705260bd44d..c9cc7c748ad03089f98bc08a758fcc62145111e4 100644 (file)
@@ -1541,9 +1541,9 @@ final class TestBugs extends BaseTestBugzillaIssues {
             // Write out and read back
             try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) {
                 // Re-check
-                assertEquals("Testing", wb2.getCellStyleAt((short) 21).getUserStyleName());
-                assertEquals("Testing 2", wb2.getCellStyleAt((short) 22).getUserStyleName());
-                assertEquals("Testing 3", wb2.getCellStyleAt((short) 23).getUserStyleName());
+                assertEquals("Testing", wb2.getCellStyleAt(21).getUserStyleName());
+                assertEquals("Testing 2", wb2.getCellStyleAt(22).getUserStyleName());
+                assertEquals("Testing 3", wb2.getCellStyleAt(23).getUserStyleName());
             }
         }
     }
index 55f0343511ec41feb6212cdc3ee6187561231e1b..71cbfbb7e9826b639f5ae36ce0572c5c48ac1ae3 100644 (file)
@@ -844,7 +844,7 @@ public abstract class BaseTestCell {
             Cell cell = row.createCell(0);
 
             // different default style indexes for HSSF and XSSF/SXSSF
-            CellStyle defaultStyle = wb.getCellStyleAt(wb instanceof HSSFWorkbook ? (short) 15 : (short) 0);
+            CellStyle defaultStyle = wb.getCellStyleAt(wb instanceof HSSFWorkbook ? 15 : 0);
 
             // Starts out with the default style
             assertEquals(defaultStyle, cell.getCellStyle());