Skip to content

Conversation

@nikhilbhide
Copy link
Contributor

No description provided.

@nikhilbhide nikhilbhide reopened this Aug 24, 2017

import org.apache.zookeeper.common.PathUtils;
import static org.apache.zookeeper.common.StringUtils.split;

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: Removed it. please review

import java.util.List;

import org.apache.zookeeper.common.PathUtils;
import static org.apache.zookeeper.common.StringUtils.split;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I could be wrong on this, but I think in general we prefer to import classes and not static methods directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Static import of individual member is allowed as it sometimes improves the readability
Please let me know your opinion on this and if required I will change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

This code is similar to existing one in master and branch-3.5. For consistency, we could use what kind of import it uses, imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eribeiro: I have kept the code same, in master and branch-3.5 static method member is imported i.e import static org.apache.zookeeper.common.StringUtils.split

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eribeiro: Can you please complete the review comments? Can you please approve the changes so that patch can be created.

* limitations under the License.
*/

package org.apache.zookeeper.common;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a space here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: added required space. please review

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi afine: Can you please complete the review comments? Can you please approve the changes so that patch can be created.

public void testStrings() {

String s1 = " a , b , ";
assertEquals("[a, b]", StringUtils.split(s1, ",").toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if it would be possible to compare lists themselves rather than comparing the output of toString?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: Conversion to string is required as output of StringUtils.split returns java.util.Collections$UnmodifiableRandomAccessList<[a, b]>

Copy link
Contributor

Choose a reason for hiding this comment

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

What is wrong with using

  String s1 = "   a  ,   b  , ";
  List<String> expected = Arrays.asList("a", "b");
  assertTrue(expected.equals(StringUtils.split(s1, ",")));

????

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works, and I can change the asserts. However, I have retrofitted the test from master and branch 3.5 so is it okay to change it in this particular branch? Please let me know.

Copy link
Contributor Author

@nikhilbhide nikhilbhide left a comment

Choose a reason for hiding this comment

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

I have made required changes. Please review

import java.util.List;

import org.apache.zookeeper.common.PathUtils;
import static org.apache.zookeeper.common.StringUtils.split;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Static import of individual member is allowed as it sometimes improves the readability
Please let me know your opinion on this and if required I will change it.


import org.apache.zookeeper.common.PathUtils;
import static org.apache.zookeeper.common.StringUtils.split;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: Removed it. please review

* limitations under the License.
*/

package org.apache.zookeeper.common;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: added required space. please review

public void testStrings() {

String s1 = " a , b , ";
assertEquals("[a, b]", StringUtils.split(s1, ",").toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

afine: Conversion to string is required as output of StringUtils.split returns java.util.Collections$UnmodifiableRandomAccessList<[a, b]>

Copy link
Contributor Author

@nikhilbhide nikhilbhide left a comment

Choose a reason for hiding this comment

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

Please review and revert

public void testStrings() {

String s1 = " a , b , ";
assertEquals("[a, b]", StringUtils.split(s1, ",").toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works, and I can change the asserts. However, I have retrofitted the test from master and branch 3.5 so is it okay to change it in this particular branch? Please let me know.

Copy link
Contributor Author

@nikhilbhide nikhilbhide left a comment

Choose a reason for hiding this comment

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

Please review

Copy link
Contributor Author

@nikhilbhide nikhilbhide left a comment

Choose a reason for hiding this comment

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

eribeiro & afine: Can you please complete the review comments? Can you please approve the changes so that patch can be created.

@nikhilbhide
Copy link
Contributor Author

Patch is ready to be applied

@nikhilbhide nikhilbhide reopened this Sep 11, 2017
@nikhilbhide
Copy link
Contributor Author

Patch is ready

@nikhilbhide nikhilbhide deleted the ZOOKEEPER-2814-Ignore-space-after-comma-in-connection-string branch September 11, 2017 10:21
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.

3 participants