remove some casts to short

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1825749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2018-03-03 01:48:46 +00:00
parent 2688ce9d82
commit 8d4f3fde68
7 changed files with 20 additions and 20 deletions

View File

@ -958,8 +958,8 @@ public final class PropertyTemplate {
* @return short value, or 0 if not a short
*/
private static short getShort(Object value) {
if (value instanceof Short) {
return ((Short) value).shortValue();
if (value instanceof Number) {
return ((Number) value).shortValue();
}
return 0;
}

View File

@ -42,7 +42,7 @@ public final class RegionUtil {
public CellPropertySetter(String propertyName, int value) {
_propertyName = propertyName;
_propertyValue = Short.valueOf((short) value);
_propertyValue = Integer.valueOf(value);
}
public CellPropertySetter(String propertyName, BorderStyle value) {
_propertyName = propertyName;

View File

@ -613,7 +613,7 @@ public class SXSSFCell implements Cell {
{
if(_style == null){
SXSSFWorkbook wb = (SXSSFWorkbook)getRow().getSheet().getWorkbook();
return wb.getCellStyleAt((short)0);
return wb.getCellStyleAt(0);
} else {
return _style;
}

View File

@ -138,7 +138,7 @@ public class XSSFFontFormatting implements FontFormatting {
if(_font.sizeOfSzArray() == 0) return -1;
CTFontSize sz = _font.getSzArray(0);
return (short)(20*sz.getVal());
return (int)(20*sz.getVal());
}
/**

View File

@ -876,7 +876,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
font1.setColor((short) 20);
Font font2 = wb1.createFont();
font2.setColor(Font.COLOR_RED);
Font font3 = wb1.getFontAt((short) 0);
Font font3 = wb1.getFontAt(0);
XSSFRow row = sheet.createRow(2);
XSSFCell cell = row.createCell(2);
@ -1750,9 +1750,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// run some method on the font to verify if it is "disconnected" already
//for(short i = 0;i < 256;i++)
{
Font font = wb.getFontAt((short) 0);
Font font = wb.getFontAt(0);
if (font instanceof XSSFFont) {
XSSFFont xfont = (XSSFFont) wb.getFontAt((short) 0);
XSSFFont xfont = (XSSFFont) wb.getFontAt(0);
CTFontImpl ctFont = (CTFontImpl) xfont.getCTFont();
assertEquals(0, ctFont.sizeOfBArray());
}

View File

@ -35,7 +35,7 @@ public final class TestXSSFColor {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("48779.xlsx");
// Check the CTColor is as expected
XSSFColor indexed = wb.getCellStyleAt((short)1).getFillBackgroundXSSFColor();
XSSFColor indexed = wb.getCellStyleAt(1).getFillBackgroundXSSFColor();
assertEquals(true, indexed.getCTColor().isSetIndexed());
assertEquals(64, indexed.getCTColor().getIndexed());
assertEquals(false, indexed.getCTColor().isSetRgb());

View File

@ -323,7 +323,7 @@ public final class TestXSSFFont extends BaseTestFont{
Workbook wb = new XSSFWorkbook();
// cannot check on result because on some machines we get back false here!
SheetUtil.canComputeColumnWidth(wb.getFontAt((short)0));
SheetUtil.canComputeColumnWidth(wb.getFontAt(0));
wb.close();
}
@ -354,16 +354,16 @@ public final class TestXSSFFont extends BaseTestFont{
assertEquals(1, wb.getNumberOfFonts());
XSSFFont f1 = wb.getFontAt((short) 0);
XSSFFont f1 = wb.getFontAt(0);
assertFalse(f1.getBold());
// Check that asking for the same font
// multiple times gives you the same thing.
// Otherwise, our tests wouldn't work!
assertSame(wb.getFontAt((short) 0), wb.getFontAt((short) 0));
assertSame(wb.getFontAt(0), wb.getFontAt(0));
assertEquals(
wb.getFontAt((short) 0),
wb.getFontAt((short) 0)
wb.getFontAt(0),
wb.getFontAt(0)
);
// Look for a new font we have
@ -384,8 +384,8 @@ public final class TestXSSFFont extends BaseTestFont{
XSSFFont nf = wb.createFont();
assertEquals(2, wb.getNumberOfFonts());
assertEquals(1, nf.getIndex());
assertEquals(nf, wb.getFontAt((short) 1));
assertEquals(1, nf.getIndexAsInt());
assertEquals(nf, wb.getFontAt(1));
nf.setBold(false);
nf.setColor(IndexedColors.INDIGO.getIndex());
@ -397,12 +397,12 @@ public final class TestXSSFFont extends BaseTestFont{
nf.setUnderline((byte) 2);
assertEquals(2, wb.getNumberOfFonts());
assertEquals(nf, wb.getFontAt((short) 1));
assertEquals(nf, wb.getFontAt(1));
assertTrue(
wb.getFontAt((short) 0)
wb.getFontAt(0)
!=
wb.getFontAt((short) 1)
wb.getFontAt(1)
);
// Find it now
@ -426,7 +426,7 @@ public final class TestXSSFFont extends BaseTestFont{
assertNotNull(font);
assertEquals(
1,
font.getIndex()
font.getIndexAsInt()
);
assertEquals(nf,
wb.findFont(