]> source.dussan.org Git - poi.git/commitdiff
Bug #53707: SlideShow.addPicture declares IOException but throws HSLFException
authorYegor Kozlov <yegor@apache.org>
Fri, 26 Oct 2012 15:40:53 +0000 (15:40 +0000)
committerYegor Kozlov <yegor@apache.org>
Fri, 26 Oct 2012 15:40:53 +0000 (15:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1402550 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java

index 4561f8e4d3a12ff839f38ba33d33da00f48ae84a..ca7d839ebb4138d62d8a72583134271906cc1577 100644 (file)
@@ -853,13 +853,13 @@ public final class SlideShow {
        public int addPicture(File pict, int format) throws IOException {
                int length = (int) pict.length();
                byte[] data = new byte[length];
-               try {
-                       FileInputStream is = new FileInputStream(pict);
+        FileInputStream is = null;
+        try {
+                       is = new FileInputStream(pict);
                        is.read(data);
-                       is.close();
-               } catch (IOException e) {
-                       throw new HSLFException(e);
-               }
+               } finally {
+            if(is != null) is.close();
+        }
                return addPicture(data, format);
        }