Program: 125656
Project: 125656
Buggy source:
private ClassLoader getClassLoader(IMetadataConnection metadataConn){
  IHadoopDistributionService hadoopService=getHadoopDistributionService();
  if (hadoopService != null) {
    String distribution=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
    String version=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
    IHDistribution impalaDistribution=hadoopService.getImpalaDistributionManager().getDistribution(distribution,false);
    if (impalaDistribution != null) {
      String impalaIndex=EDatabaseTypeName.IMPALA.getProduct() + ClassLoaderFactory.KEY_SEPARATOR + impalaDistribution.getName();
      if (impalaDistribution.useCustom()) {
        String jarsStr=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
        String index="String_Node_Str" + ClassLoaderFactory.KEY_SEPARATOR + impalaIndex+ ClassLoaderFactory.KEY_SEPARATOR+ metadataConn.getId();
        DynamicClassLoader classLoader=ClassLoaderFactory.getCustomClassLoader(index,jarsStr);
        if (classLoader != null) {
          return classLoader;
        }
      }
 else {
        IHDistributionVersion impalaVersion=impalaDistribution.getHDVersion(version,false);
        if (impalaVersion != null) {
          DynamicClassLoader classLoader=ClassLoaderFactory.getClassLoader(impalaIndex + ClassLoaderFactory.KEY_SEPARATOR + impalaVersion.getVersion());
          if (classLoader == null) {
            classLoader=ClassLoaderFactory.getClassLoader(impalaVersion);
          }
          if (classLoader != null) {
            return classLoader;
          }
        }
      }
    }
  }
  return this.getClass().getClassLoader();
}

Fixed version (ground truth):
private ClassLoader getClassLoader(IMetadataConnection metadataConn){
  IHadoopDistributionService hadoopService=getHadoopDistributionService();
  if (hadoopService != null) {
    String distribution=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
    String version=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
    IHDistribution impalaDistribution=hadoopService.getImpalaDistributionManager().getDistribution(distribution,false);
    if (impalaDistribution != null) {
      String impalaIndex=EDatabaseTypeName.IMPALA.getProduct() + ClassLoaderFactory.KEY_SEPARATOR + impalaDistribution.getName();
      if (impalaDistribution.useCustom()) {
        String jarsStr=(String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
        String index="String_Node_Str" + ClassLoaderFactory.KEY_SEPARATOR + impalaIndex+ ClassLoaderFactory.KEY_SEPARATOR+ metadataConn.getId();
        DynamicClassLoader classLoader=ClassLoaderFactory.getCustomClassLoader(index,jarsStr);
        if (classLoader != null) {
          return classLoader;
        }
      }
 else {
        IHDistributionVersion impalaVersion=impalaDistribution.getHDVersion(version,false);
        if (impalaVersion != null) {
          boolean isKeb=Boolean.valueOf((String)metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
          DynamicClassLoader classLoader=ClassLoaderFactory.getClassLoader(impalaIndex + ClassLoaderFactory.KEY_SEPARATOR + impalaVersion.getVersion()+ (isKeb ? "String_Node_Str" : "String_Node_Str"));
          if (classLoader == null) {
            classLoader=ClassLoaderFactory.getClassLoader(impalaVersion);
          }
          if (classLoader != null) {
            return classLoader;
          }
        }
      }
    }
  }
  return this.getClass().getClassLoader();
}