From 90349ff2bf27a81ef7412f15b22769ff6ca6bd6e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 9 Aug 2017 16:36:25 +0200 Subject: Sophisticate proxy parsing and generating, fix misinterpretation if SOCKS proxies This is a quick and dirty fix; it seems a major redesign is appropriate. We should also switch to some maintained version of proxy-vole from github. This one looks halfway active: https://github.com/MarkusBernhardt/proxy-vole or maybe one of its forks... --- .../com/btr/proxy/search/wpad/WpadProxySearchStrategy.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java') diff --git a/src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java b/src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java index e559d62..0d3e6dc 100644 --- a/src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java +++ b/src/main/java/com/btr/proxy/search/wpad/WpadProxySearchStrategy.java @@ -119,11 +119,8 @@ public class WpadProxySearchStrategy implements ProxySearchStrategy { return ret; } - BufferedReader br = null; String[] addresses = null; - try { - FileReader fr = new FileReader("/etc/resolv.conf"); - br = new BufferedReader(fr); + try (FileReader fr = new FileReader("/etc/resolv.conf"); BufferedReader br = new BufferedReader(fr)) { String input; while ((input = br.readLine()) != null) { if (input.startsWith("search")) { @@ -134,11 +131,6 @@ public class WpadProxySearchStrategy implements ProxySearchStrategy { } } catch (IOException e1) { Logger.log(getClass(), LogLevel.DEBUG, "Could not read resolv.conf"); - } finally { - try { - br.close(); - } catch (Exception e) { - } } if (addresses == null) { -- cgit v1.2.3-55-g7522