Skip to content

Commit 40f68bf

Browse files
author
dawagner
committed
DanielWagnerHall: Close the FileOutputStream
git-svn-id: https://selenium.googlecode.com/svn/trunk@18421 07704840-8298-11de-bf8c-fd130f914ac9
1 parent 439652c commit 40f68bf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

java/client/src/org/openqa/selenium/iphone/IPhoneSimulatorBinary.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ protected static String getIphoneSimPath() {
7777
try {
7878
File destination = new File(parentDir, filename);
7979
FileOutputStream outputStream = new FileOutputStream(destination);
80-
URL resource = Resources.getResource(IPhoneSimulatorBinary.class.getPackage().getName().replace('.', '/') + '/' + filename);
81-
Resources.copy(resource, outputStream);
82-
FileHandler.makeExecutable(destination);
83-
return destination.getAbsolutePath();
80+
try {
81+
URL resource = Resources.getResource(IPhoneSimulatorBinary.class.getPackage().getName().replace('.', '/') + '/' + filename);
82+
Resources.copy(resource, outputStream);
83+
FileHandler.makeExecutable(destination);
84+
return destination.getAbsolutePath();
85+
} finally {
86+
outputStream.close();
87+
}
8488
} catch (IOException e) {
8589
throw new WebDriverException(e);
8690
}

0 commit comments

Comments
 (0)