nus-yam/ex-repair huggingface dataset:
Program: 17763
Project: 17763
Buggy source:
public Branch visitChild(Stack stack){
  Branch lhsBranch=((CascadingRelNode)left).visitChild(stack);
  Branch rhsBranch=((CascadingRelNode)right).visitChild(stack);
  Pipe leftPipe=new Pipe("String_Node_Str",lhsBranch.current);
  leftPipe=stack.addDebug(this,leftPipe,"String_Node_Str");
  Pipe rightPipe=new Pipe("String_Node_Str",rhsBranch.current);
  rightPipe=stack.addDebug(this,rightPipe,"String_Node_Str");
  Fields lhsGroup=createTypedFieldsFor(getCluster(),leftKeys,left.getRowType());
  Fields rhsGroup=createTypedFieldsFor(getCluster(),rightKeys,right.getRowType());
  Joiner joiner=getJoiner();
  Fields declaredFields=RelUtil.createTypedFieldsFor(this);
  String name=stack.getNameFor(CoGroup.class,leftPipe,rightPipe);
  Pipe coGroup=new CoGroup(name,leftPipe,lhsGroup,rightPipe,rhsGroup,declaredFields,joiner);
  coGroup=stack.addDebug(this,coGroup);
  return new Branch(coGroup,lhsBranch,rhsBranch);
}

Fixed version (ground truth):
public Branch visitChild(Stack stack){
  Branch lhsBranch=((CascadingRelNode)left).visitChild(stack);
  Branch rhsBranch=((CascadingRelNode)right).visitChild(stack);
  Pipe leftPipe=new Pipe("String_Node_Str",lhsBranch.current);
  leftPipe=stack.addDebug(this,leftPipe,"String_Node_Str");
  Pipe rightPipe=new Pipe("String_Node_Str",rhsBranch.current);
  rightPipe=stack.addDebug(this,rightPipe,"String_Node_Str");
  Fields lhsGroup=createTypedFieldsFor(getCluster(),leftKeys,left.getRowType(),false);
  Fields rhsGroup=createTypedFieldsFor(getCluster(),rightKeys,right.getRowType(),false);
  Joiner joiner=getJoiner();
  Fields declaredFields=RelUtil.createTypedFieldsFor(this);
  String name=stack.getNameFor(CoGroup.class,leftPipe,rightPipe);
  Pipe coGroup=new CoGroup(name,leftPipe,lhsGroup,rightPipe,rhsGroup,declaredFields,joiner);
  coGroup=stack.addDebug(this,coGroup);
  return new Branch(coGroup,lhsBranch,rhsBranch);
}
Program: 17764
Project: 17764
Buggy source:
public static Fields createTypedFieldsFor(RelOptCluster cluster,RelDataTypeField typeField){
  String name=typeField.getName();
  Class type=getJavaType(cluster,typeField.getType());
  return new Fields(name,type);
}

Fixed version (ground truth):
public static Fields createTypedFieldsFor(RelOptCluster cluster,RelDataTypeField typeField,boolean numeric){
  Class type=getJavaType(cluster,typeField.getType());
  if (numeric)   return new Fields(typeField.getIndex(),type);
 else   return new Fields(typeField.getName(),type);
}
Program: 17765
Project: 17765
Buggy source:
public Branch visitChild(Stack stack){
  RexProgram program=CalcProjectUtil.createRexProgram(this);
  return CalcProjectUtil.resolveBranch(stack,this,program);
}

Fixed version (ground truth):
public Branch visitChild(Stack stack){
  RexProgram program=RexProgram.create(getChild().getRowType(),exps,null,getRowType(),getCluster().getRexBuilder());
  return CalcProjectUtil.resolveBranch(stack,this,program);
}
Program: 17766
Project: 17766
Buggy source:
@Override public Connection connect(String url,Properties info) throws SQLException {
  if (!acceptsURL(url)) {
    LOG.error("String_Node_Str",url);
    return null;
  }
  Connection connection=super.connect(url,info);
  if (connection == null) {
    LOG.error("String_Node_Str",url,info);
    return null;
  }
  Properties connectionProperties=parseConnectionProperties(url,info);
  if (connectionProperties.contains(VERBOSE_PROP))   Logging.setLogLevel(connectionProperties.getProperty(VERBOSE_PROP,"String_Node_Str"));
  return factory.createConnection(connection,connectionProperties);
}

Fixed version (ground truth):
@Override public Connection connect(String url,Properties info) throws SQLException {
  if (!acceptsURL(url)) {
    LOG.debug("String_Node_Str",url);
    return null;
  }
  Connection connection=super.connect(url,info);
  if (connection == null) {
    LOG.error("String_Node_Str",url,info);
    return null;
  }
  Properties connectionProperties=parseConnectionProperties(url,info);
  if (connectionProperties.contains(VERBOSE_PROP))   Logging.setLogLevel(connectionProperties.getProperty(VERBOSE_PROP,"String_Node_Str"));
  return factory.createConnection(connection,connectionProperties);
}
Program: 17767
Project: 17767
Buggy source:
private String findUserName(){
  String envUser=System.getenv(HADOOP_USER_ENV);
  String propertyUser=System.getProperty(HADOOP_USER_PROPERTY,envUser);
  String user=getProperties().getProperty("String_Node_Str",propertyUser);
  if (user == null || user.isEmpty()) {
    LOG.info("String_Node_Str");
    user=System.getProperty("String_Node_Str","String_Node_Str");
  }
  return user;
}

