Code cleanup (post-merge)

This commit is contained in:
Joakim Erdfelt 2014-10-28 09:45:25 -07:00
parent a129ca89ce
commit f4f600ff05
1 changed files with 45 additions and 34 deletions

View File

@ -86,7 +86,9 @@ public class Main
public static String join(Collection<?> objs, String delim) public static String join(Collection<?> objs, String delim)
{ {
if (objs==null) if (objs==null)
{
return ""; return "";
}
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
boolean needDelim = false; boolean needDelim = false;
for (Object obj : objs) for (Object obj : objs)
@ -398,23 +400,29 @@ public class Main
{ {
// is it an explicit request to create an ini file? // is it an explicit request to create an ini file?
if (topLevel && !FS.exists(startd_ini) && !appendStartIni) if (topLevel && !FS.exists(startd_ini) && !appendStartIni)
{
buildIni=true; buildIni=true;
}
// else is it transitive // else is it transitive
else if (transitive) else if (transitive)
{ {
// do we need an ini anyway? // do we need an ini anyway?
if (module.hasDefaultConfig() || module.hasLicense()) if (module.hasDefaultConfig() || module.hasLicense())
buildIni=true; {
buildIni = true;
}
else else
{
StartLog.info("%-15s initialised transitively",name); StartLog.info("%-15s initialised transitively",name);
}
} }
// else must be initialized explicitly // else must be initialized explicitly
else else
{ {
for (String source : module.getSources()) for (String source : module.getSources())
{
StartLog.info("%-15s initialised in %s",name,baseHome.toShortForm(source)); StartLog.info("%-15s initialised in %s",name,baseHome.toShortForm(source));
}
} }
} }
else else
@ -581,7 +589,9 @@ public class Main
} }
if (complete) if (complete)
{
break; break;
}
// look for any new ones resolved via expansion // look for any new ones resolved via expansion
depends.clear(); depends.clear();
@ -715,7 +725,7 @@ public class Main
if (args.isStopCommand()) if (args.isStopCommand())
{ {
doStop(args); doStop(args);
} }
// Initialize start.ini // Initialize start.ini
@ -816,20 +826,21 @@ public class Main
} }
} }
private void doStop(StartArgs args) { private void doStop(StartArgs args)
int stopPort = Integer.parseInt(args.getProperties().getString("STOP.PORT")); {
String stopKey = args.getProperties().getString("STOP.KEY"); int stopPort = Integer.parseInt(args.getProperties().getString("STOP.PORT"));
String stopKey = args.getProperties().getString("STOP.KEY");
if (args.getProperties().getString("STOP.WAIT") != null) if (args.getProperties().getString("STOP.WAIT") != null)
{ {
int stopWait = Integer.parseInt(args.getProperties().getString("STOP.WAIT")); int stopWait = Integer.parseInt(args.getProperties().getString("STOP.WAIT"));
stop(stopPort,stopKey,stopWait); stop(stopPort,stopKey,stopWait);
} }
else else
{ {
stop(stopPort,stopKey); stop(stopPort,stopKey);
} }
} }
/** /**
@ -949,29 +960,29 @@ public class Main
// implement Apache commons daemon (jsvc) lifecycle methods (init, start, stop, destroy) // implement Apache commons daemon (jsvc) lifecycle methods (init, start, stop, destroy)
public void init(String[] args) throws Exception public void init(String[] args) throws Exception
{ {
try try
{ {
startupArgs = processCommandLine(args); startupArgs = processCommandLine(args);
} }
catch (UsageException e) catch (UsageException e)
{ {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
usageExit(e.getCause(),e.getExitCode()); usageExit(e.getCause(),e.getExitCode());
} }
catch (Throwable e) catch (Throwable e)
{ {
usageExit(e,UsageException.ERR_UNKNOWN); usageExit(e,UsageException.ERR_UNKNOWN);
} }
} }
public void start() throws Exception public void start() throws Exception
{ {
start(startupArgs); start(startupArgs);
} }
public void stop() throws Exception public void stop() throws Exception
{ {
doStop(startupArgs); doStop(startupArgs);
} }
public void destroy() public void destroy()