poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r805900 - in /poi/trunk/src: java/org/apache/poi/hssf/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/ testcases/org/apache/poi/ss/usermodel/
Date Wed, 19 Aug 2009 17:39:21 GMT
Author: josh
Date: Wed Aug 19 17:39:21 2009
New Revision: 805900

URL: http://svn.apache.org/viewvc?rev=805900&view=rev
Log:
Fixing compiler warnings - unboxing parameter to overloaded method, unnecessary typecast

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java?rev=805900&r1=805899&r2=805900&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/FontDetails.java Wed Aug 19 17:39:21
2009
@@ -67,7 +67,7 @@
      */
     public int getCharWidth( char c )
     {
-        Integer widthInteger = (Integer)(charWidths.get(new Character(c)));
+        Integer widthInteger = charWidths.get(new Character(c));
         if (widthInteger == null && c != 'W') {
             return getCharWidth('W');
         }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java?rev=805900&r1=805899&r2=805900&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
Wed Aug 19 17:39:21 2009
@@ -39,11 +39,11 @@
 
         Cell c1 = r.createCell(0);
         c1.setCellFormula("1+5");
-        assertEquals(0.0, c1.getNumericCellValue() );
+        assertEquals(0.0, c1.getNumericCellValue(), 0.0);
 
         Cell c2 = r.createCell(1);
         c2.setCellFormula("10/2");
-        assertEquals(0.0, c2.getNumericCellValue() );
+        assertEquals(0.0, c2.getNumericCellValue(), 0.0);
 
         FormulaEvaluator fe = new XSSFFormulaEvaluator(wb);
 
@@ -67,19 +67,19 @@
 
         Cell c1 = r.createCell(0);
         c1.setCellFormula("SUM(A1:B1)");
-        assertEquals(0.0, c1.getNumericCellValue() );
+        assertEquals(0.0, c1.getNumericCellValue(), 0.0);
 
         Cell c2 = r.createCell(1);
         c2.setCellFormula("SUM(A1:E1)");
-        assertEquals(0.0, c2.getNumericCellValue() );
+        assertEquals(0.0, c2.getNumericCellValue(), 0.0);
 
         Cell c3 = r.createCell(2);
         c3.setCellFormula("COUNT(A1:A1)");
-        assertEquals(0.0, c3.getNumericCellValue() );
+        assertEquals(0.0, c3.getNumericCellValue(), 0.0);
 
         Cell c4 = r.createCell(3);
         c4.setCellFormula("COUNTA(A1:E1)");
-        assertEquals(0.0, c4.getNumericCellValue() );
+        assertEquals(0.0, c4.getNumericCellValue(), 0.0);
 
 
         // Evaluate and test
@@ -150,11 +150,10 @@
         row.createCell(2).setCellFormula("sales_1*3");
 
         XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);
-        assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue());
-        assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue());
+        assertEquals(3.0, evaluator.evaluate(sh1.getRow(0).getCell(1)).getNumberValue(),
0.0);
+        assertEquals(6.0, evaluator.evaluate(sh1.getRow(0).getCell(2)).getNumberValue(),
0.0);
 
-        assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue());
-        assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue());
+        assertEquals(5.0, evaluator.evaluate(sh2.getRow(0).getCell(1)).getNumberValue(),
0.0);
+        assertEquals(15.0, evaluator.evaluate(sh2.getRow(0).getCell(2)).getNumberValue(),
0.0);
     }
-
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java?rev=805900&r1=805899&r2=805900&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
Wed Aug 19 17:39:21 2009
@@ -61,9 +61,9 @@
         count = countColumns(worksheet);
         assertEquals(16375, count);
         // Remember - POI column 0 == OOXML column 1
-        assertEquals((double) 88, helper.getColumn(0, false).getWidth());
+        assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
         assertTrue(helper.getColumn(0, false).getHidden());
-        assertEquals((double)0, helper.getColumn(1, false).getWidth());
+        assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
         assertFalse(helper.getColumn(1, false).getHidden());
     }
 
@@ -129,7 +129,7 @@
         assertEquals(2, newCol.getMin());
         assertEquals(8, newCol.getMax());
         assertTrue(newCol.getHidden());
