Skip to content

Commit 2d55d0d

Browse files
committed
Fix handling of multiple Kafka hosts.
When multiple Kafka hosts are specified as part of the alarm URI, the URI cannot be parsed as a server-based URI, only as a registry-based URI. This means that the getHosts(), getPort(), and getUserInfo() methods return null. Therefore, we have to use getAuthority() instead when cloning the URI. This closes #3071.
1 parent 99614b6 commit 2d55d0d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/tree/AlarmTreeInstance.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public AlarmTreeInstance(final AlarmTreeApplication app, final URI input) throws
4949
this.app = app;
5050

5151
// split input with/without (raw) query
52-
final URI resource = new URI(input.getScheme(), input.getUserInfo(), input.getHost(), input.getPort(), input.getPath(), null, null);
52+
// When the URI specifies multiple host / port pairs getHost() will not
53+
// work, so we use getAuthority() instead.
54+
final URI resource = new URI(input.getScheme(), input.getAuthority(), input.getPath(), null, null);
5355
String itemName = AlarmURI.getRawQueryParametersValues(input).get(AlarmURI.QUERY_PARAMETER_ITEM_NAME);
5456
itemName = itemName != null ? URLDecoder.decode(itemName, StandardCharsets.UTF_8) : null;
5557

0 commit comments

Comments
 (0)