Program: 129989
Project: 129989
Buggy source:
public static void removeTablesFromCurrentCatalogOrSchema(String dbsid,String schema,DatabaseConnection dbconn,Collection<? extends MetadataTable> tablesToDelete){
  boolean hasSchemaInCatalog=false;
  Catalog c=(Catalog)ConnectionHelper.getPackage(dbsid,dbconn,Catalog.class);
  Schema s=(Schema)ConnectionHelper.getPackage(schema,dbconn,Schema.class);
  List<Schema> subschemas=new ArrayList<Schema>();
  if (c != null) {
    subschemas=CatalogHelper.getSchemas(c);
    hasSchemaInCatalog=subschemas.size() > 0;
  }
  if (c != null && s == null && !hasSchemaInCatalog) {
    c.getOwnedElement().removeAll(tablesToDelete);
  }
 else   if (s != null && !hasSchemaInCatalog && c == null) {
    s.getOwnedElement().removeAll(tablesToDelete);
  }
 else   if (c != null && hasSchemaInCatalog) {
    subschemas=CatalogHelper.getSchemas(c);
    hasSchemaInCatalog=subschemas.size() > 0;
    if (subschemas.size() > 0) {
      for (      Schema current : subschemas) {
        if (current.getName().equals(schema)) {
          s=current;
          break;
        }
      }
      if (s == null || "String_Node_Str".equals(s)) {
        EList<ModelElement> ownedElement=c.getOwnedElement();
        if (ownedElement instanceof EObjectContainmentWithInverseEList) {
          EObjectContainmentWithInverseEList elist=(EObjectContainmentWithInverseEList)ownedElement;
          if (!elist.isEmpty() && elist.size() > 0) {
            for (int i=0; i < elist.size(); i++) {
              Object object=elist.get(i);
              if (object instanceof SchemaImpl) {
                SchemaImpl schemaImpl=(SchemaImpl)object;
                EList<ModelElement> ownedElement2=schemaImpl.getOwnedElement();
                ownedElement2.removeAll(tablesToDelete);
              }
            }
          }
        }
      }
 else {
        s.getOwnedElement().removeAll(tablesToDelete);
      }
    }
  }
 else {
  }
}

Fixed version (ground truth):
public static void removeTablesFromCurrentCatalogOrSchema(String dbsid,String schema,DatabaseConnection dbconn,Collection<? extends MetadataTable> tablesToDelete){
  boolean hasSchemaInCatalog=false;
  Catalog c=(Catalog)ConnectionHelper.getPackage(dbsid,dbconn,Catalog.class);
  Schema s=(Schema)ConnectionHelper.getPackage(schema,dbconn,Schema.class);
  List<Schema> subschemas=new ArrayList<Schema>();
  if (c != null) {
    subschemas=CatalogHelper.getSchemas(c);
    hasSchemaInCatalog=subschemas.size() > 0;
  }
  if (c != null && s == null && !hasSchemaInCatalog) {
    c.getOwnedElement().removeAll(tablesToDelete);
  }
 else   if (s != null && !hasSchemaInCatalog && c == null) {
    s.getOwnedElement().removeAll(tablesToDelete);
  }
 else   if (c != null && hasSchemaInCatalog) {
    subschemas=CatalogHelper.getSchemas(c);
    hasSchemaInCatalog=subschemas.size() > 0;
    if (subschemas.size() > 0) {
      for (      Schema current : subschemas) {
        if (current.getName().equals(schema)) {
          s=current;
          break;
        }
      }
      if (s == null || "String_Node_Str".equals(s)) {
        EList<ModelElement> ownedElement=c.getOwnedElement();
        if (ownedElement instanceof EObjectContainmentWithInverseEList) {
          EObjectContainmentWithInverseEList elist=(EObjectContainmentWithInverseEList)ownedElement;
          if (!elist.isEmpty() && elist.size() > 0) {
            for (int i=0; i < elist.size(); i++) {
              Object object=elist.get(i);
              if (object instanceof SchemaImpl) {
                SchemaImpl schemaImpl=(SchemaImpl)object;
                EList<ModelElement> ownedElement2=schemaImpl.getOwnedElement();
                ownedElement2.removeAll(tablesToDelete);
              }
            }
          }
        }
        ownedElement.removeAll(tablesToDelete);
      }
 else {
        s.getOwnedElement().removeAll(tablesToDelete);
      }
    }
  }
 else {
  }
}