-        assertEquals(13.4, newCol.getWidth());
+        assertEquals(13.4, newCol.getWidth(), 0.0);
     }
 
     public void testAddCleanColIntoCols() {
@@ -213,8 +213,8 @@
         ColumnHelper helper = new ColumnHelper(worksheet);
         assertNotNull(helper.getColumn(0, false));
         assertNotNull(helper.getColumn(1, false));
-        assertEquals((double) 88, helper.getColumn(0, false).getWidth());
-        assertEquals((double) 0, helper.getColumn(1, false).getWidth());
+        assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
+        assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
         assertTrue(helper.getColumn(0, false).getHidden());
         assertFalse(helper.getColumn(1, false).getHidden());
         assertNull(helper.getColumn(99, false));
@@ -226,12 +226,12 @@
         col.setWidth(12);
         col.setHidden(true);
         CTCol newCol = CTCol.Factory.newInstance();
-        assertEquals((double) 0, newCol.getWidth());
+        assertEquals(0.0, newCol.getWidth(), 0.0);
         assertFalse(newCol.getHidden());
         ColumnHelper helper = new ColumnHelper(CTWorksheet.Factory
                 .newInstance());
         helper.setColumnAttributes(col, newCol);
-        assertEquals((double) 12, newCol.getWidth());
+        assertEquals(12.0, newCol.getWidth(), 0.0);
         assertTrue(newCol.getHidden());
     }
 
@@ -239,7 +239,7 @@
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet("Sheet 1");
         ColumnHelper columnHelper = sheet.getColumnHelper();
-        
+
         // Check POI 0 based, OOXML 1 based
         CTCol col = columnHelper.getOrCreateColumn1Based(3, false);
         assertNotNull(col);
@@ -255,16 +255,16 @@
         assertNotNull(columnHelper.getColumn1Based(30, false));
         assertNull(columnHelper.getColumn(30, false));
     }
-    
+
     public void testGetSetColDefaultStyle() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
         CTWorksheet ctWorksheet = sheet.getCTWorksheet();
         ColumnHelper columnHelper = sheet.getColumnHelper();
-        
+
         // POI column 3, OOXML column 4
         CTCol col = columnHelper.getOrCreateColumn1Based(4, false);
-        
+
         assertNotNull(col);
         assertNotNull(columnHelper.getColumn(3, false));
         columnHelper.setColDefaultStyle(3, 2);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java?rev=805900&r1=805899&r2=805900&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestDataFormat.java Wed Aug 19
17:39:21 2009
@@ -40,7 +40,7 @@
 
         Map<Integer, String> formats = BuiltinFormats.getBuiltinFormats();
         for (int idx : formats.keySet()) {
-            String fmt = formats.get(idx);
+            String fmt = formats.get(new Integer(idx));
             assertEquals(idx, df.getFormat(fmt));
         }
 

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java?rev=805900&r1=805899&r2=805900&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java Wed Aug 19 17:39:21
2009
@@ -287,18 +287,18 @@
 
         sheet.setDefaultRowHeightInPoints(20);
         row1.setHeight((short)-1); //reset the row height
-        assertEquals(20.0f, row1.getHeightInPoints());
+        assertEquals(20.0f, row1.getHeightInPoints(), 0F);
         assertEquals(20*20, row1.getHeight());
 
         Row row2 = sheet.createRow(1);
         row2.setHeight((short)310);
         assertEquals(310, row2.getHeight());
-        assertEquals((float)310/20, row2.getHeightInPoints());
+        assertEquals(310F/20, row2.getHeightInPoints(), 0F);
 
         Row row3 = sheet.createRow(2);
         row3.setHeightInPoints(25.5f);
         assertEquals((short)(25.5f*20), row3.getHeight());
-        assertEquals(25.5f, row3.getHeightInPoints());
+        assertEquals(25.5f, row3.getHeightInPoints(), 0F);
 
         Row row4 = sheet.createRow(3);
         assertFalse(row4.getZeroHeight());
@@ -312,14 +312,14 @@
         row2 = sheet.getRow(1);
         row3 = sheet.getRow(2);
         row4 = sheet.getRow(3);
-        assertEquals(20.0f, row1.getHeightInPoints());
+        assertEquals(20.0f, row1.getHeightInPoints(), 0F);
         assertEquals(20*20, row1.getHeight());
 
         assertEquals(310, row2.getHeight());
-        assertEquals((float)310/20, row2.getHeightInPoints());
+        assertEquals(310F/20, row2.getHeightInPoints(), 0F);
 
         assertEquals((short)(25.5f*20), row3.getHeight());
-        assertEquals(25.5f, row3.getHeightInPoints());
+        assertEquals(25.5f, row3.getHeightInPoints(), 0F);
 
         assertFalse(row1.getZeroHeight());
         assertFalse(row2.getZeroHeight());
@@ -385,6 +385,4 @@
         assertTrue(cell2 == it.next());
         assertEquals(Cell.CELL_TYPE_STRING, cell5.getCellType());
     }
-
-
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message