Fixed version (ground truth):
private String findUserName(){
  String envUser=System.getenv(HADOOP_USER_ENV);
  String propertyUser=System.getProperty(HADOOP_USER_PROPERTY,envUser);
  String user=getProperties().getProperty("String_Node_Str");
  if (Strings.isNullOrEmpty(user))   user=propertyUser;
  if (Strings.isNullOrEmpty(user)) {
    LOG.info("String_Node_Str");
    user=System.getProperty("String_Node_Str","String_Node_Str");
  }
  return user;
}
Program: 17768
Project: 17768
Buggy source:
protected List<ProviderDefinition> getDefaultProviderProperties(){
  List<ProviderDefinition> properties=new ArrayList<ProviderDefinition>();
  try {
    Enumeration<URL> resources=Thread.currentThread().getContextClassLoader().getResources(ProviderDefinition.CASCADING_BIND_PROVIDER_PROPERTIES);
    while (resources.hasMoreElements()) {
      URL url=resources.nextElement();
      LOG.debug("String_Node_Str",url);
      Properties definitions=new Properties();
      InputStream inputStream=url.openStream();
      definitions.load(inputStream);
      inputStream.close();
      Collections.addAll(properties,getProviderDefinitions(definitions));
    }
  }
 catch (  IOException exception) {
    throw new RuntimeException("String_Node_Str",exception);
  }
  return properties;
}

Fixed version (ground truth):
protected Collection<ProviderDefinition> getDefaultProviderProperties(){
  Map<String,ProviderDefinition> results=new LinkedHashMap<String,ProviderDefinition>();
  try {
    Enumeration<URL> resources=this.getClass().getClassLoader().getResources(ProviderDefinition.CASCADING_BIND_PROVIDER_PROPERTIES);
    while (resources.hasMoreElements()) {
      URL url=resources.nextElement();
      LOG.debug("String_Node_Str",url);
      InputStream inputStream=url.openStream();
      Properties definitions=new Properties();
      definitions.load(inputStream);
      inputStream.close();
      ProviderDefinition[] providerDefinitions=getProviderDefinitions(definitions);
      for (      ProviderDefinition providerDefinition : providerDefinitions) {
        String providerName=providerDefinition.getProviderName();
        if (results.containsKey(providerName)) {
          LOG.debug("String_Node_Str" + providerName + "String_Node_Str"+ url);
          continue;
        }
        LOG.debug("String_Node_Str" + providerName + "String_Node_Str"+ url);
        results.put(providerName,providerDefinition);
      }
    }
  }
 catch (  IOException exception) {
    throw new RuntimeException("String_Node_Str",exception);
  }
  return results.values();
}
Program: 17769
Project: 17769
Buggy source:
private void registerDefaultProviders(){
  for (  ProviderDefinition providerDefinition : getDefaultProviderProperties()) {
    if (!providerDefinition.getPlatforms().contains(platformBroker.getName()))     continue;
    Map<String,String> properties=providerDefinition.getProperties();
    rootSchemaDef.addProviderDef(providerDefinition.getProviderName(),null,properties,null);
  }
}

Fixed version (ground truth):
private void registerDefaultProviders(){
  for (  ProviderDefinition providerDefinition : getDefaultProviderProperties()) {
    if (!providerDefinition.getPlatforms().contains(platformBroker.getName()))     continue;
    String providerName=providerDefinition.getProviderName();
    LOG.debug("String_Node_Str" + providerName);
    Map<String,String> properties=providerDefinition.getProperties();
    rootSchemaDef.addProviderDef(providerName,null,properties,null);
  }
}
Program: 17770
Project: 17770
Buggy source:
public String getProviderName(){
  return name;
}

Fixed version (ground truth):
public String getProviderName(){
  return providerName;
}
Program: 17771
Project: 17771
Buggy source:
public ProviderDefinition(String name,Map<String,String> properties){
  this.name=name;
  this.properties=new HashMap<String,String>(properties);
}

Fixed version (ground truth):
public ProviderDefinition(String providerName,Map<String,String> properties){
  this.providerName=providerName;
  this.properties=new HashMap<String,String>(properties);
}
Program: 17772
Project: 17772
Buggy source:
private String property(String property){
  return String.format(property,name);
}

Fixed version (ground truth):
private String property(String property){
  return String.format(property,providerName);
}
Program: 17773
Project: 17773
Buggy source:
public synchronized SchemaCatalog getCatalog(){
  if (catalog == null)   catalog=loadCatalog();
  return catalog;
}

Fixed version (ground truth):
public synchronized SchemaCatalog getCatalog(){
  if (catalog != null)   return catalog;
  catalog=loadCatalog();
  return catalog;
}
Program: 17774
Project: 17774
Buggy source:
private synchronized SchemaCatalog loadCatalog(){
  catalog=getCatalogManager().readCatalog();
  if (catalog == null)   catalog=newCatalogInstance();
  if (getProperties().containsKey(SCHEMAS_PROP))   loadSchemas(catalog);
  if (getProperties().containsKey(TABLES_PROP))   loadTables(catalog);
  return catalog;
}

Fixed version (ground truth):
protected SchemaCatalog loadCatalog(){
  SchemaCatalog catalog=getCatalogManager().readCatalog();
  if (catalog == null)   catalog=newCatalogInstance();
  if (getProperties().containsKey(SCHEMAS_PROP))   loadSchemas(catalog);
  if (getProperties().containsKey(TABLES_PROP))   loadTables(catalog);
  return catalog;
}
Program: 17775
Project: 17775
Buggy source:
private Stereotype<Protocol,Format> findOrCreateStereotype(SchemaDef schema,Fields fields,String identifier){
  Stereotype<Protocol,Format> stereotype=findStereotypeFor(identifier);
  if (stereotype != null)   return stereotype;
  if (fields == null)   fields=getFieldsFor(identifier);
  if (fields == null)   return schema.findStereotypeFor(Fields.UNKNOWN);
  String stereotypeName=platformBroker.createTableNameFrom(identifier);
  stereotype=schema.findStereotypeFor(fields);
  if (stereotype == null)   stereotype=createStereotype(schema,stereotypeName,fields);
  return stereotype;
}

