Program: 75165
Project: 75165
Buggy source:
/** 
 * if the schema is not support, populate the table list
 */
protected void populateTableList(){
  if (rootNode != null) {
    removeTreeItem(rootNode);
  }
  ResultSet tablesRs=null;
  ArrayList procedureRs=null;
  String catalogName=metaDataProvider.getCatalog();
  tableList=new ArrayList();
  String namePattern=null;
  String[] tableType=null;
  cachedSearchTxt=searchTxt.getText();
  namePattern=SQLUtility.getTailoredSearchText(searchTxt.getText());
  String dbtype=getSelectedDbType();
  cachedDbType=dbtype;
  if (dbtype != null) {
    if (DbType.TABLE_STRING.equalsIgnoreCase(dbtype) || DbType.VIEW_STRING.equalsIgnoreCase(dbtype)) {
      tableType=new String[]{dbtype};
    }
  }
  if (metaDataProvider.isProcedureSupported())   procedureRs=metaDataProvider.getAllProcedure(catalogName,null,namePattern);
  if (!DbType.PROCEDURE_STRING.equalsIgnoreCase(dbtype))   tablesRs=metaDataProvider.getAlltables(catalogName,null,namePattern,tableType);
  if (tablesRs == null && procedureRs == null) {
    return;
  }
  try {
    Image image=tableImage;
    if (tablesRs != null) {
      int numberOfTable;
      Preferences preferences=JdbcPlugin.getDefault().getPluginPreferences();
      if (preferences.contains(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA)) {
        numberOfTable=preferences.getInt(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA);
      }
 else {
        numberOfTable=DateSetPreferencePage.DEFAULT_MAX_NUM_OF_TABLE_EACH_SCHEMA;
        preferences.setValue(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA,numberOfTable);
      }
      int count=0;
      while (tablesRs.next() && count < numberOfTable) {
        String tableName=tablesRs.getString("String_Node_Str");
        String type=tablesRs.getString("String_Node_Str");
        if (type.equalsIgnoreCase("String_Node_Str"))         continue;
        int dbType=DbObject.TABLE_TYPE;
        if (type.equalsIgnoreCase("String_Node_Str")) {
          image=tableImage;
          dbType=DbObject.TABLE_TYPE;
        }
 else         if (type.equalsIgnoreCase("String_Node_Str")) {
          image=viewImage;
          dbType=DbObject.VIEW_TYPE;
        }
        DbObject dbObject=new DbObject(getTableNameWithSchema(null,tableName),tableName,dbType,image);
        tableList.add(dbObject);
        count++;
      }
    }
    if (needToCreateProcedureNode(dbtype,procedureRs)) {
      String fullyQualifiedTableName="String_Node_Str";
      DbObject dbObject=new DbObject(fullyQualifiedTableName,"String_Node_Str",DbObject.PROCEDURE_TYPE,tableImage);
      tableList.add(dbObject);
    }
    TreeItem item[]=Utility.createTreeItems(rootNode,tableList,SWT.NONE,null);
    if (item != null && item.length > 0)     availableDbObjectsTree.showItem(item[0]);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * if the schema is not support, populate the table list
 */
protected void populateTableList(){
  if (rootNode != null) {
    removeTreeItem(rootNode);
  }
  ResultSet tablesRs=null;
  ArrayList procedureRs=null;
  String catalogName=metaDataProvider.getCatalog();
  tableList=new ArrayList();
  String namePattern=null;
  String[] tableType=null;
  cachedSearchTxt=searchTxt.getText();
  namePattern=SQLUtility.getTailoredSearchText(searchTxt.getText());
  String dbtype=getSelectedDbType();
  cachedDbType=dbtype;
  if (dbtype != null) {
    if (DbType.TABLE_STRING.equalsIgnoreCase(dbtype) || DbType.VIEW_STRING.equalsIgnoreCase(dbtype)) {
      tableType=new String[]{dbtype};
    }
  }
  if (metaDataProvider.isProcedureSupported())   procedureRs=metaDataProvider.getAllProcedure(catalogName,null,namePattern);
  if (!DbType.PROCEDURE_STRING.equalsIgnoreCase(dbtype))   tablesRs=metaDataProvider.getAlltables(catalogName,null,namePattern,tableType);
  if (tablesRs == null && procedureRs == null) {
    return;
  }
  try {
    Image image=tableImage;
    if (tablesRs != null) {
      int numberOfTable;
      Preferences preferences=JdbcPlugin.getDefault().getPluginPreferences();
      if (preferences.contains(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA)) {
        numberOfTable=preferences.getInt(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA);
      }
 else {
        numberOfTable=DateSetPreferencePage.DEFAULT_MAX_NUM_OF_TABLE_EACH_SCHEMA;
        preferences.setValue(DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA,numberOfTable);
      }
      int count=0;
      while (tablesRs.next() && count < numberOfTable) {
        String tableName=tablesRs.getString("String_Node_Str");
        String type=tablesRs.getString("String_Node_Str");
        if (type.equalsIgnoreCase("String_Node_Str"))         continue;
        int dbType=DbObject.TABLE_TYPE;
        if (type.equalsIgnoreCase("String_Node_Str")) {
          image=tableImage;
          dbType=DbObject.TABLE_TYPE;
        }
 else         if (type.equalsIgnoreCase("String_Node_Str")) {
          image=viewImage;
          dbType=DbObject.VIEW_TYPE;
        }
        DbObject dbObject=new DbObject(getTableNameWithSchema(null,tableName),tableName,dbType,image);
        tableList.add(dbObject);
        count++;
      }
    }
    if (needToCreateProcedureNode(dbtype,procedureRs)) {
      String fullyQualifiedTableName="String_Node_Str";
      DbObject dbObject=new DbObject(fullyQualifiedTableName,"String_Node_Str",DbObject.PROCEDURE_TYPE,tableImage);
      tableList.add(dbObject);
    }
    TreeItem item[]=Utility.createTreeItems(rootNode,tableList,SWT.NONE,null);
    if (item != null && item.length > 0)     availableDbObjectsTree.showItem(item[0]);
  }
 catch (  Exception e) {
    logger.log(Level.FINE,e.getMessage(),e);
  }
}