Program: 127425
Project: 127425
Buggy source:
@Override public ResultSet getTables(String catalog,String schema,String tableNamePattern,String[] types) throws SQLException {
  if (StringUtils.isBlank(catalog)) {
    catalog=HIVE_SCHEMA_DEFAULT;
  }
  ClassLoader currCL=Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(classLoader);
  EmbeddedHiveResultSet tableResultSet=new EmbeddedHiveResultSet();
  tableResultSet.setMetadata(TABLE_META);
  List<String[]> list=new ArrayList<String[]>();
  tableResultSet.setData(list);
  if (hiveObject != null) {
    try {
      Class hiveClass=hiveObject.getClass();
      Method method=hiveClass.getDeclaredMethod("String_Node_Str");
      Object hiveConf=method.invoke(hiveObject);
      Class hiveConfClass=hiveConf.getClass();
      Class confVarClass=null;
      for (      Class curClass : hiveConfClass.getClasses()) {
        if (curClass.getSimpleName().equals("String_Node_Str")) {
          confVarClass=curClass;
          break;
        }
      }
      if (confVarClass != null) {
        Object confVar=null;
        for (        Object curConfVar : confVarClass.getEnumConstants()) {
          if (curConfVar.toString().equals("String_Node_Str")) {
            confVar=curConfVar;
            break;
          }
        }
        if (confVar != null) {
          Method setIntVarMethod=hiveConfClass.getDeclaredMethod("String_Node_Str",confVarClass,int.class);
          int timeout=15;
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
            IDesignerCoreService designerService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
            timeout=designerService.getDBConnectionTimeout();
          }
          setIntVarMethod.invoke(hiveConf,confVar,timeout);
        }
      }
      Object tables=ReflectionUtils.invokeMethod(hiveObject,"String_Node_Str",new Object[]{catalog});
      if (tables instanceof List) {
        List<String> tableList=(List<String>)tables;
        for (        String tableName : tableList) {
          String tableType=getTableType(catalog,tableName);
          if (tableType != null) {
            String[] array=new String[]{"String_Node_Str",catalog,tableName,tableType,"String_Node_Str"};
            list.add(array);
          }
        }
      }
    }
 catch (    Exception e) {
      throw new SQLException(e);
    }
 finally {
      Thread.currentThread().setContextClassLoader(currCL);
    }
  }
  return tableResultSet;
}

Fixed version (ground truth):
@Override public ResultSet getTables(String catalog,String schema,String tableNamePattern,String[] types) throws SQLException {
  String hiveCat=catalog;
  if (StringUtils.isBlank(hiveCat)) {
    hiveCat=HIVE_SCHEMA_DEFAULT;
  }
  String[] hiveTypes=types;
  if (hiveTypes == null) {
    hiveTypes=new String[0];
  }
  ClassLoader currCL=Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(classLoader);
  EmbeddedHiveResultSet tableResultSet=new EmbeddedHiveResultSet();
  tableResultSet.setMetadata(TABLE_META);
  List<String[]> list=new ArrayList<String[]>();
  tableResultSet.setData(list);
  if (hiveObject != null) {
    try {
      Class hiveClass=hiveObject.getClass();
      Method method=hiveClass.getDeclaredMethod("String_Node_Str");
      Object hiveConf=method.invoke(hiveObject);
      Class hiveConfClass=hiveConf.getClass();
      Class confVarClass=null;
      for (      Class curClass : hiveConfClass.getClasses()) {
        if (curClass.getSimpleName().equals("String_Node_Str")) {
          confVarClass=curClass;
          break;
        }
      }
      if (confVarClass != null) {
        Object confVar=null;
        for (        Object curConfVar : confVarClass.getEnumConstants()) {
          if (curConfVar.toString().equals("String_Node_Str")) {
            confVar=curConfVar;
            break;
          }
        }
        if (confVar != null) {
          Method setIntVarMethod=hiveConfClass.getDeclaredMethod("String_Node_Str",confVarClass,int.class);
          int timeout=15;
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
            IDesignerCoreService designerService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
            timeout=designerService.getDBConnectionTimeout();
          }
          setIntVarMethod.invoke(hiveConf,confVar,timeout);
        }
      }
      Object tables=ReflectionUtils.invokeMethod(hiveObject,"String_Node_Str",new Object[]{hiveCat});
      if (tables instanceof List) {
        List<String> tableList=(List<String>)tables;
        for (        String tableName : tableList) {
          String tableType=getTableType(hiveCat,tableName);
          if (tableType != null && ArrayUtils.contains(hiveTypes,tableType)) {
            String[] array=new String[]{"String_Node_Str",hiveCat,tableName,tableType,"String_Node_Str"};
            list.add(array);
          }
        }
      }
    }
 catch (    Exception e) {
      throw new SQLException(e);
    }
 finally {
      Thread.currentThread().setContextClassLoader(currCL);
    }
  }
  return tableResultSet;
}