aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/sl/draw/ImageRenderer.java4
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java18
2 files changed, 7 insertions, 15 deletions
diff --git a/src/java/org/apache/poi/sl/draw/ImageRenderer.java b/src/java/org/apache/poi/sl/draw/ImageRenderer.java
index c657bbadfd..8286d9a223 100644
--- a/src/java/org/apache/poi/sl/draw/ImageRenderer.java
+++ b/src/java/org/apache/poi/sl/draw/ImageRenderer.java
@@ -111,13 +111,13 @@ public interface ImageRenderer {
void setAlpha(double alpha);
/**
- * @return the image as buffered image
+ * @return the image as buffered image or null if image could not be loaded
*/
BufferedImage getImage();
/**
* @param dim the dimension in pixels of the returned image
- * @return the image as buffered image
+ * @return the image as buffered image or null if image could not be loaded
*
* @since POI 3.15-beta2
*/
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
index 1ae1e99217..1949e7e66f 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
@@ -113,11 +113,8 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
// Removing root element
options.setLoadReplaceDocumentElement(null);
- InputStream is = part.getInputStream();
- try {
+ try (InputStream is = part.getInputStream()) {
drawing = CTDrawing.Factory.parse(is, options);
- } finally {
- is.close();
}
}
@@ -255,6 +252,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
* sheet.
* @return the newly created chart
*/
+
public XSSFChart createChart(ClientAnchor anchor) {
return createChart((XSSFClientAnchor) anchor);
}
@@ -265,11 +263,9 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
* @param srcChart
* the source chart to be cloned into this drawing.
* @return the newly created chart.
- * @throws XmlException
- * @throws IOException
* @since 4.0.0
*/
- public XSSFChart importChart(XSSFChart srcChart) throws IOException, XmlException {
+ public XSSFChart importChart(XSSFChart srcChart) {
CTTwoCellAnchor anchor = ((XSSFDrawing) srcChart.getParent()).getCTDrawing().getTwoCellAnchorArray(0);
CTMarker from = (CTMarker) anchor.getFrom().copy();
CTMarker to = (CTMarker) anchor.getTo().copy();
@@ -284,13 +280,9 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
/**
* Add the indexed picture to this drawing relations
*
- * @param pictureIndex
- * the index of the picture in the workbook collection of
- * pictures,
- * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()}
- * .
+ * @param pictureIndex the index of the picture in the workbook collection of pictures,
+ * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
*/
- @SuppressWarnings("resource")
protected PackageRelationship addPictureReference(int pictureIndex) {
XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent();
XSSFPictureData data = wb.getAllPictures().get(pictureIndex);