poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1711706 - in /poi/trunk/src: java/org/apache/poi/sl/usermodel/SlideShow.java scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
Date Sat, 31 Oct 2015 23:10:17 GMT
Author: kiwiwings
Date: Sat Oct 31 23:10:17 2015
New Revision: 1711706

URL: http://svn.apache.org/viewvc?rev=1711706&view=rev
Log:
Make SlideShow closeable as of HSLF references a NPOIFSFileSystem and hasn't closed it

Modified:
    poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java

Modified: poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShow.java?rev=1711706&r1=1711705&r2=1711706&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShow.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShow.java Sat Oct 31 23:10:17 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.sl.usermodel;
 
 import java.awt.Dimension;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
@@ -27,7 +28,7 @@ import org.apache.poi.sl.usermodel.Pictu
 public interface SlideShow<
     S extends Shape<S,P>,
     P extends TextParagraph<S,P,?>
-> {
+> extends Closeable {
 	Slide<S,P> createSlide() throws IOException;
 
 	List<? extends Slide<S,P>> getSlides();

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java?rev=1711706&r1=1711705&r2=1711706&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java Sat Oct
31 23:10:17 2015
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.usermodel;
 import java.awt.Dimension;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -88,7 +89,7 @@ import org.apache.poi.util.Units;
  * @author Nick Burch
  * @author Yegor kozlov
  */
-public final class HSLFSlideShow implements SlideShow<HSLFShape,HSLFTextParagraph>
{
+public final class HSLFSlideShow implements SlideShow<HSLFShape,HSLFTextParagraph>,
Closeable {
 	// What we're based on
 	private HSLFSlideShowImpl _hslfSlideShow;
 
@@ -1157,4 +1158,9 @@ public final class HSLFSlideShow impleme
         // TODO Auto-generated method stub
         return null;
     }
+
+    @Override
+    public void close() throws IOException {
+        _hslfSlideShow.close();
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java?rev=1711706&r1=1711705&r2=1711706&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java Sat
Oct 31 23:10:17 2015
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.usermodel;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -64,7 +65,7 @@ import org.apache.poi.util.POILogger;
  *
  * @author Nick Burch
  */
-public final class HSLFSlideShowImpl extends POIDocument {
+public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
     public static final int UNSET_OFFSET = -1;
     
     // For logging
@@ -795,6 +796,14 @@ public final class HSLFSlideShowImpl ext
         return _objects;
     }
     
+    @Override
+    public void close() throws IOException {
+        NPOIFSFileSystem fs = directory.getFileSystem();
+        if (fs != null) {
+            fs.close();
+        }
+    }
+    
     
     private static class BufAccessBAOS extends ByteArrayOutputStream {
         public byte[] getBuf() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message