Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullpointer in PacProxySelector #60

Open
Kogs opened this issue Feb 24, 2016 · 0 comments
Open

Nullpointer in PacProxySelector #60

Kogs opened this issue Feb 24, 2016 · 0 comments

Comments

@Kogs
Copy link

Kogs commented Feb 24, 2016

We added the proxy vole Libary to an Software.
When the Customer tried to test it he get the following exception while doing some http request.

The code to setup Proxy Vole looks like this:

```

private static void checkProxies() {
        logger.info("Start proxy search");
        try {
            ProxySearch proxySearch = ProxySearch.getDefaultProxySearch();
            proxySearch.addStrategy(Strategy.OS_DEFAULT);
            proxySearch.addStrategy(Strategy.JAVA);
            proxySearch.addStrategy(Strategy.BROWSER);
            ProxySelector myProxySelector = proxySearch.getProxySelector();
            ProxySelector.setDefault(myProxySelector);
            if (myProxySelector != null) {
                List<Proxy> proxies = myProxySelector.select(new URI(RestUtil.BASE_URL));
                for (Proxy proxy : proxies) {
                    logger.info("Proxy type {}", proxy.type());
                    InetSocketAddress addr = (InetSocketAddress) proxy.address();
                    if (addr == null) {
                        logger.info("No Proxy Address found");
                    } else {
                        logger.info("Proxy host {} {}", addr.getHostName(), addr.getPort());
                    }
                }
            } else {
                logger.info("No Proxy Settings found");
            }
        } catch (Exception e) {
            logger.error("Failed to search Proxies", e);
        }
    }

```

This logs:

Proxy type DIRECT
No Proxy Address found

``

java.lang.NullPointerException: null
at com.btr.proxy.selector.pac.PacProxySelector.findProxy(PacProxySelector.java:127) ~[proxy_vole-1.0.1.jar:20131209]
at com.btr.proxy.selector.pac.PacProxySelector.select(PacProxySelector.java:108) ~[proxy_vole-1.0.1.jar:20131209]
at com.btr.proxy.selector.misc.BufferedProxySelector.select(BufferedProxySelector.java:84) ~[proxy_vole-1.0.1.jar:20131209]
at com.btr.proxy.selector.misc.ProxyListFallbackSelector.select(ProxyListFallbackSelector.java:71) ~[proxy_vole-1.0.1.jar:20131209]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) ~[na:1.8.0_25]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_25]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:649) ~[na:1.8.0_25]
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) ~[na:1.8.0_25]
at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[na:1.8.0_25]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) ~[na:1.8.0_25]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) ~[na:1.8.0_25]
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:275) ~[na:1.8.0_25]
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371) ~[na:1.8.0_25]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) ~[na:1.8.0_25]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1146) ~[na:1.8.0_25]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:997) ~[na:1.8.0_25]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) ~[na:1.8.0_25]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) ~[na:1.8.0_25]
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:81) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:568) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:537) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:137) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider.obtainAccessToken(ResourceOwnerPasswordAccessTokenProvider.java:47) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainNewAccessTokenInternal(AccessTokenProviderChain.java:142) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainAccessToken(AccessTokenProviderChain.java:118) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at org.springframework.security.oauth2.client.OAuth2RestTemplate.acquireAccessToken(OAuth2RestTemplate.java:221) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:173) ~[spring-security-oauth2-2.0.6.RELEASE.jar:na]
at ███.████████.█████.util.ws.RestUtil.loginForToken(RestUtil.java:174) ~[███-commons-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at ███.████████.█████.util.ws.RestUtil.createRestTemplate(RestUtil.java:142) ~[███-commons-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at ███.████████.█████.bos.ws.WSBOImpl.createTemplate(WSBOImpl.java:38) ~[███-bos-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at ███.████████.█████.bos.ws.WSBOImpl.saveCustomer(WSBOImpl.java:49) ~[███-bos-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at ███.████████.█████.███████.fxtaglib.DetailsViewAccountTable$CreateUpdateService$1.call(DetailsViewAccountTable.java:71) ~[███-tool-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at ███.████████.█████.███████.fxtaglib.DetailsViewAccountTable$CreateUpdateService$1.call(DetailsViewAccountTable.java:58) ~[███-tool-1.7-SNAPSHOT.jar:1.7-SNAPSHOT]
at javafx.concurrent.Task$TaskCallable.call(Task.java:1409) ~[jfxrt.jar:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_25]
at javafx.concurrent.Service.lambda$null$436(Service.java:718) ~[jfxrt.jar:na]
at javafx.concurrent.Service$$Lambda$959/2092111422.run(Unknown Source) ~[na:na]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
at javafx.concurrent.Service.lambda$executeTask$437(Service.java:717) ~[jfxrt.jar:na]
at javafx.concurrent.Service$$Lambda$958/17750416.run(Unknown Source) ~[na:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

Thanks for your help.
Im Currently waiting for the pac file the Customer is using, to take a look at it.

@Kogs Kogs mentioned this issue Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant