You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "J.Andreina (JIRA)" <ji...@apache.org> on 2015/02/09 14:02:35 UTC

[jira] [Updated] (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:all-tabpanel ]

J.Andreina updated KNOX-496:
----------------------------
    Attachment: KNOX-496.1.patch

Attached a patch , removing all redundant and unnecessary null checks as per the description.

Please review the patch.

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