use switch

This commit is contained in:
xuwei-k
2017-04-02 15:24:01 +09:00
parent 114c50a354
commit fe5961c59e

View File

@@ -19,19 +19,25 @@ public class JettyLauncher {
if(arg.startsWith("--") && arg.contains("=")) { if(arg.startsWith("--") && arg.contains("=")) {
String[] dim = arg.split("="); String[] dim = arg.split("=");
if(dim.length >= 2) { if(dim.length >= 2) {
if(dim[0].equals("--host")) { switch (dim[0]) {
host = dim[1]; case "--host":
} else if(dim[0].equals("--port")) { host = dim[1];
port = Integer.parseInt(dim[1]); break;
} else if(dim[0].equals("--prefix")) { case "--port":
contextPath = dim[1]; port = Integer.parseInt(dim[1]);
if(!contextPath.startsWith("/")){ break;
contextPath = "/" + contextPath; case "--prefix":
} contextPath = dim[1];
} else if(dim[0].equals("--gitbucket.home")){ if (!contextPath.startsWith("/")) {
System.setProperty("gitbucket.home", dim[1]); contextPath = "/" + contextPath;
} else if(dim[0].equals("--temp_dir")){ }
tmpDirPath = dim[1]; break;
case "--gitbucket.home":
System.setProperty("gitbucket.home", dim[1]);
break;
case "--temp_dir":
tmpDirPath = dim[1];
break;
} }
} }
} }