]> source.dussan.org Git - poi.git/commitdiff
Fix some IDE warnings and update some JavaDoc
authorDominik Stadler <centic@apache.org>
Sat, 26 Oct 2019 05:26:30 +0000 (05:26 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 26 Oct 2019 05:26:30 +0000 (05:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1868977 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/sl/draw/ImageRenderer.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java

index c657bbadfd6ac90063348a425a344d1f5e620127..8286d9a22358f3b92a75c1b17595d801eee9f59b 100644 (file)
@@ -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
      */
index 1ae1e99217bca92795a81a14e22c8150c5f1e3ea..1949e7e66f4c0de9e78137770638fcfb9ce5f0f2 100644 (file)
@@ -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);