You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/06/12 16:57:15 UTC

svn commit: r1748028 - in /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel: XSSFRow.java XSSFSheet.java

Author: kiwiwings
Date: Sun Jun 12 16:57:15 2016
New Revision: 1748028

URL: http://svn.apache.org/viewvc?rev=1748028&view=rev
Log:
sonar fixes

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java?rev=1748028&r1=1748027&r2=1748028&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java Sun Jun 12 16:57:15 2016
@@ -72,7 +72,8 @@ public class XSSFRow implements Row, Com
         _cells = new TreeMap<Integer, XSSFCell>();
         for (CTCell c : row.getCArray()) {
             XSSFCell cell = new XSSFCell(this, c);
-            _cells.put(new Integer(cell.getColumnIndex()), cell);
+            Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
+            _cells.put(colI, cell);
             sheet.onReadCell(cell);
         }
     }
@@ -197,8 +198,9 @@ public class XSSFRow implements Row, Com
      * @see Cell#CELL_TYPE_STRING
      */
     public XSSFCell createCell(int columnIndex, int type) {
+        final Integer colI = new Integer(columnIndex); // NOSONAR
         CTCell ctCell;
-        XSSFCell prev = _cells.get(new Integer(columnIndex));
+        XSSFCell prev = _cells.get(colI);
         if(prev != null){
             ctCell = prev.getCTCell();
             ctCell.set(CTCell.Factory.newInstance());
@@ -210,7 +212,7 @@ public class XSSFRow implements Row, Com
         if (type != Cell.CELL_TYPE_BLANK) {
         	xcell.setCellType(type);
         }
-        _cells.put(new Integer(columnIndex), xcell);
+        _cells.put(colI, xcell);
         return xcell;
     }
 
@@ -236,7 +238,8 @@ public class XSSFRow implements Row, Com
     public XSSFCell getCell(int cellnum, MissingCellPolicy policy) {
     	if(cellnum < 0) throw new IllegalArgumentException("Cell index must be >= 0");
 
-        XSSFCell cell = _cells.get(new Integer(cellnum));
+    	Integer colI = new Integer(cellnum); // NOSONAR
+        XSSFCell cell = _cells.get(colI);
     	if(policy == RETURN_NULL_AND_BLANK) {
     		return cell;
     	}
@@ -455,7 +458,8 @@ public class XSSFRow implements Row, Com
         if(cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
            _sheet.getWorkbook().onDeleteFormula(xcell);
         }
-        _cells.remove(new Integer(cell.getColumnIndex()));
+        Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
+        _cells.remove(colI);
     }
 
     /**

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1748028&r1=1748027&r2=1748028&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Sun Jun 12 16:57:15 2016
@@ -222,7 +222,8 @@ public class XSSFSheet extends POIXMLDoc
         arrayFormulas = new ArrayList<CellRangeAddress>();
         for (CTRow row : worksheetParam.getSheetData().getRowArray()) {
             XSSFRow r = new XSSFRow(row, this);
-            _rows.put(new Integer(r.getRowNum()), r);
+            Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
+            _rows.put(rownumI, r);
         }
     }
 
@@ -692,8 +693,9 @@ public class XSSFSheet extends POIXMLDoc
      */
     @Override
     public XSSFRow createRow(int rownum) {
+        final Integer rownumI = new Integer(rownum); // NOSONAR
         CTRow ctRow;
-        XSSFRow prev = _rows.get(new Integer(rownum));
+        XSSFRow prev = _rows.get(rownumI);
         if(prev != null){
             // the Cells in an existing row are invalidated on-purpose, in order to clean up correctly, we
             // need to call the remove, so things like ArrayFormulas and CalculationChain updates are done 
@@ -713,13 +715,13 @@ public class XSSFSheet extends POIXMLDoc
             } else {
                 // get number of rows where row index < rownum
                 // --> this tells us where our row should go
-                int idx = _rows.headMap(new Integer(rownum)).size();
+                int idx = _rows.headMap(rownumI).size();
                 ctRow = worksheet.getSheetData().insertNewRow(idx);
             }
         }
         XSSFRow r = new XSSFRow(ctRow, this);
         r.setRowNum(rownum);
-        _rows.put(new Integer(rownum), r);
+        _rows.put(rownumI, r);
         return r;
     }
 
@@ -1377,7 +1379,8 @@ public class XSSFSheet extends POIXMLDoc
      */
     @Override
     public XSSFRow getRow(int rownum) {
-        return _rows.get(new Integer(rownum));
+        Integer rownumI = new Integer(rownum); // NOSONAR
+        return _rows.get(rownumI);
     }
     
     /**
@@ -1406,7 +1409,9 @@ public class XSSFSheet extends POIXMLDoc
             }
         }
         else {
-            rows.addAll(_rows.subMap(new Integer(startRowNum), new Integer(endRowNum+1)).values());
+            Integer startI = new Integer(startRowNum); // NOSONAR
+            Integer endI = new Integer(endRowNum+1); // NOSONAR
+            rows.addAll(_rows.subMap(startI, endI).values());
         }
         return rows;
     }
@@ -1876,8 +1881,9 @@ public class XSSFSheet extends POIXMLDoc
             row.removeCell(cell);
         }
 
-        int idx = _rows.headMap(new Integer(row.getRowNum())).size();
-        _rows.remove(new Integer(row.getRowNum()));
+        Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
+        int idx = _rows.headMap(rownumI).size();
+        _rows.remove(rownumI);
         worksheet.getSheetData().removeRow(idx);
 
         // also remove any comment located in that row
@@ -2893,7 +2899,8 @@ public class XSSFSheet extends POIXMLDoc
             // check if we should remove this row as it will be overwritten by the data later
             if (shouldRemoveRow(startRow, endRow, n, rownum)) {
                 // remove row from worksheet.getSheetData row array
-                int idx = _rows.headMap(new Integer(row.getRowNum())).size();
+                Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
+                int idx = _rows.headMap(rownumI).size();
                 worksheet.getSheetData().removeRow(idx);
 
                 // remove row from _rows
@@ -3012,7 +3019,8 @@ public class XSSFSheet extends POIXMLDoc
         //rebuild the _rows map
         SortedMap<Integer, XSSFRow> map = new TreeMap<Integer, XSSFRow>();
         for(XSSFRow r : _rows.values()) {
-            map.put(new Integer(r.getRowNum()), r);
+            Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
+            map.put(rownumI, r);
         }
         _rows = map;
     }



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