NullPointerException in Proxy-vole 1.0.5
gschnepp opened this issue · 4 comments
Hello,
a customer of mine is getting a NullPointerException in PacProxySelector#findProxy():
caused by: java.lang.NullPointerException
at com.github.markusbernhardt.proxy.selector.pac.PacProxySelector.findProxy(PacProxySelector.java:128)
at com.github.markusbernhardt.proxy.selector.pac.PacProxySelector.select(PacProxySelector.java:110)
at com.github.markusbernhardt.proxy.selector.misc.BufferedProxySelector.select(BufferedProxySelector.java:137)
at com.github.markusbernhardt.proxy.selector.misc.ProxyListFallbackSelector.select(ProxyListFallbackSelector.java:80)
at de.credo.lookup2.proxy.ProxyHandler.activate<ProxyHandler.java:282)
Relevant line in my program is:
data.proxyObject = proxySelector.select(new URI("https://license.cre-do.de")).get(0);
Program breaks at line 128 in PacProxySelector, which is:
String parseResult = this.pacScriptParser.evaluate(uri.toString(), uri.getHost());
Since given uri parameter is not null and valid by convention, only reason can be that variable pacScriptParser is null. (NPE is not in evaluate() method, so it's not able to call this method.) This variable in turn is set in PacProxySelector constructor with a PacScriptSource as parameter (PacProxySelector:41). This variable can only be null in case a JavaxPacScriptParser can't be created with this source.
To sum it up: A PAC script can't be evaluated by JavaxPacScriptParser and kills subsequent methods by not catching null. I'll try to get this PAC script, but this company may not be able or willing to give it out. Analysis of the PAC script can be the half solution only anyway.
Regards
Guido
Hello Guido
I have the same problem as you. Did you find a way around it? I tested it with 1.0.4 and 1.0.5.
Regards
Marcel
No, not yet. I had two customers recently with the same problem, both using unknown PAC/WPAD scripts. And both were not willing to share any part of their script with me (resp. us, I pointed them to this issue here, with no further responds).
Workaround was is to catch NPE on my side and deactivate automatic proxy detection (resp. direct/no proxy). When my application starts, users can select their proxy by hand. This seem to work.
Since customers are not willing to share their detailed proxy settings with me/us, I have no more information but to work around as described.
Are you able to get their script for a detail analysis?
Regards
Guido
Sorry. It took some time to look into this. Do you see in the log before the NullPointerException the following error: "PAC parser error."?
I will add a check for null to avoid the NPE and return a NO_PROXY in this case.
Will be in release 1.0.6