From 25d3f3527daa0c3be5a9b0bbd9d0151f5dee0ae4 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 12 Jun 2019 18:14:22 +0000 Subject: [PATCH] tidy up some int casts git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1861176 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/sl/usermodel/Insets2D.java | 2 +- .../src/org/apache/poi/hdgf/chunks/ChunkHeader.java | 2 +- .../ss/formula/ptg/TestExternalNameReference.java | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/java/org/apache/poi/sl/usermodel/Insets2D.java b/src/java/org/apache/poi/sl/usermodel/Insets2D.java index 205e4053a2..51fd5ac105 100644 --- a/src/java/org/apache/poi/sl/usermodel/Insets2D.java +++ b/src/java/org/apache/poi/sl/usermodel/Insets2D.java @@ -124,7 +124,7 @@ public final class Insets2D implements Cloneable { * @return a string representation of this Insets object. */ public String toString() { - return getClass().getName() + "[top=" + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]"; + return getClass().getName() + "[top=" + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]"; } /** diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java index d8c1d7a44a..523aed259f 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java @@ -63,7 +63,7 @@ public abstract class ChunkHeader { ch.setUnknown2(LittleEndian.getUByte(data, offset + 4)); ch.setUnknown3(LittleEndian.getUByte(data, offset + 5)); ch.setUnknown1(LittleEndian.getShort(data, offset + 6)); - ch.setLength((int)LittleEndian.getUInt(data, offset + 8)); + ch.setLength(Math.toIntExact(LittleEndian.getUInt(data, offset + 8))); return ch; } else { diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java index 82bc535dd4..2fc93ec9c7 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java @@ -49,15 +49,15 @@ public final class TestExternalNameReference extends TestCase { assertEquals("x123",wb.getSheet("Sheet1").getRow(1).getCell(1).getStringCellValue()); assertEquals("Sheet1!$C$2", wb.getName("UNITCOST").getRefersToFormula()); CellReference cellRef = new CellReference(wb.getName("UNITCOST").getRefersToFormula()); - HSSFCell cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + HSSFCell cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); assertEquals("VLOOKUP(PART,COSTS,2,FALSE)",cell.getCellFormula()); assertEquals("Sheet1!$D$2", wb.getName("COST").getRefersToFormula()); cellRef = new CellReference(wb.getName("COST").getRefersToFormula()); - cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); assertEquals("UNITCOST*Quant",cell.getCellFormula()); assertEquals("Sheet1!$E$2", wb.getName("TOTALCOST").getRefersToFormula()); cellRef = new CellReference(wb.getName("TOTALCOST").getRefersToFormula()); - cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + cell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); assertEquals("Cost*Markup_Cost",cell.getCellFormula()); }catch(Exception e){ fail(); @@ -91,11 +91,11 @@ public final class TestExternalNameReference extends TestCase { HSSFFormulaEvaluator[] evaluators = { evaluator, evaluatorCost, }; HSSFFormulaEvaluator.setupEnvironment(bookNames, evaluators); cellRef = new CellReference(wb.getName("UNITCOST").getRefersToFormula()); - HSSFCell uccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + HSSFCell uccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); cellRef = new CellReference(wb.getName("COST").getRefersToFormula()); - HSSFCell ccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + HSSFCell ccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); cellRef = new CellReference(wb.getName("TOTALCOST").getRefersToFormula()); - HSSFCell tccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell((int)cellRef.getCol()); + HSSFCell tccell = wb.getSheet(cellRef.getSheetName()).getRow(cellRef.getRow()).getCell(cellRef.getCol()); evaluator.evaluateFormulaCell(uccell); evaluator.evaluateFormulaCell(ccell); evaluator.evaluateFormulaCell(tccell); -- 2.39.5