code improvements & delete task endpoint
This commit is contained in:
@@ -8,11 +8,16 @@ public class ExecutorURI {
|
||||
private String value;
|
||||
|
||||
public ExecutorURI(String uri) throws InvalidExecutorURIException {
|
||||
if (uri.equalsIgnoreCase("localhost") ||
|
||||
uri.matches("^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}$")) {
|
||||
this.value = uri;
|
||||
} else {
|
||||
String ip = uri.split(":")[0];
|
||||
int port = Integer.parseInt(uri.split(":")[1]);
|
||||
// Check if valid ip4
|
||||
if (!ip.equalsIgnoreCase("localhost") &&
|
||||
!uri.matches("^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}$")) {
|
||||
throw new InvalidExecutorURIException();
|
||||
// Check if valid port
|
||||
} else if (port < 1024 || port > 65535) {
|
||||
throw new InvalidExecutorURIException();
|
||||
}
|
||||
this.value = uri;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user