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) {
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);
+ }
+ }
}