bug 59443: exit early on setAddress if address is the same

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-05-09 05:46:14 +00:00
parent 191726ee7b
commit 730641576a
2 changed files with 11 additions and 4 deletions

View File

@ -145,10 +145,9 @@ public class CellAddress implements Comparable<CellAddress> {
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

View File

@ -143,6 +143,10 @@ public class XSSFComment implements Comment {
@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 Comment {
/**
* 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 Comment {
/**
* 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
*/