You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/05/09 05:46:14 UTC

svn commit: r1742881 - in /poi/trunk/src: java/org/apache/poi/ss/util/CellAddress.java ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java

Author: onealj
Date: Mon May  9 05:46:14 2016
New Revision: 1742881

URL: http://svn.apache.org/viewvc?rev=1742881&view=rev
Log:
bug 59443: exit early on setAddress if address is the same

Modified:
    poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java?rev=1742881&r1=1742880&r2=1742881&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java Mon May  9 05:46:14 2016
@@ -145,10 +145,9 @@ public class CellAddress implements Comp
             return false;
         }
         
-        CellAddress cr = (CellAddress) o;
-        return _row == cr._row
-                && _col == cr._col
-        ;
+        CellAddress other = (CellAddress) o;
+        return _row == other._row &&
+               _col == other._col;
     }
 
     @Override

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java?rev=1742881&r1=1742880&r2=1742881&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java Mon May  9 05:46:14 2016
@@ -143,6 +143,10 @@ public class XSSFComment implements Comm
     @Override
     public void setAddress(CellAddress address) {
         CellAddress oldRef = new CellAddress(_comment.getRef());
+        if (address.equals(oldRef)) {
+            // nothing to do
+            return;
+        }
         
         _comment.setRef(address.formatAsString());
         _comments.referenceUpdated(oldRef, _comment);
@@ -161,6 +165,8 @@ public class XSSFComment implements Comm
 
     /**
      * Set the column of the cell that contains the comment
+     * 
+     * If changing both row and column, use {@link #setAddress}.
      *
      * @param col the 0-based column of the cell that contains the comment
      */
@@ -171,6 +177,8 @@ public class XSSFComment implements Comm
 
     /**
      * Set the row of the cell that contains the comment
+     * 
+     * If changing both row and column, use {@link #setAddress}.
      *
      * @param row the 0-based row of the cell that contains the comment
      */



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