Skip to content

Commit 457194d

Browse files
authored
fix: Decode ComponentId to avoid UI throwing errors (#3827)
1 parent 4fd8bd9 commit 457194d

File tree

1 file changed

+11
-8
lines changed
  • storm-server/src/main/java/org/apache/storm/daemon/nimbus

1 file changed

+11
-8
lines changed

storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java

+11-8
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@
3535
import java.io.OutputStream;
3636
import java.net.BindException;
3737
import java.net.ServerSocket;
38+
import java.net.URLDecoder;
3839
import java.nio.ByteBuffer;
3940
import java.nio.channels.Channels;
4041
import java.nio.channels.WritableByteChannel;
42+
import java.nio.charset.StandardCharsets;
4143
import java.security.Principal;
4244
import java.util.ArrayList;
4345
import java.util.Arrays;
@@ -4717,26 +4719,27 @@ public ComponentPageInfo getComponentPageInfo(String topoId, String componentId,
47174719
nodeToHost = Collections.emptyMap();
47184720
}
47194721

4722+
String sanitizedComponentId = URLDecoder.decode(componentId, StandardCharsets.UTF_8);
47204723
ComponentPageInfo compPageInfo = StatsUtil.aggCompExecsStats(exec2HostPort, info.taskToComponent, info.beats, window,
4721-
includeSys, topoId, topology, componentId);
4724+
includeSys, topoId, topology, sanitizedComponentId);
47224725
if (compPageInfo.get_component_type() == ComponentType.SPOUT) {
4723-
NormalizedResourceRequest spoutResources = ResourceUtils.getSpoutResources(topology, topoConf, componentId);
4726+
NormalizedResourceRequest spoutResources = ResourceUtils.getSpoutResources(topology, topoConf, sanitizedComponentId);
47244727
if (spoutResources == null) {
4725-
spoutResources = new NormalizedResourceRequest(topoConf, componentId);
4728+
spoutResources = new NormalizedResourceRequest(topoConf, sanitizedComponentId);
47264729
}
47274730
compPageInfo.set_resources_map(spoutResources.toNormalizedMap());
47284731
} else { //bolt
4729-
NormalizedResourceRequest boltResources = ResourceUtils.getBoltResources(topology, topoConf, componentId);
4732+
NormalizedResourceRequest boltResources = ResourceUtils.getBoltResources(topology, topoConf, sanitizedComponentId);
47304733
if (boltResources == null) {
4731-
boltResources = new NormalizedResourceRequest(topoConf, componentId);
4734+
boltResources = new NormalizedResourceRequest(topoConf, sanitizedComponentId);
47324735
}
47334736
compPageInfo.set_resources_map(boltResources.toNormalizedMap());
47344737
}
47354738
compPageInfo.set_topology_name(info.topoName);
4736-
compPageInfo.set_errors(stormClusterState.errors(topoId, componentId));
4739+
compPageInfo.set_errors(stormClusterState.errors(topoId, sanitizedComponentId));
47374740
compPageInfo.set_topology_status(extractStatusStr(info.base));
47384741
if (info.base.is_set_component_debug()) {
4739-
DebugOptions debug = info.base.get_component_debug().get(componentId);
4742+
DebugOptions debug = info.base.get_component_debug().get(sanitizedComponentId);
47404743
if (debug != null) {
47414744
compPageInfo.set_debug_options(debug);
47424745
}
@@ -4747,7 +4750,7 @@ public ComponentPageInfo getComponentPageInfo(String topoId, String componentId,
47474750
List<Integer> tasks = compToTasks.get(StormCommon.EVENTLOGGER_COMPONENT_ID);
47484751
tasks.sort(null);
47494752
// Find the task the events from this component route to.
4750-
int taskIndex = TupleUtils.chooseTaskIndex(Collections.singletonList(componentId), tasks.size());
4753+
int taskIndex = TupleUtils.chooseTaskIndex(Collections.singletonList(sanitizedComponentId), tasks.size());
47514754
int taskId = tasks.get(taskIndex);
47524755
String host = null;
47534756
Integer port = null;

0 commit comments

Comments
 (0)