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-2825: 1. Remove unnecessary import; 2. contains instead of indexOf > -1 for more readable; 3. Standardize StringBuilder#append usage for CLIENT module #297

Closed
wants to merge 1 commit into from

Conversation

@asdf2014
Copy link
Member

@asdf2014 asdf2014 commented Jun 29, 2017

  • Remove unnecessary import;
  • contains instead of indexOf > -1 for more readable;
  • Standardize StringBuilder#append usage for CLIENT module
@asdf2014 asdf2014 changed the title ZOOKEEPER-2825: 1. Remove unnecessary import; 2. contains instead of indexOf > -1 for more readable; 3. Standardize StringBuilder#append usage for CLI module ZOOKEEPER-2825: 1. Remove unnecessary import; 2. contains instead of indexOf > -1 for more readable; 3. Standardize StringBuilder#append usage for CLIENT module Jun 29, 2017
@@ -590,14 +590,13 @@ public boolean clientTunneledAuthenticationInProgress() {
// authentication is either in progress, successful, or failed.

// 1. Authentication hasn't finished yet: we must wait for it to do so.
if ((isComplete() == false) &&
(isFailed() == false)) {
if ((!isComplete()) && (!isFailed())) {
return true;
}

// 2. SASL authentication has succeeded or failed..
if (isComplete() || isFailed()) {
Copy link
Contributor

@shralex shralex Jun 29, 2017

Choose a reason for hiding this comment

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

wouldn't this always be true because of the previous if condition ?

Loading

Copy link
Member Author

@asdf2014 asdf2014 Jun 29, 2017

Choose a reason for hiding this comment

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

Hi, @shralex. Yep, if we get the value of !isComplete() is true, then we already know the authentication has not yet been completed, so it should return true for the clientTunneledAuthenticationInProgress method directly.

Loading

Copy link
Member Author

@asdf2014 asdf2014 Jun 29, 2017

Choose a reason for hiding this comment

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

Maybe i understand what you mean, if not_complete && not_failed (Line: 593) is FALSE means complete || non_failed and complete || failed and non_complete || failed is TRUE, then the isComplete() || isFailed() (Line: 599) will always be TRUE.

Loading

@shralex
Copy link
Contributor

@shralex shralex commented Jun 29, 2017

LGTM

Loading

if (gotLastPacket == false) {
// ..but still in progress, because there is a final SASL
// message from server which must be received.
if (!gotLastPacket) {
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.

this appears to be a logic change. Was that intended?

Loading

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.

nvm, did not see the code above. lgtm

Loading

afine
afine approved these changes Jun 29, 2017
Copy link
Contributor

@afine afine left a comment

+1

Loading

@anmolnar
Copy link
Contributor

@anmolnar anmolnar commented Jan 30, 2019

@asdf2014 Changes in the patch look like still valuable. Would you mind rebasing it?

Loading

@asdf2014
Copy link
Member Author

@asdf2014 asdf2014 commented Jan 31, 2019

@anmolnar Sure, I will rebase this.

Loading

* `contains` instead of `indexOf > -1` for more readable

* Standardize `StringBuilder#append` usage for CLIENT module

* Remove unnecessary `!isFailed()` for `clientTunneledAuthenticationInProgress` method

* Remove unnecessary `isComplete() || isFailed()` for `clientTunneledAuthenticationInProgress` method
@asdf2014
Copy link
Member Author

@asdf2014 asdf2014 commented Jan 31, 2019

@anmolnar Done.

Loading

@asfgit asfgit closed this in cbc63db Jan 31, 2019
asfgit pushed a commit that referenced this issue Jan 31, 2019
…f `indexOf > -1` for more readable; 3. Standardize `StringBuilder#append` usage for CLIENT module

* Remove unnecessary import;
* `contains` instead of `indexOf > -1` for more readable;
* Standardize `StringBuilder#append` usage for CLIENT module

Author: asdf2014 <benedictjin2016@gmail.com>

Reviewers: afine@apache.org, andor@apache.org

Closes #297 from asdf2014/ZOOKEEPER-2825

(cherry picked from commit cbc63db)
Signed-off-by: Andor Molnar <andor@apache.org>
@anmolnar
Copy link
Contributor

@anmolnar anmolnar commented Jan 31, 2019

Merged to 3.5 and master branches. Thanks @asdf2014 !

Loading

@asdf2014
Copy link
Member Author

@asdf2014 asdf2014 commented Feb 1, 2019

@anmolnar You are welcome.

Loading

@asdf2014 asdf2014 deleted the ZOOKEEPER-2825 branch Feb 1, 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
4 participants