Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Decode ComponentId to avoid UI throwing errors #3827

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
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;
Expand Down Expand Up @@ -4717,26 +4719,27 @@ public ComponentPageInfo getComponentPageInfo(String topoId, String componentId,
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);
}
Expand All @@ -4747,7 +4750,7 @@ public ComponentPageInfo getComponentPageInfo(String topoId, String componentId,
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;
Expand Down
Loading