return null;
IProxyService service = bc.getService(ref);
- if (service != null && service.isProxiesEnabled()) {
- IProxyData proxyData = service.getProxyData(IProxyData.HTTP_PROXY_TYPE);
- if (proxyData != null && proxyData.getHost() != null) {
- return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyData.getHost(), proxyData.getPort()));
+ try {
+ if (service != null && service.isProxiesEnabled()) {
+ IProxyData proxyData = service.getProxyData(IProxyData.HTTP_PROXY_TYPE);
+ if (proxyData != null && proxyData.getHost() != null) {
+ return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyData.getHost(), proxyData.getPort()));
+ }
}
+ return null;
+ } finally {
+ bc.ungetService(ref);
}
- return null;
}
}