Fixed version (ground truth):
private Stereotype<Protocol,Format> findOrCreateStereotype(SchemaDef schema,Fields fields,String identifier){
  Stereotype<Protocol,Format> stereotype=findStereotypeFor(identifier);
  if (stereotype != null)   return stereotype;
  if (fields == null)   fields=getFieldsFor(schema,identifier);
  if (fields == null)   return schema.findStereotypeFor(Fields.UNKNOWN);
  String stereotypeName=platformBroker.createTableNameFrom(identifier);
  stereotype=schema.findStereotypeFor(fields);
  if (stereotype == null)   stereotype=createStereotype(schema,stereotypeName,fields);
  return stereotype;
}
Program: 17776
Project: 17776
Buggy source:
public Protocol getDefaultProtocolFor(SchemaDef schemaDef,String identifier){
  TableDef table=rootSchemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getActualProtocol();
  Protocol protocol=ProtocolProperties.findProtocolFor(schemaDef,identifier);
  if (protocol == null && schemaDef != null)   protocol=schemaDef.findDefaultProtocol();
  return protocol;
}

Fixed version (ground truth):
public Protocol getDefaultProtocolFor(SchemaDef schemaDef,String identifier){
  TableDef table=schemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getActualProtocol();
  Protocol protocol=ProtocolProperties.findProtocolFor(schemaDef,identifier);
  if (protocol == null && schemaDef != null)   protocol=schemaDef.findDefaultProtocol();
  return protocol;
}
Program: 17777
Project: 17777
Buggy source:
public Format getDefaultFormatFor(SchemaDef schemaDef,String identifier){
  TableDef tableDef=rootSchemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getActualFormat();
  Format format=FormatProperties.findFormatFor(schemaDef,identifier);
  if (format == null && schemaDef != null)   format=schemaDef.findDefaultFormat();
  return format;
}

Fixed version (ground truth):
public Format getDefaultFormatFor(SchemaDef schemaDef,String identifier){
  TableDef tableDef=schemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getActualFormat();
  Format format=FormatProperties.findFormatFor(schemaDef,identifier);
  if (format == null && schemaDef != null)   format=schemaDef.findDefaultFormat();
  return format;
}
Program: 17778
Project: 17778
Buggy source:
public Fields getFieldsFor(String identifier){
  String name=platformBroker.createTableNameFrom(identifier);
  if (nameFieldsMap.containsKey(name))   return nameFieldsMap.get(name);
  Point<Protocol,Format> point=getPointFor(identifier,null,null,null);
  Resource<Protocol,Format,SinkMode> resource=new Resource<Protocol,Format,SinkMode>(identifier,point.protocol,point.format,SinkMode.KEEP);
  Tap tap=createTapFor(rootSchemaDef,rootSchemaDef.findStereotypeFor(Fields.UNKNOWN),resource);
  if (!resourceExists(tap))   return null;
  Fields fields=tap.retrieveSourceFields(platformBroker.getFlowProcess());
  nameFieldsMap.put(name,fields);
  return fields;
}

Fixed version (ground truth):
public Fields getFieldsFor(SchemaDef schemaDef,String identifier){
  String name=platformBroker.createTableNameFrom(identifier);
  if (nameFieldsMap.containsKey(name))   return nameFieldsMap.get(name);
  Point<Protocol,Format> point=getPointFor(identifier,schemaDef.getName(),null,null);
  Resource<Protocol,Format,SinkMode> resource=new Resource<Protocol,Format,SinkMode>(identifier,point.protocol,point.format,SinkMode.KEEP);
  Tap tap=createTapFor(schemaDef,schemaDef.findStereotypeFor(Fields.UNKNOWN),resource);
  if (!resourceExists(tap))   return null;
  Fields fields=tap.retrieveSourceFields(platformBroker.getFlowProcess());
  nameFieldsMap.put(name,fields);
  return fields;
}
Program: 17779
Project: 17779
Buggy source:
public ProviderDef findProviderDefFor(Format format){
  List<String> providers=findFormatProperties(format).get(SchemaProperties.PROVIDER);
  for (  String providerName : providers) {
    ProviderDef providerDef=findProviderDefFor(providerName);
    if (providerDef != null)     return providerDef;
  }
  return null;
}

