fix: NPE
This commit is contained in:
@@ -138,16 +138,18 @@ public class DefaultLauncher extends Launcher {
|
|||||||
Proxy proxy = options.getProxy();
|
Proxy proxy = options.getProxy();
|
||||||
if (proxy != null && StringUtils.isBlank(options.getProxyUser()) && StringUtils.isBlank(options.getProxyPass())) {
|
if (proxy != null && StringUtils.isBlank(options.getProxyUser()) && StringUtils.isBlank(options.getProxyPass())) {
|
||||||
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
||||||
String host = address.getHostString();
|
if (address != null) {
|
||||||
int port = address.getPort();
|
String host = address.getHostString();
|
||||||
if (proxy.type() == Proxy.Type.HTTP) {
|
int port = address.getPort();
|
||||||
res.add("-Dhttp.proxyHost=" + host);
|
if (proxy.type() == Proxy.Type.HTTP) {
|
||||||
res.add("-Dhttp.proxyPort=" + port);
|
res.add("-Dhttp.proxyHost=" + host);
|
||||||
res.add("-Dhttps.proxyHost=" + host);
|
res.add("-Dhttp.proxyPort=" + port);
|
||||||
res.add("-Dhttps.proxyPort=" + port);
|
res.add("-Dhttps.proxyHost=" + host);
|
||||||
} else if (proxy.type() == Proxy.Type.SOCKS) {
|
res.add("-Dhttps.proxyPort=" + port);
|
||||||
res.add("-DsocksProxyHost=" + host);
|
} else if (proxy.type() == Proxy.Type.SOCKS) {
|
||||||
res.add("-DsocksProxyPort=" + port);
|
res.add("-DsocksProxyHost=" + host);
|
||||||
|
res.add("-DsocksProxyPort=" + port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,15 +204,17 @@ public class DefaultLauncher extends Launcher {
|
|||||||
|
|
||||||
if (options.getProxy() != null) {
|
if (options.getProxy() != null) {
|
||||||
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
InetSocketAddress address = (InetSocketAddress) options.getProxy().address();
|
||||||
res.add("--proxyHost");
|
if (address != null) {
|
||||||
res.add(address.getHostString());
|
res.add("--proxyHost");
|
||||||
res.add("--proxyPort");
|
res.add(address.getHostString());
|
||||||
res.add(String.valueOf(address.getPort()));
|
res.add("--proxyPort");
|
||||||
if (StringUtils.isNotBlank(options.getProxyUser()) && StringUtils.isNotBlank(options.getProxyPass())) {
|
res.add(String.valueOf(address.getPort()));
|
||||||
res.add("--proxyUser");
|
if (StringUtils.isNotBlank(options.getProxyUser()) && StringUtils.isNotBlank(options.getProxyPass())) {
|
||||||
res.add(options.getProxyUser());
|
res.add("--proxyUser");
|
||||||
res.add("--proxyPass");
|
res.add(options.getProxyUser());
|
||||||
res.add(options.getProxyPass());
|
res.add("--proxyPass");
|
||||||
|
res.add(options.getProxyPass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user