From 5da9a3aabc26dcc2998273d1cc48ff407263a712 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Thu, 7 Jul 2016 02:19:02 +0000 Subject: [PATCH] bug 50795: move hack to avoid xmlbeans corrupt pointer to its own function git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751742 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xssf/usermodel/XSSFComment.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java index ce891a4b96..7140e5b902 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java @@ -60,10 +60,7 @@ public class XSSFComment implements Comment { clientData.setRowArray(0, new BigInteger(String.valueOf(ref.getRow()))); clientData.setColumnArray(0, new BigInteger(String.valueOf(ref.getCol()))); - // There is a very odd xmlbeans bug when changing the row - // arrays which can lead to corrupt pointer - // This call seems to fix them again... See bug #50795 - vmlShape.getClientDataList().toString(); + avoidXmlbeansCorruptPointer(vmlShape); } } @@ -156,10 +153,7 @@ public class XSSFComment implements Comment { clientData.setRowArray(0, new BigInteger(String.valueOf(address.getRow()))); clientData.setColumnArray(0, new BigInteger(String.valueOf(address.getColumn()))); - // There is a very odd xmlbeans bug when changing the column - // arrays which can lead to corrupt pointer - // This call seems to fix them again... See bug #50795 - _vmlShape.getClientDataList().toString(); + avoidXmlbeansCorruptPointer(_vmlShape); } } @@ -254,4 +248,11 @@ public class XSSFComment implements Comment { public int hashCode() { return ((getRow()*17) + getColumn())*31; } + + private static void avoidXmlbeansCorruptPointer(CTShape vmlShape) { + // There is a very odd xmlbeans bug when changing the row + // arrays which can lead to corrupt pointer + // This call seems to fix them again... See bug #50795 + vmlShape.getClientDataList().toString(); + } } -- 2.39.5