Program: 126681
Project: 126681
Buggy source:
@Override public ResultSet getTables(String catalog,String schema,String tableNamePattern,String[] types) throws SQLException {
  if (hiveObject == null) {
    throw new SQLException("String_Node_Str");
  }
  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);
  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,tableNamePattern});
    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;
}

Fixed version (ground truth):
@Override public ResultSet getTables(String catalog,String schema,String tableNamePattern,String[] types) throws SQLException {
  if (hiveObject == null) {
    throw new SQLException("String_Node_Str");
  }
  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);
  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);
      }
    }
    String tempTableNamepattern=tableNamePattern;
    if (StringUtils.isEmpty(tempTableNamepattern)) {
      tempTableNamepattern="String_Node_Str";
    }
    Object tables=ReflectionUtils.invokeMethod(hiveObject,"String_Node_Str",new Object[]{hiveCat,tempTableNamepattern});
    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;
}