aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/sl/usermodel
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2018-06-29 08:13:22 +0000
committerDominik Stadler <centic@apache.org>2018-06-29 08:13:22 +0000
commit95587bd12f0a3858462afa1f328c6c91a5627b93 (patch)
tree015ca36f5147c55d88c7480877175005dcbe0c9a /src/testcases/org/apache/poi/sl/usermodel
parent62e3986e49090acf3aac0c5570006638ce686a1b (diff)
downloadpoi-95587bd12f0a3858462afa1f328c6c91a5627b93.tar.gz
poi-95587bd12f0a3858462afa1f328c6c91a5627b93.zip
Slightly adjust afew tests some more
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1834654 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/sl/usermodel')
-rw-r--r--src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
index d9c869e566..2365c59438 100644
--- a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
+++ b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
@@ -75,18 +75,16 @@ public class BaseTestSlideShowFactory {
@SuppressWarnings("resource")
protected static void testFactoryFromProtectedFile(String protectedFile, String password) throws Exception {
- SlideShow<?,?> ss;
- // from protected file
- ss = SlideShowFactory.create(fromFile(protectedFile), password);
+ // from protected file
+ SlideShow<?,?> ss = SlideShowFactory.create(fromFile(protectedFile), password);
assertNotNull(ss);
assertCloseDoesNotModifyFile(protectedFile, ss);
}
@SuppressWarnings("resource")
protected static void testFactoryFromProtectedStream(String protectedFile, String password) throws Exception {
- SlideShow<?,?> ss;
// from protected stream
- ss = SlideShowFactory.create(fromStream(protectedFile), password);
+ SlideShow<?,?> ss = SlideShowFactory.create(fromStream(protectedFile), password);
assertNotNull(ss);
assertCloseDoesNotModifyFile(protectedFile, ss);
}
@@ -163,7 +161,6 @@ public class BaseTestSlideShowFactory {
*
* @param filename the sample filename or full path of the slideshow to check before and after closing
* @param ss the slideshow to close or revert
- * @throws IOException
*/
private static void assertCloseDoesNotModifyFile(String filename, SlideShow<?,?> ss) throws IOException {
final byte[] before = readFile(filename);
@@ -177,11 +174,8 @@ public class BaseTestSlideShowFactory {
// if the file after closing is different, then re-set
// the file to the state before in order to not have a dirty SCM
// working tree when running this test
- FileOutputStream str = new FileOutputStream(_slTests.getFile(filename));
- try {
+ try (FileOutputStream str = new FileOutputStream(_slTests.getFile(filename))) {
str.write(before);
- } finally {
- str.close();
}
throw e;