Issue #1326 - Search system properties too for --stop
+ The NPE should be cleared up as well
This commit is contained in:
parent
10b7326c3c
commit
852d9d5c01
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_BAD_GRAPH;
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_BAD_STOP_PROPS;
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_INVOKE_MAIN;
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_NOT_STOPPED;
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_UNKNOWN;
|
||||
|
@ -464,14 +465,33 @@ public class Main
|
|||
|
||||
private void doStop(StartArgs args)
|
||||
{
|
||||
String stopHost = args.getProperties().getString("STOP.HOST");
|
||||
int stopPort = Integer.parseInt(args.getProperties().getString("STOP.PORT"));
|
||||
String stopKey = args.getProperties().getString("STOP.KEY");
|
||||
Props.Prop stopHostProp = args.getProperties().getProp("STOP.HOST", true);
|
||||
Props.Prop stopPortProp = args.getProperties().getProp("STOP.PORT", true);
|
||||
Props.Prop stopKeyProp = args.getProperties().getProp("STOP.KEY", true);
|
||||
Props.Prop stopWaitProp = args.getProperties().getProp("STOP.WAIT", true);
|
||||
|
||||
if (args.getProperties().getString("STOP.WAIT") != null)
|
||||
String stopHost = "127.0.0.1";
|
||||
int stopPort = -1;
|
||||
String stopKey = "";
|
||||
|
||||
if (stopHostProp != null)
|
||||
{
|
||||
int stopWait = Integer.parseInt(args.getProperties().getString("STOP.WAIT"));
|
||||
stopHost = stopHostProp.value;
|
||||
}
|
||||
|
||||
if (stopPortProp != null)
|
||||
{
|
||||
stopPort = Integer.parseInt(stopPortProp.value);
|
||||
}
|
||||
|
||||
if(stopKeyProp != null)
|
||||
{
|
||||
stopKey = stopKeyProp.value;
|
||||
}
|
||||
|
||||
if (stopWaitProp != null)
|
||||
{
|
||||
int stopWait = Integer.parseInt(stopWaitProp.value);
|
||||
stop(stopHost, stopPort, stopKey, stopWait);
|
||||
}
|
||||
else
|
||||
|
@ -494,18 +514,21 @@ public class Main
|
|||
public void stop(String host, int port, String key, int timeout)
|
||||
{
|
||||
if (host==null || host.length()==0)
|
||||
{
|
||||
host = "127.0.0.1";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (port <= 0)
|
||||
if ( (port <= 0) || (port > 65535) )
|
||||
{
|
||||
System.err.println("STOP.PORT system property must be specified");
|
||||
System.err.println("STOP.PORT property must be specified with a valid port number");
|
||||
usageExit(ERR_BAD_STOP_PROPS);
|
||||
}
|
||||
if (key == null)
|
||||
{
|
||||
key = "";
|
||||
System.err.println("STOP.KEY system property must be specified");
|
||||
System.err.println("STOP.KEY property must be specified");
|
||||
System.err.println("Using empty key");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ public class UsageException extends RuntimeException
|
|||
public static final int ERR_NOT_STOPPED = -4;
|
||||
public static final int ERR_BAD_ARG = -5;
|
||||
public static final int ERR_BAD_GRAPH = -6;
|
||||
public static final int ERR_BAD_STOP_PROPS = -7;
|
||||
public static final int ERR_UNKNOWN = -9;
|
||||
private int exitCode;
|
||||
|
||||
|
|
Loading…
Reference in New Issue