You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The code in the web socket interface does not parse topic names correctly. I will limit my example to a consumer but similar issues apply to readers and producers.
From the code (line numbers are for reference, they do not match the actual code)
1Stringuri = request.getRequestURI();
2List<String> parts = Splitter.on("/").splitToList(uri);
34// V1 Format must be like :5// /ws/producer/persistent/my-property/my-cluster/my-ns/my-topic6// or7// /ws/consumer/persistent/my-property/my-cluster/my-ns/my-topic/my-subscription8// or9// /ws/reader/persistent/my-property/my-cluster/my-ns/my-topic1011// V2 Format must be like :12// /ws/v2/producer/persistent/my-property/my-ns/my-topic13// or14// /ws/v2/consumer/persistent/my-property/my-ns/my-topic/my-subscription15// or16// /ws/v2/reader/persistent/my-property/my-ns/my-topic1718checkArgument(parts.size() >= 8, "Invalid topic name format");
19checkArgument(parts.get(1).equals("ws"));
2021finalbooleanisV2Format = parts.get(2).equals("v2");
22finalintdomainIndex = isV2Format ? 4 : 3;
23checkArgument(parts.get(domainIndex).equals("persistent") ||
24parts.get(domainIndex).equals("non-persistent"));
252627finalStringdomain = parts.get(domainIndex);
28finalNamespaceNamenamespace = isV2Format ? NamespaceName.get(parts.get(5), parts.get(6)) :
29NamespaceName.get( parts.get(4), parts.get(5), parts.get(6));
30finalStringname = parts.get(7);
3132returnTopicName.get(domain, namespace, name);
33
To Reproduce
As an breaking example, take the v2 web socket topic URL:
28finalNamespaceNamenamespace = NamespaceName.get("my-tenant", "my-ns") // this seems good
But then,
30finalStringname = parts.get(7);
translates to
30finalStringname = "some"; // THIS IS ONLY THE FIRST PART OF THE TOPIC
Expected behavior
The topic name should have been parsed as "some/topic/with/slashes".
The code assumes that the topic will not have any slashes in it. But this assumption is incorrect. The documentation explicitly states that "topic names are freeform". The Java code even tests for this case.
Screenshots
N/a
Desktop (please complete the following information):
N/a
Additional context
N/a
The text was updated successfully, but these errors were encountered:
Describe the bug
The code in the web socket interface does not parse topic names correctly. I will limit my example to a consumer but similar issues apply to readers and producers.
From the code (line numbers are for reference, they do not match the actual code)
To Reproduce
As an breaking example, take the v2 web socket topic URL:
In the code above, the following assignments would be made
which translates to
And then:
translates to:
But then,
translates to
Expected behavior
The topic name should have been parsed as
"some/topic/with/slashes"
.The code assumes that the topic will not have any slashes in it. But this assumption is incorrect. The documentation explicitly states that "topic names are freeform". The Java code even tests for this case.
Screenshots
N/a
Desktop (please complete the following information):
N/a
Additional context
N/a
The text was updated successfully, but these errors were encountered: