mirror of https://github.com/apache/poi.git
[bug-66319] do not create HSSF patriarch to find comments (only use one that pre-exists)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1905943 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5a6df66b07
commit
693c59574c
|
@ -2527,10 +2527,7 @@ public final class HSSFSheet implements Sheet {
|
|||
|
||||
protected HSSFComment findCellComment(int row, int column) {
|
||||
HSSFPatriarch patriarch = getDrawingPatriarch();
|
||||
if (null == patriarch) {
|
||||
patriarch = createDrawingPatriarch();
|
||||
}
|
||||
return lookForComment(patriarch, row, column);
|
||||
return patriarch == null ? null : lookForComment(patriarch, row, column);
|
||||
}
|
||||
|
||||
private HSSFComment lookForComment(HSSFShapeContainer container, int row, int column) {
|
||||
|
|
|
@ -2609,4 +2609,38 @@ final class TestBugs extends BaseTestBugzillaIssues {
|
|||
assertNotNull(wb);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test66319() throws IOException {
|
||||
try (
|
||||
HSSFWorkbook workbook = openSampleWorkbook("bug66319.xls");
|
||||
UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()
|
||||
) {
|
||||
for (Sheet sheet : workbook) {
|
||||
for (Row row : sheet) {
|
||||
for (Cell cell : row) {
|
||||
cell.getCellComment();
|
||||
}
|
||||
}
|
||||
}
|
||||
workbook.write(bos);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test66319WithRemove() throws IOException {
|
||||
try (
|
||||
HSSFWorkbook workbook = openSampleWorkbook("bug66319.xls");
|
||||
UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()
|
||||
) {
|
||||
for (Sheet sheet : workbook) {
|
||||
for (Row row : sheet) {
|
||||
for (Cell cell : row) {
|
||||
cell.removeCellComment();
|
||||
}
|
||||
}
|
||||
}
|
||||
workbook.write(bos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue