Program: 78528
Project: 78528
Buggy source:
/** 
 * populate shema list if the schema is supported
 */
protected void populateSchemaList(){
  if (rootNode != null) {
    rootNode.removeAll();
  }
  getAvailableSchema();
  if (schemaCombo.getItemCount() < 1) {
    schemaCombo.add(JdbcPlugin.getResourceString("String_Node_Str"));
    schemaCombo.select(0);
    if (schemaList != null) {
      Iterator it=schemaList.iterator();
      while (it.hasNext())       schemaCombo.add(it.next().toString());
    }
  }
  ArrayList targetSchemaList=new ArrayList();
  ArrayList schemaObjectList=new ArrayList();
  if (schemaList != null) {
    int numberOfSchema=0;
    Preferences preferences=ReportPlugin.getDefault().getPluginPreferences();
    if (preferences.contains(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA)) {
      numberOfSchema=preferences.getInt(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA);
    }
 else {
      numberOfSchema=DateSetPreferencePage.DEFAULT_MAX_NUM_OF_SCHEMA;
      preferences.setValue(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA,numberOfSchema);
    }
    cachedSchemaComboIndex=schemaCombo.getSelectionIndex();
    if (schemaCombo.getSelectionIndex() == 0) {
      targetSchemaList=schemaList;
    }
 else {
      targetSchemaList.add(schemaCombo.getItem(schemaCombo.getSelectionIndex()));
      numberOfSchema=1;
    }
    for (int i=0; i < targetSchemaList.size() && i < numberOfSchema; i++) {
      String schemaName=(String)targetSchemaList.get(i);
      DbObject schemaObj=new DbObject(schemaName,schemaName,DbObject.SCHEMA_TYPE,schemaImage);
      schemaObjectList.add(schemaObj);
    }
    TreeItem[] items=Utility.createTreeItems(rootNode,schemaObjectList,SWT.NONE,schemaImage);
    if (items != null && items.length > 0) {
      availableDbObjectsTree.showItem(items[0]);
    }
  }
}

Fixed version (ground truth):
/** 
 * populate shema list if the schema is supported
 */
protected void populateSchemaList(){
  if (rootNode != null) {
    removeTreeItem(rootNode);
  }
  getAvailableSchema();
  if (schemaCombo.getItemCount() < 1) {
    schemaCombo.add(JdbcPlugin.getResourceString("String_Node_Str"));
    schemaCombo.select(0);
    if (schemaList != null) {
      Iterator it=schemaList.iterator();
      while (it.hasNext())       schemaCombo.add(it.next().toString());
    }
  }
  ArrayList targetSchemaList=new ArrayList();
  ArrayList schemaObjectList=new ArrayList();
  if (schemaList != null) {
    int numberOfSchema=0;
    Preferences preferences=ReportPlugin.getDefault().getPluginPreferences();
    if (preferences.contains(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA)) {
      numberOfSchema=preferences.getInt(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA);
    }
 else {
      numberOfSchema=DateSetPreferencePage.DEFAULT_MAX_NUM_OF_SCHEMA;
      preferences.setValue(DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA,numberOfSchema);
    }
    cachedSchemaComboIndex=schemaCombo.getSelectionIndex();
    if (schemaCombo.getSelectionIndex() == 0) {
      targetSchemaList=schemaList;
    }
 else {
      targetSchemaList.add(schemaCombo.getItem(schemaCombo.getSelectionIndex()));
      numberOfSchema=1;
    }
    for (int i=0; i < targetSchemaList.size() && i < numberOfSchema; i++) {
      String schemaName=(String)targetSchemaList.get(i);
      DbObject schemaObj=new DbObject(schemaName,schemaName,DbObject.SCHEMA_TYPE,schemaImage);
      schemaObjectList.add(schemaObj);
    }
    TreeItem[] items=Utility.createTreeItems(rootNode,schemaObjectList,SWT.NONE,schemaImage);
    if (items != null && items.length > 0) {
      availableDbObjectsTree.showItem(items[0]);
    }
  }
}