remove unnecessary short casts for getCellStyleAt

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1905938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-12-12 18:14:49 +00:00
parent 7454a722f0
commit 1b4e8ba77b
6 changed files with 8 additions and 8 deletions

View 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)) {

View 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);
}
/**

View 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();

View 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());

View 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());
}
}
}

View 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());