You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2015/02/11 17:43:12 UTC

[jira] [Commented] (KNOX-496) Remove redundant and unnecessary null check from KnoxLdapRealm and DeploymentFactory

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

ASF subversion and git services commented on KNOX-496:
------------------------------------------------------

Commit ba4c2010a5fa1785fc014362900744aa727a1489 in knox's branch refs/heads/master from [~kevin.minder]
[ https://git-wip-us.apache.org/repos/asf?p=knox.git;h=ba4c201 ]

KNOX-496: Remove redundant and unnecessary null check from KnoxLdapRealm and DeploymentFactory
Contributed by andreina


> Remove redundant and unnecessary null check from KnoxLdapRealm and DeploymentFactory
> ------------------------------------------------------------------------------------
>
>                 Key: KNOX-496
>                 URL: https://issues.apache.org/jira/browse/KNOX-496
>             Project: Apache Knox
>          Issue Type: Improvement
>            Reporter: J.Andreina
>         Attachments: KNOX-496.1.patch
>
>
> 1. Redundant consecutive  null check on searchResultEnum variable in KnoxLdapRealm.java can be avoided
> {noformat}
>  finally {
>       if (searchResultEnum != null) {
>         try {
>           if (searchResultEnum != null) {
>             searchResultEnum.close();
>           }
>         }
> {noformat}
> 2. In the below code from DeploymentFactory.java , if Map "services" is null then exception would be thrown while iterating over the map . Null check on "services" after that can be avoided.
> {noformat}
>     for( String role : services.keySet() ) {
>       for( ServiceDeploymentContributor contributor : services.get( role ) ) {
>         try {
>           if (services != null) {
>             injectServices(contributor);
>           }
> {noformat}
> 3. Redundant null check on gatewayServices variable from DeploymentFactory.java can be avoided. 
> {noformat}
>       .......
>        if (gatewayServices != null) {
>             injectServices(contributor);
>           }
>       
>        private static void injectServices(Object contributor) {
>          if (gatewayServices != null) {
>          Statement stmt = null;
>          ......
> {noformat}
>          



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)