This is an automated email from the ASF dual-hosted git repository.

rabreu 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 457194d18 fix: Decode ComponentId to avoid UI throwing errors (#3827)
457194d18 is described below

commit 457194d18978c22fe35c4ea4453099a1c65caf88
Author: paxadax <[email protected]>
AuthorDate: Fri Jan 10 12:16:50 2025 +0000

    fix: Decode ComponentId to avoid UI throwing errors (#3827)
---
 .../java/org/apache/storm/daemon/nimbus/Nimbus.java   | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git 
a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java 
b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
index c84572270..74610cbe9 100644
--- a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
+++ b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
@@ -35,9 +35,11 @@ import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.net.BindException;
 import java.net.ServerSocket;
+import java.net.URLDecoder;
 import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
 import java.nio.channels.WritableByteChannel;
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -4717,26 +4719,27 @@ public class Nimbus implements Iface, Shutdownable, 
DaemonCommon {
                 nodeToHost = Collections.emptyMap();
             }
 
+            String sanitizedComponentId = URLDecoder.decode(componentId, 
StandardCharsets.UTF_8);
             ComponentPageInfo compPageInfo = 
StatsUtil.aggCompExecsStats(exec2HostPort, info.taskToComponent, info.beats, 
window,
-                                                                         
includeSys, topoId, topology, componentId);
+                                                                         
includeSys, topoId, topology, sanitizedComponentId);
             if (compPageInfo.get_component_type() == ComponentType.SPOUT) {
-                NormalizedResourceRequest spoutResources = 
ResourceUtils.getSpoutResources(topology, topoConf, componentId);
+                NormalizedResourceRequest spoutResources = 
ResourceUtils.getSpoutResources(topology, topoConf, sanitizedComponentId);
                 if (spoutResources == null) {
-                    spoutResources = new NormalizedResourceRequest(topoConf, 
componentId);
+                    spoutResources = new NormalizedResourceRequest(topoConf, 
sanitizedComponentId);
                 }
                 
compPageInfo.set_resources_map(spoutResources.toNormalizedMap());
             } else { //bolt
-                NormalizedResourceRequest boltResources = 
ResourceUtils.getBoltResources(topology, topoConf, componentId);
+                NormalizedResourceRequest boltResources = 
ResourceUtils.getBoltResources(topology, topoConf, sanitizedComponentId);
                 if (boltResources == null) {
-                    boltResources = new NormalizedResourceRequest(topoConf, 
componentId);
+                    boltResources = new NormalizedResourceRequest(topoConf, 
sanitizedComponentId);
                 }
                 
compPageInfo.set_resources_map(boltResources.toNormalizedMap());
             }
             compPageInfo.set_topology_name(info.topoName);
-            compPageInfo.set_errors(stormClusterState.errors(topoId, 
componentId));
+            compPageInfo.set_errors(stormClusterState.errors(topoId, 
sanitizedComponentId));
             compPageInfo.set_topology_status(extractStatusStr(info.base));
             if (info.base.is_set_component_debug()) {
-                DebugOptions debug = 
info.base.get_component_debug().get(componentId);
+                DebugOptions debug = 
info.base.get_component_debug().get(sanitizedComponentId);
                 if (debug != null) {
                     compPageInfo.set_debug_options(debug);
                 }
@@ -4747,7 +4750,7 @@ public class Nimbus implements Iface, Shutdownable, 
DaemonCommon {
                 List<Integer> tasks = 
compToTasks.get(StormCommon.EVENTLOGGER_COMPONENT_ID);
                 tasks.sort(null);
                 // Find the task the events from this component route to.
-                int taskIndex = 
TupleUtils.chooseTaskIndex(Collections.singletonList(componentId), 
tasks.size());
+                int taskIndex = 
TupleUtils.chooseTaskIndex(Collections.singletonList(sanitizedComponentId), 
tasks.size());
                 int taskId = tasks.get(taskIndex);
                 String host = null;
                 Integer port = null;

Reply via email to