karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject karaf git commit: [KARAF-3403]bin/client Utility Throws ArrayIndexOutOfBoundsException
Date Fri, 12 Dec 2014 02:37:57 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x d7d18452e -> 86aff6b16


[KARAF-3403]bin/client Utility Throws ArrayIndexOutOfBoundsException


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/86aff6b1
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/86aff6b1
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/86aff6b1

Branch: refs/heads/karaf-3.0.x
Commit: 86aff6b16af3990251db44bff605682e9d870efa
Parents: d7d1845
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Fri Dec 12 10:37:41 2014 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Fri Dec 12 10:37:41 2014 +0800

----------------------------------------------------------------------
 .../org/apache/karaf/client/ClientConfig.java   | 49 +++++++++++++++++---
 1 file changed, 42 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/86aff6b1/client/src/main/java/org/apache/karaf/client/ClientConfig.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/ClientConfig.java b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
index 75539e9..444849d 100644
--- a/client/src/main/java/org/apache/karaf/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
@@ -56,23 +56,58 @@ public class ClientConfig {
         for (int i = 0; i < args.length; i++) {
             if (args[i].charAt(0) == '-') {
                 if (args[i].equals("-a")) {
-                    port = Integer.parseInt(args[++i]);
+                    if (args.length <= ++i) {
+                        System.err.println("miss the port");
+                        System.exit(1);
+                    } else {
+                        port = Integer.parseInt(args[i]);
+                    }
                 } else if (args[i].equals("-h")) {
-                    host = args[++i];
+                    if (args.length <= ++i) {
+                        System.err.println("miss the host");
+                        System.exit(1);
+                    } else {
+                        host = args[i];
+                    }
                 } else if (args[i].equals("-u")) {
-                    user = args[++i];
+                    if (args.length <= ++i) {
+                        System.err.println("miss the user");
+                        System.exit(1);
+                    } else {
+                        user = args[i];
+                    }
                 } else if (args[i].equals("-v")) {
                     level++;
                 } else if (args[i].equals("-r")) {
-                    retryAttempts = Integer.parseInt(args[++i]);
+                    if (args.length <= ++i) {
+                        System.err.println("miss the attempts");
+                        System.exit(1);
+                    } else {
+                        retryAttempts = Integer.parseInt(args[i]);
+                    }
                 } else if (args[i].equals("-d")) {
-                    retryDelay = Integer.parseInt(args[++i]);
+                    if (args.length <= ++i) {
+                        System.err.println("miss the delay in seconds");
+                        System.exit(1);
+                    } else {
+                        retryDelay = Integer.parseInt(args[i]);
+                    }
                 } else if (args[i].equals("-b")) {
                     batch = true;
                 } else if (args[i].equals("-f")) {
-                    file = args[++i];
+                    if (args.length <= ++i) {
+                        System.err.println("miss the commands file");
+                        System.exit(1);
+                    } else {
+                        file = args[i];
+                    }
                 } else if (args[i].equals("-k")) {
-                    keyFile = args[++i];
+                    if (args.length <= ++i) {
+                        System.err.println("miss the key file");
+                        System.exit(1);
+                    } else {
+                        keyFile = args[i];
+                    }
                 } else if (args[i].equals("--help")) {
                     showHelp();
                 } else {


Mime
View raw message