|
@@ -32,11 +32,16 @@ public class Main {
|
32
|
32
|
}
|
33
|
33
|
|
34
|
34
|
private static int getPort(String value, int defaultValue) {
|
35
|
|
- int port = defaultValue;
|
|
35
|
+ int port;
|
36
|
36
|
try {
|
37
|
37
|
port = Integer.parseInt(value.trim());
|
|
38
|
+ if (port <= 1024 || port >= 64000) {
|
|
39
|
+ System.out.println("Port should be between 1024 and 64000. Falling back to default.");
|
|
40
|
+ port = defaultValue;
|
|
41
|
+ }
|
38
|
42
|
} catch (NumberFormatException e) {
|
39
|
|
- System.out.println("Could not read port " + value + ". Using default.");
|
|
43
|
+ System.out.println("Could not read port " + value + ". Falling back to default.");
|
|
44
|
+ port = defaultValue;
|
40
|
45
|
}
|
41
|
46
|
return port;
|
42
|
47
|
}
|