You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2016/02/24 17:43:21 UTC
[1/4] storm git commit: fix CLI about parsing the command line
arguments
Repository: storm
Updated Branches:
refs/heads/master 71d615b7c -> 56bc60374
fix CLI about parsing the command line arguments
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/3af457f8
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/3af457f8
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/3af457f8
Branch: refs/heads/master
Commit: 3af457f8cd3dec53af969a70f7f5238b4502dada
Parents: 58050a5
Author: xiaojian.fxj <xi...@alibaba-inc.com>
Authored: Tue Feb 23 23:11:44 2016 +0800
Committer: xiaojian.fxj <xi...@alibaba-inc.com>
Committed: Tue Feb 23 23:11:44 2016 +0800
----------------------------------------------------------------------
storm-core/src/jvm/org/apache/storm/command/CLI.java | 9 ++++++---
storm-core/test/jvm/org/apache/storm/command/TestCLI.java | 4 +++-
2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/3af457f8/storm-core/src/jvm/org/apache/storm/command/CLI.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/CLI.java b/storm-core/src/jvm/org/apache/storm/command/CLI.java
index d4eaa5d..2bad836 100644
--- a/storm-core/src/jvm/org/apache/storm/command/CLI.java
+++ b/storm-core/src/jvm/org/apache/storm/command/CLI.java
@@ -238,10 +238,13 @@ public class CLI {
DefaultParser parser = new DefaultParser();
CommandLine cl = parser.parse(options, rawArgs);
HashMap<String, Object> ret = new HashMap<>();
- for (Opt opt: opts) {
+ for (Opt opt : opts) {
Object current = null;
- for (String val: cl.getOptionValues(opt.shortName)) {
- current = opt.process(current, val);
+ String[] strings = cl.getOptionValues(opt.shortName);
+ if (strings != null) {
+ for (String val : cl.getOptionValues(opt.shortName)) {
+ current = opt.process(current, val);
+ }
}
if (current == null) {
current = opt.defaultValue;
http://git-wip-us.apache.org/repos/asf/storm/blob/3af457f8/storm-core/test/jvm/org/apache/storm/command/TestCLI.java
----------------------------------------------------------------------
diff --git a/storm-core/test/jvm/org/apache/storm/command/TestCLI.java b/storm-core/test/jvm/org/apache/storm/command/TestCLI.java
index b647458..5b2f220 100644
--- a/storm-core/test/jvm/org/apache/storm/command/TestCLI.java
+++ b/storm-core/test/jvm/org/apache/storm/command/TestCLI.java
@@ -32,13 +32,15 @@ public class TestCLI {
.opt("b", "bb", 1, CLI.AS_INT)
.opt("c", "cc", 1, CLI.AS_INT, CLI.FIRST_WINS)
.opt("d", "dd", null, CLI.AS_STRING, CLI.INTO_LIST)
+ .opt("e", "ee", null, CLI.AS_INT)
.arg("A")
.arg("B", CLI.AS_INT)
.parse("-a100", "--aa", "200", "-c2", "-b", "50", "--cc", "100", "A-VALUE", "1", "2", "3", "-b40", "-d1", "-d2", "-d3");
- assertEquals(6, values.size());
+ assertEquals(7, values.size());
assertEquals("200", (String)values.get("a"));
assertEquals((Integer)40, (Integer)values.get("b"));
assertEquals((Integer)2, (Integer)values.get("c"));
+ assertEquals(null, values.get("e"));
List<String> d = (List<String>)values.get("d");
assertEquals(3, d.size());
[2/4] storm git commit: Merge branch '0223' of
https://github.com/hustfxj/storm into STORM-1572
Posted by bo...@apache.org.
Merge branch '0223' of https://github.com/hustfxj/storm into STORM-1572
STORM-1572: throw NPE when parsing the command line arguments by CLI
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/1a83267f
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/1a83267f
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/1a83267f
Branch: refs/heads/master
Commit: 1a83267f5cacdff7db3934e3b0f00123357e2a4d
Parents: 71d615b 3af457f
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Feb 24 10:30:34 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Feb 24 10:30:34 2016 -0600
----------------------------------------------------------------------
storm-core/src/jvm/org/apache/storm/command/CLI.java | 9 ++++++---
storm-core/test/jvm/org/apache/storm/command/TestCLI.java | 4 +++-
2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[4/4] storm git commit: Added STORM-1572 to Changelog
Posted by bo...@apache.org.
Added STORM-1572 to Changelog
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/56bc6037
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/56bc6037
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/56bc6037
Branch: refs/heads/master
Commit: 56bc60374acc61554615d771c09f3c84b8a4ba14
Parents: 9e65c11
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Feb 24 10:41:57 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Feb 24 10:41:57 2016 -0600
----------------------------------------------------------------------
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/56bc6037/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc11139..285cfe4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## 2.0.0
+ * STORM-1572: throw NPE when parsing the command line arguments by CLI
* STORM-1273: port backtype.storm.cluster to java
* STORM-1479: use a simple implemention for IntSerializer
* STORM-1255: port storm_utils.clj to java and split Time tests into its
[3/4] storm git commit: STORM-1572: Minor rework
Posted by bo...@apache.org.
STORM-1572: Minor rework
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/9e65c114
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/9e65c114
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/9e65c114
Branch: refs/heads/master
Commit: 9e65c1141fcd4141da5e46e36acffea0fc29ace4
Parents: 1a83267
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Feb 24 10:41:40 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Feb 24 10:41:40 2016 -0600
----------------------------------------------------------------------
storm-core/src/jvm/org/apache/storm/command/CLI.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/9e65c114/storm-core/src/jvm/org/apache/storm/command/CLI.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/CLI.java b/storm-core/src/jvm/org/apache/storm/command/CLI.java
index 2bad836..ff894c2 100644
--- a/storm-core/src/jvm/org/apache/storm/command/CLI.java
+++ b/storm-core/src/jvm/org/apache/storm/command/CLI.java
@@ -242,7 +242,7 @@ public class CLI {
Object current = null;
String[] strings = cl.getOptionValues(opt.shortName);
if (strings != null) {
- for (String val : cl.getOptionValues(opt.shortName)) {
+ for (String val : strings) {
current = opt.process(current, val);
}
}