Return-Path: X-Original-To: apmail-flink-commits-archive@minotaur.apache.org Delivered-To: apmail-flink-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13CAA18F36 for ; Thu, 7 Jan 2016 17:58:59 +0000 (UTC) Received: (qmail 39537 invoked by uid 500); 7 Jan 2016 17:58:59 -0000 Delivered-To: apmail-flink-commits-archive@flink.apache.org Received: (qmail 39489 invoked by uid 500); 7 Jan 2016 17:58:58 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 39479 invoked by uid 99); 7 Jan 2016 17:58:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jan 2016 17:58:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C4052E2C5A; Thu, 7 Jan 2016 17:58:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: fhueske@apache.org To: commits@flink.apache.org Date: Thu, 07 Jan 2016 17:58:58 -0000 Message-Id: <18a8e9915c0846fca47473f9203b8a3f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/5] flink git commit: [refactor] Change if-else conditions to switch-case statements. Repository: flink Updated Branches: refs/heads/master c674a6558 -> 08c81378b [refactor] Change if-else conditions to switch-case statements. This closes #1485 Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/54b89b95 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/54b89b95 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/54b89b95 Branch: refs/heads/master Commit: 54b89b95c82f2d660f320e97f961b69e50e0f06e Parents: c674a65 Author: Henry Saputra Authored: Tue Jan 5 13:45:14 2016 -0800 Committer: Fabian Hueske Committed: Thu Jan 7 16:55:10 2016 +0100 ---------------------------------------------------------------------- .../org/apache/flink/client/CliFrontend.java | 95 ++++++++++---------- 1 file changed, 46 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/54b89b95/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java ---------------------------------------------------------------------- diff --git a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java index 30007cd..b201cf4 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java +++ b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java @@ -965,57 +965,54 @@ public class CliFrontend { final String[] params = Arrays.copyOfRange(args, 1, args.length); // do action - if (action.equals(ACTION_RUN)) { - // run() needs to run in a secured environment for the optimizer. - if (SecurityUtils.isSecurityEnabled()) { - String message = "Secure Hadoop environment setup detected. Running in secure context."; - LOG.info(message); - if (!webFrontend) { - System.out.println(message); - } + switch (action) { + case ACTION_RUN: + // run() needs to run in a secured environment for the optimizer. + if (SecurityUtils.isSecurityEnabled()) { + String message = "Secure Hadoop environment setup detected. Running in secure context."; + LOG.info(message); + if (!webFrontend) { + System.out.println(message); + } - try { - return SecurityUtils.runSecured(new SecurityUtils.FlinkSecuredRunner() { - @Override - public Integer run() throws Exception { - return CliFrontend.this.run(params); - } - }); - } catch (Exception e) { - handleError(e); + try { + return SecurityUtils.runSecured(new SecurityUtils.FlinkSecuredRunner() { + @Override + public Integer run() throws Exception { + return CliFrontend.this.run(params); + } + }); + } catch (Exception e) { + return handleError(e); + } } - } - return run(params); - } - else if (action.equals(ACTION_LIST)) { - return list(params); - } - else if (action.equals(ACTION_INFO)) { - return info(params); - } - else if (action.equals(ACTION_CANCEL)) { - return cancel(params); - } - else if (action.equals("-h") || action.equals("--help")) { - CliFrontendParser.printHelp(); - return 0; - } - else if (action.equals("-v") || action.equals("--version")) { - String version = EnvironmentInformation.getVersion(); - String commitID = EnvironmentInformation.getRevisionInformation().commitId; - System.out.print("Version: " + version); - System.out.println(!commitID.equals(EnvironmentInformation.UNKNOWN) ? ", Commit ID: " + commitID : ""); - return 0; - } - else { - System.out.printf("\"%s\" is not a valid action.\n", action); - System.out.println(); - System.out.println("Valid actions are \"run\", \"list\", \"info\", or \"cancel\"."); - System.out.println(); - System.out.println("Specify the version option (-v or --version) to print Flink version."); - System.out.println(); - System.out.println("Specify the help option (-h or --help) to get help on the command."); - return 1; + return run(params); + case ACTION_LIST: + return list(params); + case ACTION_INFO: + return info(params); + case ACTION_CANCEL: + return cancel(params); + case "-h": + case "--help": + CliFrontendParser.printHelp(); + return 0; + case "-v": + case "--version": + String version = EnvironmentInformation.getVersion(); + String commitID = EnvironmentInformation.getRevisionInformation().commitId; + System.out.print("Version: " + version); + System.out.println(!commitID.equals(EnvironmentInformation.UNKNOWN) ? ", Commit ID: " + commitID : ""); + return 0; + default: + System.out.printf("\"%s\" is not a valid action.\n", action); + System.out.println(); + System.out.println("Valid actions are \"run\", \"list\", \"info\", or \"cancel\"."); + System.out.println(); + System.out.println("Specify the version option (-v or --version) to print Flink version."); + System.out.println(); + System.out.println("Specify the help option (-h or --help) to get help on the command."); + return 1; } }