[
https://issues.apache.org/jira/browse/METRON-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16038938#comment-16038938
]
ASF GitHub Bot commented on METRON-976:
---------------------------------------
Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/600#discussion_r120369355
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/utils/KafkaUtils.java
---
@@ -68,12 +68,14 @@
return ret;
}
- public List<String> fromEndpoint(String url) throws URISyntaxException {
+ public List<String> fromEndpoint(String url){
List<String> ret = new ArrayList<>();
if(url != null) {
- URI uri = new URI(url);
- int port = uri.getPort();
- ret.add(uri.getHost() + ((port > 0)?(":" + port):""));
+ Iterable<String> splits = Splitter.on("//").split(url);
+ if(Iterables.size(splits) == 2) {
+ String hostPort = Iterables.getLast(splits);
+ ret.add(hostPort);
--- End diff --
The problem is that the URI based solution that was implemented in that
patch (I believe based on my suggestion, sigh) doesn't allow for protocols with
underscore characters. It's entirely independent of SASL_PLAINTEXT, other than
the fact that underscore is in it.
The intention was to exactly reverse the chunk you mention, because the
original didn't care about underscores.
On further inspection (which I'm glad you did!), these are not equivalent
before and after. Which begs the question of why things worked in testing.
I'll dig in a bit more to figure out what's going on under the hood here.
> KafkaUtils doesn't handle SASL_PLAINTEXT
> ----------------------------------------
>
> Key: METRON-976
> URL: https://issues.apache.org/jira/browse/METRON-976
> Project: Metron
> Issue Type: Bug
> Reporter: Justin Leet
> Assignee: Justin Leet
>
> Java's URI class throws an error because '_' isn't allowed to be in a URI.
> We'll need to move to a manually split approach.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)