Fixed version (ground truth):
public ProviderDef findProviderDefFor(Format format){
  List<String> providers=findFormatProperties(format).get(SchemaProperties.PROVIDER);
  if (providers == null)   return null;
  for (  String providerName : providers) {
    ProviderDef providerDef=findProviderDefFor(providerName);
    if (providerDef != null)     return providerDef;
  }
  return null;
}
Program: 17780
Project: 17780
Buggy source:
@Test public void testProviderWithSQLLine() throws IOException {
  copyFromLocal(SIMPLE_PRODUCTS_TABLE);
  String classPath=compileFactory(getFactoryPath());
  createProviderJar(TEST_PROPERTIES_FACTORY_LOCATION,classPath);
  initCatalog();
  catalog("String_Node_Str","String_Node_Str",getProviderPath());
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  assertEquals("String_Node_Str",providerDef.getFactoryClassName());
  Protocol protocol=Protocol.getProtocol(getPlatformName().equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  schemaCatalog=getSchemaCatalog();
  providerDef=schemaCatalog.findProviderDefFor(null,protocol);
  assertNotNull("String_Node_Str",providerDef);
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}

Fixed version (ground truth):
@Test public void testProviderWithSQLLine() throws IOException {
  copyFromLocal(SIMPLE_PRODUCTS_TABLE);
  String classPath=compileFactory(getFactoryPath());
  createProviderJar(TEST_PROPERTIES_FACTORY_LOCATION,classPath);
  initCatalog();
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",getProviderPath());
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor("String_Node_Str",format);
  assertNotNull("String_Node_Str",providerDef);
  assertEquals("String_Node_Str",providerDef.getFactoryClassName());
  Protocol protocol=Protocol.getProtocol(getPlatformName().equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  schemaCatalog=getSchemaCatalog();
  providerDef=schemaCatalog.findProviderDefFor(null,protocol);
  assertNotNull("String_Node_Str",providerDef);
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}
Program: 17781
Project: 17781
Buggy source:
@Test public void testProviderPropertiesWithSQLLine() throws IOException {
  copyFromLocal(SIMPLE_PRODUCTS_TABLE);
  initCatalog();
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}

Fixed version (ground truth):
@Test public void testProviderPropertiesWithSQLLine() throws IOException {
  copyFromLocal(SIMPLE_PRODUCTS_TABLE);
  initCatalog();
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor("String_Node_Str",format);
  assertNotNull("String_Node_Str",providerDef);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}
Program: 17782
Project: 17782
Buggy source:
public Protocol getDefaultProtocolFor(String schemaName,String identifier){
  TableDef table=rootSchemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getActualProtocol();
  SchemaDef schemaDef=getSchemaDef(schemaName);
  Protocol protocol=ProtocolProperties.findProtocolFor(schemaDef,identifier);
  if (protocol == null && schemaDef != null)   protocol=schemaDef.findDefaultProtocol();
  return protocol;
}

Fixed version (ground truth):
public Protocol getDefaultProtocolFor(SchemaDef schemaDef,String identifier){
  TableDef table=rootSchemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getActualProtocol();
  Protocol protocol=ProtocolProperties.findProtocolFor(schemaDef,identifier);
  if (protocol == null && schemaDef != null)   protocol=schemaDef.findDefaultProtocol();
  return protocol;
}
Program: 17783
Project: 17783
Buggy source:
protected String createTableDefFor(SchemaDef schemaDef,String tableName,String tableIdentifier,String stereotypeName,Fields fields,Protocol protocol,Format format){
  tableIdentifier=getFullPath(tableIdentifier);
  LOG.debug("String_Node_Str",tableIdentifier);
  if (tableName == null)   tableName=platformBroker.createTableNameFrom(tableIdentifier);
  Stereotype<Protocol,Format> stereotype=null;
  if (stereotypeName != null)   stereotype=findStereotype(schemaDef,stereotypeName);
  if (stereotype == null)   stereotype=findOrCreateStereotype(schemaDef,fields,tableIdentifier);
  if (stereotype == null)   throw new IllegalArgumentException("String_Node_Str" + stereotypeName);
  schemaDef.addTable(tableName,tableIdentifier,stereotype,protocol,format);
  return tableName;
}

Fixed version (ground truth):
protected String createTableDefFor(SchemaDef schemaDef,String tableName,String tableIdentifier,String stereotypeName,Fields fields,Protocol protocol,Format format){
  tableIdentifier=getFullPath(tableIdentifier);
  LOG.debug("String_Node_Str",tableIdentifier);
  if (tableName == null)   tableName=platformBroker.createTableNameFrom(tableIdentifier);
  Stereotype<Protocol,Format> stereotype=null;
  if (stereotypeName != null)   stereotype=findStereotype(schemaDef,stereotypeName);
  if (stereotype == null)   stereotype=findOrCreateStereotype(schemaDef,fields,tableIdentifier);
  if (stereotype == null)   throw new IllegalArgumentException("String_Node_Str" + stereotypeName);
  if (protocol == null)   protocol=getDefaultProtocolFor(schemaDef,tableIdentifier);
  if (format == null)   format=getDefaultFormatFor(schemaDef,tableIdentifier);
  schemaDef.addTable(tableName,tableIdentifier,stereotype,protocol,format);
  return tableName;
}
Program: 17784
Project: 17784
Buggy source:
public Format getDefaultFormatFor(String schemaName,String identifier){
  TableDef tableDef=rootSchemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getActualFormat();
  SchemaDef schemaDef=getSchemaDef(schemaName);
  Format format=FormatProperties.findFormatFor(schemaDef,identifier);
  if (format == null && schemaDef != null)   format=schemaDef.findDefaultFormat();
  return format;
}

Fixed version (ground truth):
public Format getDefaultFormatFor(SchemaDef schemaDef,String identifier){
  TableDef tableDef=rootSchemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getActualFormat();
  Format format=FormatProperties.findFormatFor(schemaDef,identifier);
  if (format == null && schemaDef != null)   format=schemaDef.findDefaultFormat();
  return format;
}
Program: 17785
Project: 17785
Buggy source:
@Override public void onMatch(RelOptRuleCall call){
  final CascadingTableAccessRel tableRel=(CascadingTableAccessRel)call.getRels()[0];
  final TapEnumerableRel tapRel=new TapEnumerableRel(tableRel.getCluster(),tableRel.getTraitSet().plus(EnumerableConvention.ARRAY),tableRel.getTable(),tableRel.name,tableRel.identifier);
  call.transformTo(tapRel);
}

Fixed version (ground truth):
@Override public void onMatch(RelOptRuleCall call){
  final CascadingTableAccessRel tableRel=(CascadingTableAccessRel)call.getRels()[0];
  final EnumerableTapRel tapRel=new EnumerableTapRel(tableRel.getCluster(),tableRel.getTraitSet().plus(EnumerableConvention.ARRAY),tableRel.getTable());
  call.transformTo(tapRel);
}
Program: 17786
Project: 17786
Buggy source:
public Enumerator enumerator(){
  PlatformBroker platformBroker=getPlatformBroker();
  Properties properties=platformBroker.getProperties();
  Optiq.writeSQLPlan(properties,Misc.createUniqueName(),getVolcanoPlanner());
  FlowProcess flowProcess=platformBroker.getFlowProcess();
  SchemaCatalog schemaCatalog=platformBroker.getCatalog();
  Tap tap=schemaCatalog.createTapFor(getIdentifier(),SinkMode.KEEP);
  int size=tap.getSinkFields().size();
  Type[] types=new Type[size];
  for (int i=0; i < size; i++)   types[i]=getPhysType().fieldClass(i);
  int maxRows=getMaxRows(properties);
  if (size == 1)   return new TapObjectEnumerator(maxRows,types,flowProcess,tap);
 else   return new TapArrayEnumerator(maxRows,types,flowProcess,tap);
}

Fixed version (ground truth):
public Enumerator enumerator(){
  PlatformBroker platformBroker=getPlatformBroker();
  Properties properties=platformBroker.getProperties();
  Optiq.writeSQLPlan(properties,Misc.createUniqueName(),getVolcanoPlanner());
  FlowProcess flowProcess=platformBroker.getFlowProcess();
  SchemaCatalog schemaCatalog=platformBroker.getCatalog();
  Tap tap=schemaCatalog.createTapFor(getTableDef(),SinkMode.KEEP);
  int size=tap.getSinkFields().size();
  Type[] types=new Type[size];
  for (int i=0; i < size; i++)   types[i]=getPhysType().fieldClass(i);
  int maxRows=getMaxRows(properties);
  if (size == 1)   return new TapObjectEnumerator(maxRows,types,flowProcess,tap);
 else   return new TapArrayEnumerator(maxRows,types,flowProcess,tap);
}
Program: 17787
Project: 17787
Buggy source:
public TableHolder(PhysType physType,String identifier,PlatformBroker platformBroker,VolcanoPlanner planner){
  this.physType=physType;
  this.identifier=identifier;
  this.platformBroker=platformBroker;
  this.planner=planner;
}

Fixed version (ground truth):
public TableHolder(PhysType physType,TableDef tableDef,PlatformBroker platformBroker,VolcanoPlanner planner){
  this.physType=physType;
  this.tableDef=tableDef;
  this.platformBroker=platformBroker;
  this.planner=planner;
}
Program: 17788
Project: 17788
Buggy source:
@Ignore @Test public void testProviderPropertiesWithSQLLine() throws IOException {
  initCatalog();
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}

Fixed version (ground truth):
@Test public void testProviderPropertiesWithSQLLine() throws IOException {
  initCatalog();
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}
Program: 17789
Project: 17789
Buggy source:
@Ignore @Test public void testProviderWithSQLLine() throws IOException {
  createProviderJar();
  initCatalog();
  catalog("String_Node_Str","String_Node_Str",PROVIDER_JAR_PATH);
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  Protocol protocol=Protocol.getProtocol(getPlatformName().equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  schemaCatalog=getSchemaCatalog();
  providerDef=schemaCatalog.findProviderDefFor(null,protocol);
  assertNotNull("String_Node_Str",providerDef);
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  assertTrue("String_Node_Str",shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName()));
}

Fixed version (ground truth):
@Test public void testProviderWithSQLLine() throws IOException {
  createProviderJar();
  initCatalog();
  catalog("String_Node_Str","String_Node_Str",PROVIDER_JAR_PATH);
  SchemaCatalog schemaCatalog=getSchemaCatalog();
  Format format=Format.getFormat("String_Node_Str");
  ProviderDef providerDef=schemaCatalog.findProviderDefFor(null,format);
  assertNotNull("String_Node_Str",providerDef);
  Protocol protocol=Protocol.getProtocol(getPlatformName().equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  schemaCatalog=getSchemaCatalog();
  providerDef=schemaCatalog.findProviderDefFor(null,protocol);
  assertNotNull("String_Node_Str",providerDef);
  catalog("String_Node_Str","String_Node_Str","String_Node_Str");
  catalog("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",SIMPLE_PRODUCTS_TABLE);
  boolean result=shell("String_Node_Str",PROVIDER_SQL_SELECT_FILE,"String_Node_Str",getPlatformName());
  assertTrue("String_Node_Str",result);
}
Program: 17790
Project: 17790
Buggy source:
@Override public boolean handle(PlatformBroker platformBroker){
  SchemaCatalog catalog=platformBroker.getCatalog();
  String schemaName=getOptions().getSchemaName();
  String formatName=getOptions().getFormatName();
  String protocolName=getOptions().getProtocolName();
  verifySchema(catalog,schemaName);
  LOG.info("String_Node_Str",getOptions().getDDL());
  DDLParser parser=new DDLParser(catalog,schemaName,formatName,protocolName);
  try {
    List<DDLTable> commands=parser.parse(new File(getOptions().getDDL()));
    LOG.info("String_Node_Str",commands.size());
    parser.execute(commands);
  }
 catch (  IOException exception) {
    throw new IllegalArgumentException("String_Node_Str" + getOptions().getDDL(),exception);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean handle(PlatformBroker platformBroker){
  SchemaCatalog catalog=platformBroker.getCatalog();
  String schemaName=getOptions().getSchemaName();
  String protocolName=getOptions().getProtocolName();
  String formatName=getOptions().getFormatName();
  verifySchema(catalog,schemaName);
  LOG.info("String_Node_Str",getOptions().getDDL());
  DDLParser parser=new DDLParser(catalog,schemaName,protocolName,formatName);
  try {
    List<DDLTable> commands=parser.parse(new File(getOptions().getDDL()));
    LOG.info("String_Node_Str",commands.size());
    parser.execute(commands);
  }
 catch (  IOException exception) {
    throw new IllegalArgumentException("String_Node_Str" + getOptions().getDDL(),exception);
  }
  return true;
}
Program: 17791
Project: 17791
Buggy source:
@Override protected String performAdd(PlatformBroker platformBroker){
  String addURI=getOptions().getAddOrUpdateURI();
  SchemaCatalog catalog=platformBroker.getCatalog();
  String schemaName=getOptions().getSchemaName();
  if (addURI == null) {
    boolean success=catalog.addSchemaDef(schemaName);
    if (success)     return schemaName;
    return null;
  }
  return catalog.createSchemaDefAndTableDefsFor(schemaName,addURI);
}

Fixed version (ground truth):
@Override protected String performAdd(PlatformBroker platformBroker){
  String addURI=getOptions().getAddOrUpdateURI();
  SchemaCatalog catalog=platformBroker.getCatalog();
  String schemaName=getOptions().getSchemaName();
  String protocol=getOptions().getProtocolName();
  String format=getOptions().getFormatName();
  if (addURI == null) {
    boolean success=catalog.addSchemaDef(schemaName,protocol,format);
    if (success)     return schemaName;
    return null;
  }
  return catalog.createSchemaDefAndTableDefsFor(schemaName,protocol,format,addURI);
}
Program: 17792
Project: 17792
Buggy source:
@Override protected String performAdd(PlatformBroker platformBroker){
  SchemaCatalog catalog=platformBroker.getCatalog();
  String addURI=getOptions().getAddOrUpdateURI();
  if (addURI == null)   throw new IllegalArgumentException("String_Node_Str");
  String tableName=getOptions().getTableName();
  String stereotypeName=getOptions().getStereotypeName();
  Protocol protocol=Protocol.getProtocol(getOptions().getProtocolName());
  Format format=Format.getFormat(getOptions().getFormatName());
  return catalog.createTableDefFor(getOptions().getSchemaName(),tableName,addURI,stereotypeName,protocol,format);
}

Fixed version (ground truth):
@Override protected String performAdd(PlatformBroker platformBroker){
  SchemaCatalog catalog=platformBroker.getCatalog();
  String addURI=getOptions().getAddOrUpdateURI();
  if (addURI == null)   throw new IllegalArgumentException("String_Node_Str");
  String tableName=getOptions().getTableName();
  String stereotypeName=getOptions().getStereotypeName();
  Protocol protocol=Protocol.getProtocol(getOptions().getProtocolName());
  Format format=Format.getFormat(getOptions().getFormatName());
  String schemaName=getOptions().getSchemaName();
  return catalog.createTableDefFor(schemaName,tableName,addURI,stereotypeName,protocol,format);
}
Program: 17793
Project: 17793
Buggy source:
protected void verifySchema(SchemaCatalog catalog,String schemaName){
  if (schemaName == null)   throw new IllegalArgumentException("String_Node_Str");
  if (!catalog.getSchemaNames().contains(schemaName))   throw new IllegalArgumentException("String_Node_Str" + schemaName);
}

Fixed version (ground truth):
protected void verifySchema(SchemaCatalog catalog,String schemaName){
  if (schemaName == null)   throw new IllegalArgumentException("String_Node_Str");
  if (!catalog.getSchemaNames().contains(schemaName.toLowerCase()))   throw new IllegalArgumentException("String_Node_Str" + schemaName);
}
Program: 17794
Project: 17794
Buggy source:
public SchemaDef createSchemaDef(String name,String identifier){
  getRootSchemaDef().addSchema(name,identifier);
  return getRootSchemaDef().getSchema(name);
}

Fixed version (ground truth):
public SchemaDef createSchemaDef(String name,String protocolName,String formatName,String identifier){
  Protocol protocol=Protocol.getProtocol(protocolName);
  Format format=Format.getFormat(formatName);
  if (identifier == null)   identifier=name;
  getRootSchemaDef().addSchema(name,protocol,format,identifier);
  return getRootSchemaDef().getSchema(name);
}
Program: 17795
Project: 17795
Buggy source:
private Stereotype<Protocol,Format> createStereotype(SchemaDef schemaDef,Protocol defaultProtocol,String name,Fields fields){
  Stereotype<Protocol,Format> stereotype=new Stereotype<Protocol,Format>(getFormatHandlers(),defaultProtocol,name,fields);
  schemaDef.addStereotype(stereotype);
  return stereotype;
}

Fixed version (ground truth):
private Stereotype<Protocol,Format> createStereotype(SchemaDef schemaDef,String name,Fields fields,Protocol protocol){
  Protocol defaultProtocol=protocol == null ? schemaDef.findDefaultProtocol() : protocol;
  Stereotype<Protocol,Format> stereotype=new Stereotype<Protocol,Format>(getFormatHandlers(),defaultProtocol,name,fields);
  schemaDef.addStereotype(stereotype);
  return stereotype;
}
Program: 17796
Project: 17796
Buggy source:
private Stereotype<Protocol,Format> getOrCreateStereotype(SchemaDef schema,String identifier){
  Stereotype<Protocol,Format> stereotype=findStereotypeFor(identifier);
  if (stereotype != null)   return stereotype;
  Fields fields=getFieldsFor(identifier);
  if (fields == null)   return schema.findStereotypeFor(Fields.UNKNOWN);
  String schemaName=schema.getName();
  String stereotypeName=platformBroker.createTableNameFrom(identifier);
  stereotype=schema.findStereotypeFor(fields);
  if (stereotype == null) {
    Point<Protocol,Format> point=getPointFor(identifier,schemaName,null,null);
    return createStereotype(schema,point.protocol,stereotypeName,fields);
  }
  return stereotype;
}

Fixed version (ground truth):
private Stereotype<Protocol,Format> getOrCreateStereotype(SchemaDef schema,String identifier){
  Stereotype<Protocol,Format> stereotype=findStereotypeFor(identifier);
  if (stereotype != null)   return stereotype;
  Fields fields=getFieldsFor(identifier);
  if (fields == null)   return schema.findStereotypeFor(Fields.UNKNOWN);
  String schemaName=schema.getName();
  String stereotypeName=platformBroker.createTableNameFrom(identifier);
  stereotype=schema.findStereotypeFor(fields);
  if (stereotype == null) {
    Point<Protocol,Format> point=getPointFor(identifier,schemaName,null,null);
    return createStereotype(schema,stereotypeName,fields,point.protocol);
  }
  return stereotype;
}
Program: 17797
Project: 17797
Buggy source:
public boolean addSchemaDef(String name){
  if (getRootSchemaDef().getSchema(name) != null)   return false;
  getRootSchemaDef().getOrAddSchema(name);
  return true;
}

Fixed version (ground truth):
public boolean addSchemaDef(String name,String protocolName,String formatName){
  Protocol protocol=Protocol.getProtocol(protocolName);
  Format format=Format.getFormat(formatName);
  return getRootSchemaDef().addSchema(name,protocol,format);
}
Program: 17798
Project: 17798
Buggy source:
public Protocol getDefaultProtocolFor(String identifier){
  TableDef table=rootSchemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getProtocol();
  return defaultProtocol;
}

Fixed version (ground truth):
public Protocol getDefaultProtocolFor(String identifier){
  TableDef table=rootSchemaDef.findTableFor(identifier);
  if (table != null && table.getProtocol() != null)   return table.getProtocol();
  return rootSchemaDef.getDefaultProtocol();
}
Program: 17799
Project: 17799
Buggy source:
public Format getDefaultFormatFor(String schemaName,String identifier){
  TableDef tableDef=rootSchemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getFormat();
  SchemaDef schema=getSchemaDef(schemaName);
  Format format=FormatProperties.findFormatFor(schema,identifier);
  if (format == null)   format=defaultFormat;
  return format;
}

Fixed version (ground truth):
public Format getDefaultFormatFor(String schemaName,String identifier){
  TableDef tableDef=rootSchemaDef.findTableFor(identifier);
  if (tableDef != null && tableDef.getFormat() != null)   return tableDef.getFormat();
  SchemaDef schemaDef=getSchemaDef(schemaName);
  Format format=FormatProperties.findFormatFor(schemaDef,identifier);
  if (format == null && schemaDef != null)   format=schemaDef.findDefaultFormat();
  return format;
}
Program: 17800
Project: 17800
Buggy source:
protected SchemaCatalog(Protocol defaultProtocol,Format defaultFormat){
  this.defaultProtocol=defaultProtocol;
  this.defaultFormat=defaultFormat;
}

Fixed version (ground truth):
protected SchemaCatalog(Protocol defaultProtocol,Format defaultFormat){
  this.rootSchemaDef=new SchemaDef(defaultProtocol,defaultFormat);
}
Program: 17801
Project: 17801
Buggy source:
public void initializeNew(){
  if (!rootSchemaDef.hasStereotype("String_Node_Str"))   createStereotype(rootSchemaDef,defaultProtocol,"String_Node_Str",Fields.UNKNOWN);
  ProtocolHandlers<Protocol,Format> protocolHandlers=getProtocolHandlers();
  for (  Protocol protocol : protocolHandlers.getProtocols())   rootSchemaDef.addProtocolProperties(protocol,protocolHandlers.getProtocolProperties(protocol));
  FormatHandlers<Protocol,Format> formatHandlers=getFormatHandlers();
  for (  Format format : formatHandlers.getFormats())   rootSchemaDef.addFormatProperties(format,formatHandlers.getFormatProperties(format));
}

Fixed version (ground truth):
public void initializeNew(){
  if (!rootSchemaDef.hasStereotype("String_Node_Str"))   createStereotype(rootSchemaDef,"String_Node_Str",Fields.UNKNOWN,null);
  ProtocolHandlers<Protocol,Format> protocolHandlers=getProtocolHandlers();
  for (  Protocol protocol : protocolHandlers.getProtocols())   rootSchemaDef.addProtocolProperties(protocol,protocolHandlers.getProtocolProperties(protocol));
  FormatHandlers<Protocol,Format> formatHandlers=getFormatHandlers();
  for (  Format format : formatHandlers.getFormats())   rootSchemaDef.addFormatProperties(format,formatHandlers.getFormatProperties(format));
}
Program: 17802
Project: 17802
Buggy source:
@Override public int hashCode(){
  int result=defaultProtocol != null ? defaultProtocol.hashCode() : 0;
  result=31 * result + (defaultFormat != null ? defaultFormat.hashCode() : 0);
  result=31 * result + (rootSchemaDef != null ? rootSchemaDef.hashCode() : 0);
  result=31 * result + (protocolHandlers != null ? protocolHandlers.hashCode() : 0);
  result=31 * result + (formatHandlers != null ? formatHandlers.hashCode() : 0);
  result=31 * result + (nameFieldsMap != null ? nameFieldsMap.hashCode() : 0);
  result=31 * result + (idPointMap != null ? idPointMap.hashCode() : 0);
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=(rootSchemaDef != null ? rootSchemaDef.hashCode() : 0);
  result=31 * result + (protocolHandlers != null ? protocolHandlers.hashCode() : 0);
  result=31 * result + (formatHandlers != null ? formatHandlers.hashCode() : 0);
  result=31 * result + (nameFieldsMap != null ? nameFieldsMap.hashCode() : 0);
  result=31 * result + (idPointMap != null ? idPointMap.hashCode() : 0);
  return result;
}
Program: 17803
Project: 17803
Buggy source:
public String createSchemaDefAndTableDefsFor(String schemaName,String schemaIdentifier){
  if (platformBroker != null)   schemaIdentifier=platformBroker.getFullPath(schemaIdentifier);
  LOG.debug("String_Node_Str",schemaIdentifier);
  if (schemaName == null)   schemaName=platformBroker.createSchemaNameFrom(schemaIdentifier);
  SchemaDef schemaDef=getSchemaDef(schemaName);
  if (schemaDef == null)   schemaDef=createSchemaDef(schemaName,schemaIdentifier);
 else   if (!schemaIdentifier.equalsIgnoreCase(schemaDef.getIdentifier()))   throw new IllegalArgumentException("String_Node_Str" + schemaName + "String_Node_Str"+ schemaIdentifier);
  String[] childIdentifiers=getChildIdentifiers(schemaIdentifier);
  LOG.debug("String_Node_Str",schemaName,childIdentifiers.length);
  for (  String identifier : childIdentifiers)   createTableDefFor(schemaDef,null,identifier,null,null,null);
  return schemaName;
}

Fixed version (ground truth):
public String createSchemaDefAndTableDefsFor(String schemaName,String protocolName,String formatName,String schemaIdentifier){
  if (platformBroker != null)   schemaIdentifier=platformBroker.getFullPath(schemaIdentifier);
  LOG.debug("String_Node_Str",schemaIdentifier);
  if (schemaName == null)   schemaName=platformBroker.createSchemaNameFrom(schemaIdentifier);
  SchemaDef schemaDef=getSchemaDef(schemaName);
  if (schemaDef == null)   schemaDef=createSchemaDef(schemaName,protocolName,formatName,schemaIdentifier);
 else   if (!schemaIdentifier.equalsIgnoreCase(schemaDef.getIdentifier()))   throw new IllegalArgumentException("String_Node_Str" + schemaName + "String_Node_Str"+ schemaIdentifier);
  String[] childIdentifiers=getChildIdentifiers(schemaIdentifier);
  LOG.debug("String_Node_Str",schemaName,childIdentifiers.length);
  for (  String identifier : childIdentifiers)   createTableDefFor(schemaDef,null,identifier,null,null,null);
  return schemaName;
}
Program: 17804
Project: 17804
Buggy source:
@Override public boolean equals(Object object){
  if (this == object)   return true;
  if (!(object instanceof SchemaCatalog))   return false;
  SchemaCatalog catalog=(SchemaCatalog)object;
  if (defaultFormat != null ? !defaultFormat.equals(catalog.defaultFormat) : catalog.defaultFormat != null)   return false;
  if (defaultProtocol != null ? !defaultProtocol.equals(catalog.defaultProtocol) : catalog.defaultProtocol != null)   return false;
  if (formatHandlers != null ? !formatHandlers.equals(catalog.formatHandlers) : catalog.formatHandlers != null)   return false;
  if (idPointMap != null ? !idPointMap.equals(catalog.idPointMap) : catalog.idPointMap != null)   return false;
  if (nameFieldsMap != null ? !nameFieldsMap.equals(catalog.nameFieldsMap) : catalog.nameFieldsMap != null)   return false;
  if (protocolHandlers != null ? !protocolHandlers.equals(catalog.protocolHandlers) : catalog.protocolHandlers != null)   return false;
  if (rootSchemaDef != null ? !rootSchemaDef.equals(catalog.rootSchemaDef) : catalog.rootSchemaDef != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object object){
  if (this == object)   return true;
  if (!(object instanceof SchemaCatalog))   return false;
  SchemaCatalog catalog=(SchemaCatalog)object;
  if (formatHandlers != null ? !formatHandlers.equals(catalog.formatHandlers) : catalog.formatHandlers != null)   return false;
  if (idPointMap != null ? !idPointMap.equals(catalog.idPointMap) : catalog.idPointMap != null)   return false;
  if (nameFieldsMap != null ? !nameFieldsMap.equals(catalog.nameFieldsMap) : catalog.nameFieldsMap != null)   return false;
  if (protocolHandlers != null ? !protocolHandlers.equals(catalog.protocolHandlers) : catalog.protocolHandlers != null)   return false;
  if (rootSchemaDef != null ? !rootSchemaDef.equals(catalog.rootSchemaDef) : catalog.rootSchemaDef != null)   return false;
  return true;
}
Program: 17805
Project: 17805
Buggy source:
public boolean connectForRead(boolean allowUI,String sPerms){
  Session session=_createSession();
  Session.OpenRequest req=_createOpenRequest(session);
  req.setPermissions(_createPermissionsFromString(sPerms));
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowUI) {
    Session.setActiveSession(session);
    session.openForRead(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean connectForRead(boolean allowUI,String sPerms){
  Session session=_createSession();
  if (session.isOpened()) {
    return true;
  }
  Session.OpenRequest req=_createOpenRequest(session);
  req.setPermissions(_createPermissionsFromString(sPerms));
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowUI) {
    Session.setActiveSession(session);
    session.openForRead(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}
Program: 17806
Project: 17806
Buggy source:
public boolean connectForPublish(boolean allowUI,String sPerms){
  Session session=_createSession();
  Session.OpenRequest req=_createOpenRequest(session);
  req.setPermissions(_createPermissionsFromString(sPerms));
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowUI) {
    Session.setActiveSession(session);
    session.openForPublish(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean connectForPublish(boolean allowUI,String sPerms){
  Session session=_createSession();
  if (session.isOpened()) {
    return true;
  }
  Session.OpenRequest req=_createOpenRequest(session);
  req.setPermissions(_createPermissionsFromString(sPerms));
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowUI) {
    Session.setActiveSession(session);
    session.openForPublish(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}
Program: 17807
Project: 17807
Buggy source:
/** 
 * @public
 * @return	void
 */
public boolean connect(boolean allowUI){
  Session session=_createSession();
  Session.OpenRequest req=_createOpenRequest(session);
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowUI) {
    Session.setActiveSession(session);
    session.openForRead(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @public
 * @return	void
 */
public boolean connect(boolean allowUI){
  Session session=_createSession();
  if (session.isOpened()) {
    return true;
  }
  Session.OpenRequest req=_createOpenRequest(session);
  if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || (allowUI && !SessionState.OPENING.equals(session.getState()))) {
    session.openForRead(req);
    return session.isOpened();
  }
 else {
    return false;
  }
}