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

commented Jun 27, 2017

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

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.

// 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))) {

This comment has been minimized.

Copy link
@afine

afine Jun 29, 2017

Contributor

why was this change necessary?

This comment has been minimized.

Copy link
@asdf2014

asdf2014 Jun 30, 2017

Author Member

@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.

@anmolnar anmolnar closed this Jan 30, 2019

@asdf2014 asdf2014 deleted the asdf2014:auth_cf branch Jan 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.