From: Dominik Stadler Date: Fri, 16 May 2014 07:09:55 +0000 (+0000) Subject: Fix Bug 56514, add missing null-check if simple shape does not have any text X-Git-Tag: REL_3_11_BETA1~135 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b342bc5d8b3021d61aacaed91e2bae567bcd221d;p=poi.git Fix Bug 56514, add missing null-check if simple shape does not have any text git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1595127 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java index 44fc91bbf9..7ce8c4e0df 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java @@ -25,28 +25,7 @@ import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.util.Internal; import org.apache.poi.util.Units; -import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps; -import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D; -import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D; -import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D; -import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun; -import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor; -import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D; -import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextHorzOverflowType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextVertOverflowType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextVerticalType; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextWrappingType; +import org.openxmlformats.schemas.drawingml.x2006.main.*; import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape; import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt; @@ -81,8 +60,10 @@ public class XSSFSimpleShape extends XSSFShape implements Iterable shapes = drawing.getShapes(); + assertEquals(4, shapes.size()); + + wb = XSSFTestDataSamples.writeOutAndReadBack(wb); + + shapes = drawing.getShapes(); + assertEquals(4, shapes.size()); + +/* OutputStream stream = new FileOutputStream(new File("C:\\temp\\56514.xlsx")); + try { + wb.write(stream); + } finally { + stream.close(); + }*/ + } } diff --git a/test-data/spreadsheet/56514.xlsx b/test-data/spreadsheet/56514.xlsx new file mode 100644 index 0000000000..29163a5feb Binary files /dev/null and b/test-data/spreadsheet/56514.xlsx differ