You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by asdf2014 <gi...@git.apache.org> on 2017/06/27 05:26:49 UTC

[GitHub] zookeeper pull request #293: ZOOKEEPER-2821: 1. Fix spell issues; 2. Remove ...

GitHub user asdf2014 opened a pull request:

    https://github.com/apache/zookeeper/pull/293

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

    * Fix spell issues
    * Remove unnecessary boxing / unboxing
    * Simplify `return` clause
    * Remove `final` qualifier from `private` method

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/asdf2014/zookeeper auth_cf

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/293.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #293
    
----
commit 1055374ba871ca2c78cea6ca1fbd57cc28305f8c
Author: asdf2014 <15...@qq.com>
Date:   2017-06-27T05:20:53Z

    1. Fix spell issues; 2. Remove unnecessary boxing / unboxing; 3. Simplify `return` clause; 4. Remove `final` qualifier from `private` method

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] zookeeper pull request #293: ZOOKEEPER-2821: 1. Fix spell issues; 2. Remove ...

Posted by afine <gi...@git.apache.org>.
Github user afine commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/293#discussion_r124902518
  
    --- Diff: src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java ---
    @@ -28,24 +28,20 @@ public String getScheme() {
         }
     
         public KeeperException.Code
    -        handleAuthentication(ServerCnxn cnxn, byte[] authData)
    -    {
    +        handleAuthentication(ServerCnxn cnxn, byte[] authData) {
             // 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))) {
    --- End diff --
    
    why was this change necessary?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] zookeeper pull request #293: ZOOKEEPER-2821: 1. Fix spell issues; 2. Remove ...

Posted by asdf2014 <gi...@git.apache.org>.
Github user asdf2014 commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/293#discussion_r124947780
  
    --- Diff: src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java ---
    @@ -28,24 +28,20 @@ public String getScheme() {
         }
     
         public KeeperException.Code
    -        handleAuthentication(ServerCnxn cnxn, byte[] authData)
    -    {
    +        handleAuthentication(ServerCnxn cnxn, byte[] authData) {
             // 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))) {
    --- End diff --
    
    Due to...
    ```java
    @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](https://github.com/asdf2014/yuzhouwan/blob/master/yuzhouwan-hacker/src/test/java/com/yuzhouwan/hacker/effective/StringStuffTest.java).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---