You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by sr...@apache.org on 2019/11/02 09:25:40 UTC
[storm] branch master updated: STORM-3211: Fix NPE in
WindowedBoltExecutor on getComponentConfiguration
This is an automated email from the ASF dual-hosted git repository.
srdo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git
The following commit(s) were added to refs/heads/master by this push:
new 55f346c STORM-3211: Fix NPE in WindowedBoltExecutor on getComponentConfiguration
new 9165a78 Merge pull request #3156 from efgpinto/STORM-3211
55f346c is described below
commit 55f346cb093d4f219ecb43b1e6b1a7c2ea5d9a5f
Author: Eduardo Pinto <ed...@blip.pt>
AuthorDate: Sun Oct 27 22:25:02 2019 +0000
STORM-3211: Fix NPE in WindowedBoltExecutor on getComponentConfiguration
---
.../src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java | 3 ++-
.../jvm/org/apache/storm/topology/WindowedBoltExecutorTest.java | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/storm-client/src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java b/storm-client/src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java
index e6a12d9..4713e95 100644
--- a/storm-client/src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java
+++ b/storm-client/src/jvm/org/apache/storm/topology/WindowedBoltExecutor.java
@@ -16,6 +16,7 @@ import static org.apache.storm.topology.base.BaseWindowedBolt.Count;
import static org.apache.storm.topology.base.BaseWindowedBolt.Duration;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -345,7 +346,7 @@ public class WindowedBoltExecutor implements IRichBolt {
@Override
public Map<String, Object> getComponentConfiguration() {
- return bolt.getComponentConfiguration();
+ return bolt.getComponentConfiguration() != null ? bolt.getComponentConfiguration() : Collections.emptyMap();
}
protected WindowLifecycleListener<Tuple> newWindowLifecycleListener() {
diff --git a/storm-client/test/jvm/org/apache/storm/topology/WindowedBoltExecutorTest.java b/storm-client/test/jvm/org/apache/storm/topology/WindowedBoltExecutorTest.java
index 5162cc6..0e38838 100644
--- a/storm-client/test/jvm/org/apache/storm/topology/WindowedBoltExecutorTest.java
+++ b/storm-client/test/jvm/org/apache/storm/topology/WindowedBoltExecutorTest.java
@@ -39,6 +39,7 @@ import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
@@ -214,6 +215,14 @@ public class WindowedBoltExecutorTest {
Mockito.verify(outputCollector).emit("$late", Arrays.asList(tuple), new Values(tuple));
}
+ @Test
+ public void testEmptyConfigOnWrappedBolt() {
+ IWindowedBolt wrappedBolt = Mockito.mock(IWindowedBolt.class);
+ Mockito.when(wrappedBolt.getComponentConfiguration()).thenReturn(null);
+ executor = new WindowedBoltExecutor(wrappedBolt);
+ assertTrue("Configuration is not empty", executor.getComponentConfiguration().isEmpty());
+ }
+
private static class TestWindowedBolt extends BaseWindowedBolt {
List<TupleWindow> tupleWindows = new ArrayList<>();