Avoid NPE in exception for bad version #2284
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
c73ecae431
commit
e2b9351662
|
@ -1275,7 +1275,9 @@ public class StartArgs
|
||||||
}
|
}
|
||||||
catch (Throwable x)
|
catch (Throwable x)
|
||||||
{
|
{
|
||||||
throw new UsageException(UsageException.ERR_BAD_ARG, x.getMessage());
|
UsageException ue = new UsageException(UsageException.ERR_BAD_ARG, x.getMessage()==null?x.toString():x.getMessage());
|
||||||
|
ue.initCause(x);
|
||||||
|
throw ue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ public class UsageException extends RuntimeException
|
||||||
public static final int ERR_UNKNOWN = -9;
|
public static final int ERR_UNKNOWN = -9;
|
||||||
private int exitCode;
|
private int exitCode;
|
||||||
|
|
||||||
|
public UsageException(int exitCode, String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
this.exitCode = exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
public UsageException(int exitCode, String format, Object... objs)
|
public UsageException(int exitCode, String format, Object... objs)
|
||||||
{
|
{
|
||||||
super(String.format(format,objs));
|
super(String.format(format,objs));
|
||||||
|
|
Loading…
Reference in New Issue