mirror of https://github.com/apache/poi.git
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:
parent
7454a722f0
commit
1b4e8ba77b
|
@ -320,7 +320,7 @@ public final class ToHtml {
|
||||||
|
|
||||||
private String styleName(CellStyle style) {
|
private String styleName(CellStyle style) {
|
||||||
if (style == null) {
|
if (style == null) {
|
||||||
style = wb.getCellStyleAt((short) 0);
|
style = wb.getCellStyleAt(0);
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
try (Formatter fmt = new Formatter(sb, Locale.ROOT)) {
|
try (Formatter fmt = new Formatter(sb, Locale.ROOT)) {
|
||||||
|
|
|
@ -989,7 +989,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
|
||||||
@Override
|
@Override
|
||||||
public CellStyle getColumnStyle(int column) {
|
public CellStyle getColumnStyle(int column) {
|
||||||
int idx = columnHelper.getColDefaultStyle(column);
|
int idx = columnHelper.getColDefaultStyle(column);
|
||||||
return getWorkbook().getCellStyleAt((short)(idx == -1 ? 0 : idx));
|
return getWorkbook().getCellStyleAt(idx == -1 ? 0 : idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||||
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
||||||
XSSFSheet s = wb.createSheet();
|
XSSFSheet s = wb.createSheet();
|
||||||
|
|
||||||
CellStyle defaultStyle = wb.getCellStyleAt((short) 0);
|
CellStyle defaultStyle = wb.getCellStyleAt(0);
|
||||||
assertEquals(0, defaultStyle.getIndex());
|
assertEquals(0, defaultStyle.getIndex());
|
||||||
|
|
||||||
CellStyle blueStyle = wb.createCellStyle();
|
CellStyle blueStyle = wb.createCellStyle();
|
||||||
|
|
|
@ -597,7 +597,7 @@ class TestXSSFCellStyle {
|
||||||
assertEquals(1, wb.getNumCellStyles());
|
assertEquals(1, wb.getNumCellStyles());
|
||||||
assertEquals(2, styles.getFills().size());
|
assertEquals(2, styles.getFills().size());
|
||||||
|
|
||||||
XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0);
|
XSSFCellStyle defaultStyle = wb.getCellStyleAt(0);
|
||||||
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
|
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
|
||||||
assertNull(defaultStyle.getFillForegroundXSSFColor());
|
assertNull(defaultStyle.getFillForegroundXSSFColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
|
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
|
||||||
|
|
|
@ -1541,9 +1541,9 @@ final class TestBugs extends BaseTestBugzillaIssues {
|
||||||
// Write out and read back
|
// Write out and read back
|
||||||
try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) {
|
try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) {
|
||||||
// Re-check
|
// Re-check
|
||||||
assertEquals("Testing", wb2.getCellStyleAt((short) 21).getUserStyleName());
|
assertEquals("Testing", wb2.getCellStyleAt(21).getUserStyleName());
|
||||||
assertEquals("Testing 2", wb2.getCellStyleAt((short) 22).getUserStyleName());
|
assertEquals("Testing 2", wb2.getCellStyleAt(22).getUserStyleName());
|
||||||
assertEquals("Testing 3", wb2.getCellStyleAt((short) 23).getUserStyleName());
|
assertEquals("Testing 3", wb2.getCellStyleAt(23).getUserStyleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -844,7 +844,7 @@ public abstract class BaseTestCell {
|
||||||
Cell cell = row.createCell(0);
|
Cell cell = row.createCell(0);
|
||||||
|
|
||||||
// different default style indexes for HSSF and XSSF/SXSSF
|
// 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
|
// Starts out with the default style
|
||||||
assertEquals(defaultStyle, cell.getCellStyle());
|
assertEquals(defaultStyle, cell.getCellStyle());
|
||||||
|
|
Loading…
Reference in New Issue