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 13:59:34 UTC

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

J.Andreina created KNOX-496:
-------------------------------

             Summary: 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


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)