Program: 63891
Project: 63891
Buggy source:
private SaltConfig createSaltConfig(Stack stack,Cluster cluster,GatewayConfig primaryGatewayConfig,Iterable<GatewayConfig> gatewayConfigs) throws IOException, CloudbreakOrchestratorException {
  Map<String,SaltPillarProperties> servicePillar=new HashMap<>();
  saveDatalakeNameservers(stack,servicePillar);
  saveSharedRangerService(stack,servicePillar);
  if (cluster.isSecure() && kerberosDetailService.isAmbariManagedKerberosPackages(cluster.getKerberosConfig())) {
    Map<String,String> kerberosPillarConf=new HashMap<>();
    KerberosConfig kerberosConfig=cluster.getKerberosConfig();
    putIfNotNull(kerberosPillarConf,kerberosConfig.getMasterKey(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,kerberosConfig.getAdmin(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,kerberosConfig.getPassword(),"String_Node_Str");
    if (StringUtils.isEmpty(kerberosConfig.getDescriptor())) {
      putIfNotNull(kerberosPillarConf,kerberosConfig.getUrl(),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,kerberosConfig.getAdminUrl(),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,kerberosConfig.getRealm(),"String_Node_Str");
    }
 else {
      Map<String,Object> properties=kerberosDetailService.getKerberosEnvProperties(kerberosConfig);
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
    }
    putIfNotNull(kerberosPillarConf,cluster.getUserName(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,cluster.getPassword(),"String_Node_Str");
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",kerberosPillarConf)));
  }
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",stack.cloudPlatform())));
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",stack.getCluster().getName()))));
  saveGatewayPillar(primaryGatewayConfig,cluster,servicePillar);
  AmbariRepo ambariRepo=clusterComponentConfigProvider.getAmbariRepo(cluster.getId());
  if (ambariRepo != null) {
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",ambariRepo))));
  }
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",clusterComponentConfigProvider.getHDPRepo(cluster.getId()).isEnableGplRepo())))));
  decoratePillarWithAmbariDatabase(cluster,servicePillar);
  saveLdapPillar(cluster.getLdapConfig(),servicePillar);
  saveDockerPillar(cluster.getExecutorType(),servicePillar);
  saveHDPPillar(cluster.getId(),servicePillar);
  Map<String,Object> credentials=new HashMap<>();
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariUserName(stack.getCluster()));
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariPassword(stack.getCluster()));
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariSecurityMasterKey(cluster));
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",credentials)));
  if (smartSenseCredentialConfigService.areCredentialsSpecified()) {
    Map<String,Object> smartSenseCredentials=smartSenseCredentialConfigService.getCredentials();
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",smartSenseCredentials));
  }
  postgresConfigService.decorateServicePillarWithPostgresIfNeeded(servicePillar,stack,cluster);
  proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar,cluster);
  decoratePillarWithJdbcConnectors(cluster,servicePillar);
  return new SaltConfig(servicePillar,createGrainProperties(gatewayConfigs));
}

Fixed version (ground truth):
private SaltConfig createSaltConfig(Stack stack,Cluster cluster,GatewayConfig primaryGatewayConfig,Iterable<GatewayConfig> gatewayConfigs) throws IOException, CloudbreakOrchestratorException {
  Map<String,SaltPillarProperties> servicePillar=new HashMap<>();
  saveDatalakeNameservers(stack,servicePillar);
  saveSharedRangerService(stack,servicePillar);
  if (cluster.isSecure() && kerberosDetailService.isAmbariManagedKerberosPackages(cluster.getKerberosConfig())) {
    Map<String,String> kerberosPillarConf=new HashMap<>();
    KerberosConfig kerberosConfig=cluster.getKerberosConfig();
    putIfNotNull(kerberosPillarConf,kerberosConfig.getMasterKey(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,kerberosConfig.getAdmin(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,kerberosConfig.getPassword(),"String_Node_Str");
    if (StringUtils.isEmpty(kerberosConfig.getDescriptor())) {
      putIfNotNull(kerberosPillarConf,kerberosConfig.getUrl(),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,kerberosDetailService.resolveHostForKdcAdmin(kerberosConfig,kerberosConfig.getUrl()),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,kerberosConfig.getRealm(),"String_Node_Str");
    }
 else {
      Map<String,Object> properties=kerberosDetailService.getKerberosEnvProperties(kerberosConfig);
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
      putIfNotNull(kerberosPillarConf,properties.get("String_Node_Str"),"String_Node_Str");
    }
    putIfNotNull(kerberosPillarConf,cluster.getUserName(),"String_Node_Str");
    putIfNotNull(kerberosPillarConf,cluster.getPassword(),"String_Node_Str");
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",kerberosPillarConf)));
  }
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",stack.cloudPlatform())));
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",stack.getCluster().getName()))));
  saveGatewayPillar(primaryGatewayConfig,cluster,servicePillar);
  AmbariRepo ambariRepo=clusterComponentConfigProvider.getAmbariRepo(cluster.getId());
  if (ambariRepo != null) {
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",ambariRepo))));
  }
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",singletonMap("String_Node_Str",clusterComponentConfigProvider.getHDPRepo(cluster.getId()).isEnableGplRepo())))));
  decoratePillarWithAmbariDatabase(cluster,servicePillar);
  saveLdapPillar(cluster.getLdapConfig(),servicePillar);
  saveDockerPillar(cluster.getExecutorType(),servicePillar);
  saveHDPPillar(cluster.getId(),servicePillar);
  Map<String,Object> credentials=new HashMap<>();
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariUserName(stack.getCluster()));
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariPassword(stack.getCluster()));
  credentials.put("String_Node_Str",ambariSecurityConfigProvider.getAmbariSecurityMasterKey(cluster));
  servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",singletonMap("String_Node_Str",credentials)));
  if (smartSenseCredentialConfigService.areCredentialsSpecified()) {
    Map<String,Object> smartSenseCredentials=smartSenseCredentialConfigService.getCredentials();
    servicePillar.put("String_Node_Str",new SaltPillarProperties("String_Node_Str",smartSenseCredentials));
  }
  postgresConfigService.decorateServicePillarWithPostgresIfNeeded(servicePillar,stack,cluster);
  proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar,cluster);
  decoratePillarWithJdbcConnectors(cluster,servicePillar);
  return new SaltConfig(servicePillar,createGrainProperties(gatewayConfigs));
}