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

ZOOKEEPER-2821: 1. Fix spell issues; 2. Remove unnecessary boxing / unboxing; 3. Simplify return clause; 4. Remove final qualifier from private method #293

Closed
wants to merge 1 commit into from

Conversation

@asdf2014
Copy link
Member

@asdf2014 asdf2014 commented Jun 27, 2017

  • Fix spell issues
  • Remove unnecessary boxing / unboxing
  • Simplify return clause
  • Remove final qualifier from private method
…lify `return` clause; 4. Remove `final` qualifier from `private` method
Copy link
Contributor

@afine afine left a comment

@asdf2014 I think we already have a pretty thorough outstanding PR for spelling errors here. #275 Perhaps it would be cleaner if you contribute additional spelling errors that you have found there instead of spreading them out over multiple pull requests.

Loading

// Should never call this: SASL authentication is negotiated at session initiation.
// TODO: consider substituting current implementation of direct ClientCnxn manipulation with
// a call to this method (SASLAuthenticationProvider:handleAuthentication()) at session initiation.
return KeeperException.Code.AUTHFAILED;

}

public boolean matches(String id,String aclExpr) {
if ((id.equals("super") || id.equals(aclExpr))) {
Copy link
Contributor

@afine afine Jun 29, 2017

Choose a reason for hiding this comment

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

why was this change necessary?

Loading

Copy link
Member Author

@asdf2014 asdf2014 Jun 30, 2017

Choose a reason for hiding this comment

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

@afine Thank you for code review. Due to...

@Test
public void equalsNullPointException() throws Exception {
    String normal = "yuzhouwan.com", unmoral = null;
    try {
        if (normal.equals("yuzhouwan.com") && unmoral.equals("")) {     // bad habit
        }
    } catch (Exception e) {
        System.out.println("Will throw NullPointException!");
        assertEquals(true, e instanceof NullPointerException);
    }
    boolean equals = false;
    if ("yuzhouwan.com".equals(normal) || "".equals(unmoral)) {         // good habit
        equals = true;
    }
    assertEquals(true, equals);
}

Full code is here.

Loading

@anmolnar anmolnar closed this Jan 30, 2019
@asdf2014 asdf2014 deleted the auth_cf branch Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants