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

STORM-2568: Fix getTopicsString #2177

Merged
merged 1 commit into from
Jun 25, 2017
Merged

Conversation

haewanj
Copy link

@haewanj haewanj commented Jun 24, 2017

  • String.valueOf returns square bracket, because 'topics' is Collection
  • removed square bracket to use storm-kafka-monitor

@HeartSaVioR
Copy link
Contributor

+1
I checked the master branch and confirmed that branch is OK: master branch uses String.join()
So don't need to port forward to the master branch.

@HeartSaVioR
Copy link
Contributor

@haewanj
Sorry I revoked +1 because of missing license. Could you add Apache license header to the new file?
And please squash the commits into one after fixing. Thanks in advance!

- String.valueOf returns square bracket, because topics is Collection
- removed square bracket to use storm-kafka-monitor
@haewanj
Copy link
Author

haewanj commented Jun 24, 2017

@HeartSaVioR
I added license. and squashed the commits into one. Thanks for the advice!

@@ -56,6 +57,6 @@ public NamedSubscription(String ... topics) {

@Override
public String getTopicsString() {
return String.valueOf(topics);
return StringUtils.join(topics, ",");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to suggest that you use instead Guava's Joiner.on(",").join(topics); which will avoid adding a new dependency

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion.
As you know, To keep java 1.7+ build, 'String.join()' is not a solution like master branch. And 'storm-core' has dependency both commons-lang and guava. So I choose commons-lang but If to pass the test that travis MODUELS='!storm-core', storm-kafka-client needs the dependency even Guava too. That's why I added commons-lang to storm-kafka-client's pom file.
If avoid adding a new dependency in storm-kafka-client, we can code maybe like this
StringBuilder sb = new StringBuilder();
for(String topic: topics) {
sb.append(topic).append(",");
}
sb.deleteCharAt(sb.lastIndexOf(","));
return sb.toString();
Many of external/packages have commons-lang dependency so, I thought it was fine.

By the way It has not been passed the Integration-test on travis-ci, I have no idea. but in my local integration-test is fine. (ex: mvn -P integration-tests-only integration-test)

@hmcl
Copy link
Contributor

hmcl commented Jun 25, 2017

+1

Copy link
Member

@satishd satishd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@HeartSaVioR
Copy link
Contributor

+1
Thanks for the contribution.

@asfgit asfgit merged commit 9fa5311 into apache:1.x-branch Jun 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants