Program: 129929
Project: 129929
Buggy source:
/** 
 * DOC qzhang Comment method "getMetadataTables".
 * @param medataTables
 * @param rsTables
 * @throws SQLException
 */
private static void getMetadataTables(List<IMetadataTable> medataTables,ResultSet rsTables,boolean supportSchema,List<String> tablesToFilter,int... limit) throws SQLException {
  if (rsTables == null) {
    return;
  }
  int limitNum=-1;
  long index=0;
  if (limit != null && limit.length > 0) {
    limitNum=limit[0];
  }
  while (rsTables.next()) {
    boolean isSynonym=false;
    MetadataTable medataTable=new MetadataTable();
    medataTable.setId(medataTables.size() + 1 + "String_Node_Str");
    String tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (tableName == null) {
      tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,3);
    }
    if (tableName == null) {
      tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
      isSynonym=true;
    }
    if (tableName == null || tablesToFilter.contains(tableName)) {
      continue;
    }
    medataTable.setLabel(tableName);
    medataTable.setTableName(medataTable.getLabel());
    medataTable.setComment(ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null));
    String schema=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (schema == null) {
      schema=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,2);
    }
    if (supportSchema && schema != null) {
      tableSchemaMap.put(medataTable.getLabel(),schema);
    }
    String tableType=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (tableType == null) {
      tableType=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,4);
    }
    if ("String_Node_Str".equals(tableType)) {
      tableType=ETableTypes.TABLETYPE_TABLE.getName();
    }
    if ("String_Node_Str".equals(tableType)) {
      tableType=ETableTypes.TABLETYPE_VIEW.getName();
    }
    if (isSynonym) {
      tableType="String_Node_Str";
    }
    try {
      tableTypeMap.put(medataTable.getLabel(),tableType);
    }
 catch (    Exception e) {
      tableTypeMap.put(medataTable.getLabel(),"String_Node_Str");
    }
    medataTables.add(medataTable);
    index++;
    if (limitNum > 0 && index > limitNum) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "getMetadataTables".
 * @param medataTables
 * @param rsTables
 * @throws SQLException
 */
private static void getMetadataTables(List<IMetadataTable> medataTables,ResultSet rsTables,boolean supportSchema,List<String> tablesToFilter,int... limit) throws SQLException {
  if (rsTables == null) {
    return;
  }
  int limitNum=-1;
  long index=0;
  if (limit != null && limit.length > 0) {
    limitNum=limit[0];
  }
  while (rsTables.next()) {
    boolean isSynonym=false;
    MetadataTable medataTable=new MetadataTable();
    medataTable.setId(medataTables.size() + 1 + "String_Node_Str");
    String tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (tableName == null) {
      tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,3);
    }
    if (tableName == null) {
      tableName=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
      isSynonym=true;
    }
    if (tableName == null || tablesToFilter.contains(tableName) || tableName.startsWith("String_Node_Str")) {
      continue;
    }
    medataTable.setLabel(tableName);
    medataTable.setTableName(medataTable.getLabel());
    medataTable.setComment(ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null));
    String schema=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (schema == null) {
      schema=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,2);
    }
    if (supportSchema && schema != null) {
      tableSchemaMap.put(medataTable.getLabel(),schema);
    }
    String tableType=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,"String_Node_Str",null);
    if (tableType == null) {
      tableType=ExtractMetaDataUtils.getStringMetaDataInfo(rsTables,4);
    }
    if ("String_Node_Str".equals(tableType)) {
      tableType=ETableTypes.TABLETYPE_TABLE.getName();
    }
    if ("String_Node_Str".equals(tableType)) {
      tableType=ETableTypes.TABLETYPE_VIEW.getName();
    }
    if (isSynonym) {
      tableType="String_Node_Str";
    }
    try {
      tableTypeMap.put(medataTable.getLabel(),tableType);
    }
 catch (    Exception e) {
      tableTypeMap.put(medataTable.getLabel(),"String_Node_Str");
    }
    medataTables.add(medataTable);
    index++;
    if (limitNum > 0 && index > limitNum) {
      break;
    }
  }
}