zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2821) 1. Fix spell issues; 2. Remove unnecessary boxing / unboxing; 3. Simplify `return` clause; 4. Remove `final` qualifier from `private` method
Date Fri, 30 Jun 2017 01:26:00 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16069302#comment-16069302
] 

ASF GitHub Bot commented on ZOOKEEPER-2821:
-------------------------------------------

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


> 1. Fix spell issues; 2. Remove unnecessary boxing / unboxing; 3. Simplify `return` clause;
4. Remove `final` qualifier from `private` method
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2821
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2821
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: security
>    Affects Versions: 3.5.3
>            Reporter: Benedict Jin
>            Assignee: Benedict Jin
>            Priority: Minor
>              Labels: refactoring
>             Fix For: 3.5.4, 3.6.0
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> * Fix spell issues
> * Remove unnecessary boxing / unboxing
> * Simplify `return` clause
> * Remove `final` qualifier from `private` method



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message