Skip to content

Commit 1d34568

Browse files
committed
#221 raise the file permission error properly
1 parent 6988f2e commit 1d34568

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

android/src/main/java/com/rnziparchive/RNZipArchiveModule.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import java.io.BufferedInputStream;
1717
import java.io.BufferedOutputStream;
1818
import java.io.File;
19-
import java.io.FileInputStream;
20-
import java.io.FileNotFoundException;
2119
import java.io.FileOutputStream;
2220
import java.io.IOException;
2321
import java.io.InputStream;
@@ -118,17 +116,9 @@ public void unzip(final String zipFilePath, final String destDirectory, final St
118116
@Override
119117
public void run() {
120118
// Check the file exists
121-
FileInputStream inputStream = null;
122119
try {
123-
inputStream = new FileInputStream(zipFilePath);
124120
new File(zipFilePath);
125-
} catch (FileNotFoundException | NullPointerException e) {
126-
if (inputStream != null) {
127-
try {
128-
inputStream.close();
129-
} catch (IOException ignored) {
130-
}
131-
}
121+
} catch (NullPointerException e) {
132122
promise.reject(null, "Couldn't open file " + zipFilePath + ". ");
133123
return;
134124
}

0 commit comments

Comments
 (0)