summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-08 03:47:43 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-08 03:48:50 +0100
commit5aa8191cd3e93e5b128d2c865e2d542a61a770c9 (patch)
tree51868549be443d3b8aa5c4d0c7d3c9bdabcaa59f /app/src/main/java/com/wireguard/android
parentbb43804d58ac0b055b3f26dc607a1134f4714488 (diff)
Do not close zip input stream
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index 783c0a29..de8f6c06 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -43,8 +43,10 @@ import com.wireguard.android.widget.fab.FloatingActionsMenuRecyclerViewScrollLis
import com.wireguard.config.Config;
import com.wireguard.config.ParseException;
+import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
@@ -122,7 +124,8 @@ public class TunnelListFragment extends BaseFragment {
throw new IllegalArgumentException("File must be .conf or .zip");
if (isZip) {
- try (ZipInputStream zip = new ZipInputStream(contentResolver.openInputStream(uri))) {
+ try (ZipInputStream zip = new ZipInputStream(contentResolver.openInputStream(uri));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(zip))) {
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null) {
if (entry.isDirectory())
@@ -140,7 +143,7 @@ public class TunnelListFragment extends BaseFragment {
continue;
Config config = null;
try {
- config = Config.parse(zip);
+ config = Config.parse(reader);
} catch (Exception e) {
throwables.add(e);
}