Fix #502
* Check if port is valid before setting it * Validate user input * Change proxyPort to int
This commit is contained in:
@@ -43,7 +43,7 @@ public class LaunchOptions implements Serializable {
|
||||
private String serverIp;
|
||||
private String wrapper;
|
||||
private String proxyHost;
|
||||
private String proxyPort;
|
||||
private int proxyPort;
|
||||
private String proxyUser;
|
||||
private String proxyPass;
|
||||
private boolean noGeneratedJVMArgs;
|
||||
@@ -160,7 +160,7 @@ public class LaunchOptions implements Serializable {
|
||||
/**
|
||||
* the port of the proxy address.
|
||||
*/
|
||||
public String getProxyPort() {
|
||||
public int getProxyPort() {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class LaunchOptions implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setProxyPort(String proxyPort) {
|
||||
public Builder setProxyPort(int proxyPort) {
|
||||
options.proxyPort = proxyPort;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -162,11 +162,11 @@ public class DefaultLauncher extends Launcher {
|
||||
if (options.isFullscreen())
|
||||
res.add("--fullscreen");
|
||||
|
||||
if (StringUtils.isNotBlank(options.getProxyHost()) && StringUtils.isNotBlank(options.getProxyPort())) {
|
||||
if (StringUtils.isNotBlank(options.getProxyHost())) {
|
||||
res.add("--proxyHost");
|
||||
res.add(options.getProxyHost());
|
||||
res.add("--proxyPort");
|
||||
res.add(options.getProxyPort());
|
||||
res.add(String.valueOf(options.getProxyPort()));
|
||||
if (StringUtils.isNotBlank(options.getProxyUser()) && StringUtils.isNotBlank(options.getProxyPass())) {
|
||||
res.add("--proxyUser");
|
||||
res.add(options.getProxyUser());
|
||||
|
||||
Reference in New Issue
Block a user