nus-yam/ex-repair huggingface dataset:
Program: 85384
Project: 85384
Buggy source:
@Override public void setValue(IValue value){
  if (this.isSugarCall) {
    this.arguments.add(value);
  }
 else {
    this.instance=value;
  }
}

Fixed version (ground truth):
@Override public void setValue(IValue value){
  this.instance=value;
}
Program: 85385
Project: 85385
Buggy source:
@Override public int getSignatureMatch(String name,Type type,Type... argumentTypes){
  if (name.equals(this.name)) {
    int pOff=0;
    int match=1;
    int len=argumentTypes.length;
    List<Parameter> parameters=this.parameters;
    if (type != null && (this.modifiers & Modifiers.IMPLICIT) != 0) {
      if (len != parameters.size() - 1) {
        return 0;
      }
      Type t2=parameters.get(0).type;
      if (type.equals(t2)) {
        match+=2;
      }
 else       if (Type.isSuperType(type,t2)) {
        match+=1;
      }
 else {
        return 0;
      }
      pOff=1;
    }
 else     if (len != this.parameters.size()) {
      return 0;
    }
    for (int i=0; i < len; i++) {
      Type t1=parameters.get(i + pOff).type;
      Type t2=argumentTypes[i];
      if (t1.equals(t2)) {
        match+=2;
      }
 else       if (Type.isSuperType(t1,t2)) {
        match+=1;
      }
 else {
        return 0;
      }
    }
    return match;
  }
  return 0;
}

Fixed version (ground truth):
@Override public int getSignatureMatch(String name,Type type,Type... argumentTypes){
  if (name.equals(this.qualifiedName)) {
    int pOff=0;
    int match=1;
    int len=argumentTypes.length;
    List<Parameter> parameters=this.parameters;
    if (type != null && (this.modifiers & Modifiers.IMPLICIT) != 0) {
      if (len != parameters.size() - 1) {
        return 0;
      }
      Type t2=parameters.get(0).type;
      if (type.equals(t2)) {
        match+=2;
      }
 else       if (Type.isSuperType(type,t2)) {
        match+=1;
      }
 else {
        return 0;
      }
      pOff=1;
    }
 else     if (len != this.parameters.size()) {
      return 0;
    }
    for (int i=0; i < len; i++) {
      Type t1=parameters.get(i + pOff).type;
      Type t2=argumentTypes[i];
      if (t1.equals(t2)) {
        match+=2;
      }
 else       if (Type.isSuperType(t1,t2)) {
        match+=1;
      }
 else {
        return 0;
      }
    }
    return match;
  }
  return 0;
}
Program: 85388
Project: 85388
Buggy source:
@Override public Type getType(){
  return Type.CLASS;
}

Fixed version (ground truth):
@Override public Type getType(){
  return this.type;
}
Program: 85389
Project: 85389
Buggy source:
@Override public CompilationUnit applyState(CompilerState state,IContext context){
  if (state == CompilerState.TOKENIZE) {
    this.tokens=Dyvilc.parser.tokenize(this.getFile());
    return this;
  }
 else   if (state == CompilerState.PARSE) {
    Dyvilc.parser.pushParser(new CompilationUnitParser(this));
    Dyvilc.parser.parse(this.getFile(),this.tokens);
    this.tokens=null;
    return this;
  }
 else   if (state == CompilerState.DEBUG) {
    List<Marker> markers=this.getFile().markers;
    int size=markers.size();
    if (size > 0) {
      System.out.println("String_Node_Str" + this.name + "String_Node_Str"+ size);
      for (      Marker marker : this.getFile().markers) {
        marker.print(System.err);
      }
    }
    return this;
  }
 else   if (state == CompilerState.RESOLVE_TYPES) {
switch (this.pack.check(this.packageDecl)) {
case 0:
      break;
case 1:
    state.addMarker(new SemanticError(new CodePosition((CodeFile)this.position,1,0,1),"String_Node_Str","String_Node_Str" + this.pack.name + "String_Node_Str"));
  break;
case 2:
state.addMarker(new SemanticError(this.packageDecl.getPosition(),"String_Node_Str","String_Node_Str" + this.pack.name + "String_Node_Str"));
break;
case 3:
state.addMarker(new SemanticError(this.packageDecl.getPosition(),"String_Node_Str","String_Node_Str"));
break;
}
for (IImport i : this.imports) {
i.applyState(state,this);
}
}
this.classes.replaceAll(c -> c.applyState(state,this));
return this;
}

Fixed version (ground truth):
@Override public CompilationUnit applyState(CompilerState state,IContext context){
  if (state == CompilerState.TOKENIZE) {
    this.tokens=Dyvilc.parser.tokenize(this.getFile());
    return this;
  }
 else   if (state == CompilerState.PARSE) {
    Dyvilc.parser.pushParser(new CompilationUnitParser(this));
    Dyvilc.parser.parse(this.getFile(),this.tokens);
    this.tokens=null;
    return this;
  }
 else   if (state == CompilerState.DEBUG) {
synchronized (this) {
      List<Marker> markers=this.getFile().markers;
      int size=markers.size();
      if (size > 0) {
        System.out.println("String_Node_Str" + this.name + "String_Node_Str"+ size);
        for (        Marker marker : this.getFile().markers) {
          marker.print(System.err);
        }
      }
    }
    return this;
  }
 else   if (state == CompilerState.RESOLVE_TYPES) {
switch (this.pack.check(this.packageDecl)) {
case 0:
      break;
case 1:
    state.addMarker(new SemanticError(new CodePosition((CodeFile)this.position,1,0,1),"String_Node_Str","String_Node_Str" + this.pack.name + "String_Node_Str"));
  break;
case 2:
state.addMarker(new SemanticError(this.packageDecl.getPosition(),"String_Node_Str","String_Node_Str" + this.pack.name + "String_Node_Str"));
break;
case 3:
state.addMarker(new SemanticError(this.packageDecl.getPosition(),"String_Node_Str","String_Node_Str"));
break;
}
for (IImport i : this.imports) {
i.applyState(state,this);
}
}
this.classes.replaceAll(c -> c.applyState(state,this));
return this;
}
Program: 85390
Project: 85390
Buggy source:
@Override public ClassAccess applyState(CompilerState state,IContext context){
  this.type=this.type.applyState(state,context);
  return this;
}

Fixed version (ground truth):
@Override public IValue applyState(CompilerState state,IContext context){
  if (state == CompilerState.RESOLVE_TYPES) {
    this.type=this.type.resolve(context);
  }
 else   if (state == CompilerState.RESOLVE) {
    if (!this.type.isResolved()) {
      String name=this.type.name;
      IField field=context.resolveField(name);
      if (field != null) {
        FieldAccess access=new FieldAccess(this.position,null,name);
        access.field=field;
        return access;
      }
      IMethod method=context.resolveMethod(name,Type.EMPTY_TYPES);
      if (method != null) {
        MethodCall call=new MethodCall(this.position,null,name);
        call.method=method;
        return call;
      }
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + name + "String_Node_Str"));
    }
  }
  return this;
}
Program: 85391
Project: 85391
Buggy source:
@Override public FieldAccess applyState(CompilerState state,IContext context){
  if (this.instance != null) {
    this.instance=this.instance.applyState(state,context);
  }
  if (state == CompilerState.RESOLVE) {
    if (this.instance != null) {
      context=this.instance.getType();
    }
    this.field=context.resolveField(this.name);
    if (this.field == null) {
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
    }
 else     if (this.field.hasModifier(Modifiers.STATIC) && this.instance instanceof ThisValue) {
      state.addMarker(new Warning(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
      this.instance=null;
    }
  }
  return this;
}

Fixed version (ground truth):
@Override public IValue applyState(CompilerState state,IContext context){
  if (this.instance != null) {
    this.instance=this.instance.applyState(state,context);
  }
  if (state == CompilerState.RESOLVE) {
    if (this.instance != null) {
      context=this.instance.getType();
    }
    this.field=context.resolveField(this.name);
    if (this.field == null) {
      IMethod method=context.resolveMethod(this.name,Type.EMPTY_TYPES);
      if (method != null) {
        MethodCall call=new MethodCall(this.position,this.instance,this.name);
        call.method=method;
        call.isSugarCall=true;
        return call;
      }
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
    }
 else     if (this.field.hasModifier(Modifiers.STATIC) && this.instance instanceof ThisValue) {
      state.addMarker(new Warning(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
      this.instance=null;
    }
  }
  return this;
}
Program: 85392
Project: 85392
Buggy source:
@Override public Type getType(){
  return this.descriptor.getType();
}

Fixed version (ground truth):
@Override public Type getType(){
  return this.method.getType();
}
Program: 85393
Project: 85393
Buggy source:
@Override public IValue applyState(CompilerState state,IContext context){
  if (this.instance != null) {
    this.instance=this.instance.applyState(state,context);
  }
  super.applyState(state,context);
  if (state == CompilerState.RESOLVE) {
    if (this.instance != null) {
      context=this.instance.getType();
    }
    try {
      this.descriptor=context.resolveMethod(this.name,this.getTypes());
    }
 catch (    Exception ex) {
    }
    if (this.descriptor == null) {
      IField field=context.resolveField(this.name);
      if (field != null) {
        FieldAccess fieldAccess=new FieldAccess(this.position,this.instance,this.name);
        fieldAccess.field=field;
        fieldAccess.isSugarAccess=this.isSugarCall;
        return fieldAccess;
      }
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
    }
  }
  return this;
}

Fixed version (ground truth):
@Override public IValue applyState(CompilerState state,IContext context){
  if (this.instance != null) {
    this.instance=this.instance.applyState(state,context);
  }
  super.applyState(state,context);
  if (state == CompilerState.RESOLVE) {
    if (this.instance != null) {
      context=this.instance.getType();
    }
    try {
      this.method=context.resolveMethod(this.name,this.getTypes());
    }
 catch (    Exception ex) {
    }
    if (this.method == null) {
      IField field=context.resolveField(this.name);
      if (field != null) {
        FieldAccess fieldAccess=new FieldAccess(this.position,this.instance,this.name);
        fieldAccess.field=field;
        fieldAccess.isSugarAccess=this.isSugarCall;
        return fieldAccess;
      }
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
    }
  }
  return this;
}
Program: 85394
Project: 85394
Buggy source:
@Override public Type applyState(CompilerState state,IContext context){
  if (this.position == null) {
    return this;
  }
  if (state == CompilerState.RESOLVE_TYPES) {
    if (this.theClass == null) {
switch (this.name) {
case "String_Node_Str":
        return VOID;
case "String_Node_Str":
      return INT;
case "String_Node_Str":
    return LONG;
case "String_Node_Str":
  return FLOAT;
case "String_Node_Str":
return DOUBLE;
case "String_Node_Str":
return CHAR;
case "String_Node_Str":
return BOOL;
}
this.theClass=context.resolveClass(this.name);
if (this.theClass == null) {
state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
}
}
}
return this;
}

Fixed version (ground truth):
@Override public Type applyState(CompilerState state,IContext context){
  if (this.position == null) {
    return this;
  }
  if (state == CompilerState.RESOLVE_TYPES) {
    Type type=this.resolve(context);
    if (!type.isResolved()) {
      state.addMarker(new SemanticError(this.position,"String_Node_Str" + this.name + "String_Node_Str"));
    }
    return type;
  }
  return this;
}
Program: 85395
Project: 85395
Buggy source:
/** 
 * Parses the given   {@link IToken} {@code token}. You can override this method to sort out comments.
 * @see Parser#parse(ParserManager,String,IToken)
 * @param value the value of the token
 * @param token the token
 * @throws SyntaxError syntax errors
 */
public void parseToken(String value,IToken token) throws SyntaxError {
  boolean parsed;
  try {
    parsed=this.currentParser.parse(this,value,token);
  }
 catch (  SyntaxError error) {
    throw error;
  }
catch (  Exception ex) {
    throw new SyntaxError("String_Node_Str" + value + "String_Node_Str"+ ex.getMessage());
  }
  if (!parsed) {
    throw new SyntaxError("String_Node_Str" + value + "String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Parses the given   {@link IToken} {@code token}. You can override this method to sort out comments.
 * @see Parser#parse(ParserManager,String,IToken)
 * @param value the value of the token
 * @param token the token
 * @throws SyntaxError syntax errors
 */
public void parseToken(String value,IToken token) throws SyntaxError {
  boolean parsed;
  try {
    parsed=this.currentParser.parse(this,value,token);
  }
 catch (  SyntaxError error) {
    throw error;
  }
catch (  Exception ex) {
    String message=ex.getMessage();
    if (message == null) {
      message=ex.getClass().getName();
    }
    throw new SyntaxError("String_Node_Str" + value + "String_Node_Str"+ message);
  }
  if (!parsed) {
    throw new SyntaxError("String_Node_Str" + value + "String_Node_Str","String_Node_Str");
  }
}
Program: 85397
Project: 85397
Buggy source:
@Override public boolean parse(ParserManager jcp,String value,IToken token) throws SyntaxError {
  if (this.isInMode(MODIFIERS)) {
    int i=0;
    if ((i=Modifiers.parseClassModifier(value)) != -1) {
      this.modifiers|=i;
      return true;
    }
 else     if ((i=Classes.parse(value)) != -1) {
      this.theClassDecl=AbstractClass.create(i);
      this.theClassDecl.setModifiers(this.modifiers);
      this.unit.addClass(this.theClassDecl);
      this.modifiers=0;
      this.mode=NAME;
      return true;
    }
  }
  if (this.isInMode(NAME)) {
    if (token.isType(Token.TYPE_IDENTIFIER)) {
      this.theClassDecl.setName(value);
      this.mode=EXTENDS | BODY;
      return true;
    }
  }
  if (this.isInMode(EXTENDS)) {
    if ("String_Node_Str".equals(value)) {
      this.mode=SUPERCLASSES;
      return true;
    }
  }
  if (this.isInMode(SUPERCLASSES)) {
    if (token.isType(Token.TYPE_IDENTIFIER)) {
      this.theClassDecl.addSuperClass(this.unit.resolveClass(value));
      return true;
    }
  }
  if (this.isInMode(BODY)) {
    if ("String_Node_Str".equals(value)) {
      jcp.pushParser(new ClassBodyParser(this.theClassDecl));
      this.mode=BODY_END;
      return true;
    }
  }
  if (this.isInMode(BODY_END)) {
    if ("String_Node_Str".equals(value)) {
      jcp.popParser();
      this.mode=0;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean parse(ParserManager jcp,String value,IToken token) throws SyntaxError {
  if (this.isInMode(MODIFIERS)) {
    int i=0;
    if ((i=Modifiers.parseClassModifier(value)) != -1) {
      this.modifiers|=i;
      return true;
    }
 else     if ((i=Classes.parse(value)) != -1) {
      this.theClassDecl=AbstractClass.create(i);
      this.theClassDecl.setModifiers(this.modifiers);
      this.unit.addClass(this.theClassDecl);
      this.modifiers=0;
      this.mode=NAME;
      return true;
    }
  }
  if (this.isInMode(NAME)) {
    if (token.isType(Token.TYPE_IDENTIFIER)) {
      this.theClassDecl.setName(value);
      this.mode=EXTENDS | BODY;
      return true;
    }
  }
  if (this.isInMode(EXTENDS)) {
    if ("String_Node_Str".equals(value)) {
      this.mode=SUPERCLASSES;
      return true;
    }
  }
  if (this.isInMode(SUPERCLASSES)) {
    if (token.isType(Token.TYPE_IDENTIFIER)) {
      this.theClassDecl.addSuperClass(this.unit.resolveClass(value));
      return true;
    }
  }
  if (this.isInMode(BODY)) {
    if ("String_Node_Str".equals(value)) {
      jcp.pushParser(new ClassBodyParser(this.theClassDecl));
      this.mode=BODY_END;
      return true;
    }
  }
  if (this.isInMode(BODY_END)) {
    if ("String_Node_Str".equals(value)) {
      jcp.popParser();
      return true;
    }
  }
  return false;
}
Program: 85398
Project: 85398
Buggy source:
@Override public void toString(String prefix,StringBuilder buffer){
  this.packageDecl.toString("String_Node_Str",buffer);
  buffer.append('\n');
  if (Formatting.Package.newLine) {
    buffer.append('\n');
  }
  for (  IImport iimport : this.imports) {
    iimport.toString("String_Node_Str",buffer);
    buffer.append('\n');
  }
  if (Formatting.Import.newLine) {
    buffer.append('\n');
  }
  for (  IClass iclass : this.classes) {
    iclass.toString("String_Node_Str",buffer);
    if (Formatting.Class.newLine) {
      buffer.append('\n');
    }
  }
}

Fixed version (ground truth):
@Override public void toString(String prefix,StringBuilder buffer){
  this.packageDecl.toString("String_Node_Str",buffer);
  buffer.append('\n');
  if (Formatting.Package.newLine) {
    buffer.append('\n');
  }
  if (!this.imports.isEmpty()) {
    for (    IImport iimport : this.imports) {
      iimport.toString("String_Node_Str",buffer);
      buffer.append('\n');
    }
    if (Formatting.Import.newLine) {
      buffer.append('\n');
    }
  }
  for (  IClass iclass : this.classes) {
    iclass.toString("String_Node_Str",buffer);
    if (Formatting.Class.newLine) {
      buffer.append('\n');
    }
  }
}
Program: 85399
Project: 85399
Buggy source:
@Override public Field applyState(CompilerState state){
  this.value=this.value.applyState(state);
  return this;
}

Fixed version (ground truth):
@Override public Field applyState(CompilerState state){
  if (this.value != null) {
    this.value=this.value.applyState(state);
  }
  return this;
}
Program: 85400
Project: 85400
Buggy source:
public List<Parameter> getParameters();

Fixed version (ground truth):
public Map<String,Parameter> getParameters();
Program: 85401
Project: 85401
Buggy source:
public Map<String,Parameter> getParameters(){
  return this.parameters;
}

Fixed version (ground truth):
@Override public Map<String,Parameter> getParameters(){
  return this.parameters;
}
Program: 85402
Project: 85402
Buggy source:
public List<ThrowsDecl> getThrowsDecl(){
  return this.throwsDecl;
}

Fixed version (ground truth):
public List<ThrowsDecl> getThrowsDecl(){
  return this.throwsDeclarations;
}
Program: 85403
Project: 85403
Buggy source:
@Override public boolean addThrowsDecl(ThrowsDecl throwsDecl){
  return this.throwsDecl.add(throwsDecl);
}

Fixed version (ground truth):
@Override public boolean addThrowsDecl(ThrowsDecl throwsDecl){
  return this.throwsDeclarations.add(throwsDecl);
}
Program: 85404
Project: 85404
Buggy source:
public void setException(String exception) throws SyntaxException {
  if (this.exception != null) {
    throw new SyntaxException("String_Node_Str",exception);
  }
  this.exception=exception;
}

Fixed version (ground truth):
public void setException(String exception){
  this.exception=exception;
}
Program: 85405
Project: 85405
Buggy source:
@Override public void parse(ParserManager jcp,String value,IToken token) throws SyntaxException {
switch (value) {
case "String_Node_Str":
    this.mode=NAME;
  this.theClassDecl=new dyvil.tools.compiler.ast.classes.Class();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new Interface();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new dyvil.tools.compiler.ast.classes.Enum();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new AnnotationClass();
return;
case "String_Node_Str":
this.mode=SUPERCLASSES;
return;
case "String_Node_Str":
this.theClassDecl.setModifiers(this.modifiers);
jcp.pushParser(new ClassBodyParser());
return;
}
switch (this.mode) {
case NAME:
this.theClassDecl.setName(value);
case SUPERCLASSES:
this.theClassDecl.addSuperClass(value);
}
}

Fixed version (ground truth):
@Override public void parse(ParserManager jcp,String value,IToken token) throws SyntaxException {
switch (value) {
case "String_Node_Str":
    this.mode=NAME;
  this.theClassDecl=new dyvil.tools.compiler.ast.classes.Class();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new Interface();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new dyvil.tools.compiler.ast.classes.Enum();
return;
case "String_Node_Str":
this.mode=NAME;
this.theClassDecl=new AnnotationClass();
return;
case "String_Node_Str":
this.mode=SUPERCLASSES;
return;
case "String_Node_Str":
this.theClassDecl.setModifiers(this.modifiers);
jcp.pushParser(new ClassBodyParser(this.theClassDecl));
return;
}
switch (this.mode) {
case NAME:
this.theClassDecl.setName(value);
case SUPERCLASSES:
this.theClassDecl.addSuperClass(value);
}
}
Program: 85406
Project: 85406
Buggy source:
private static void createSetDefaultFunctions(List<String> r,DbOperations dbOps){
  for (  Table table : dbOps.getDatabase().getTables()) {
    if (!table.isStem()) {
      StringBuilder line=new StringBuilder();
      String rTableName=convertToRName(table.getName());
      List<String> argDefs=new ArrayList<String>();
      List<String> insertLines=new ArrayList<String>();
      for (      Field field : table.getFields()) {
        String rFieldName=field.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        argDefs.add(rFieldName);
        insertLines.add("String_Node_Str" + rFieldName + "String_Node_Str");
        insertLines.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
        insertLines.add("String_Node_Str");
      }
      line.append("String_Node_Str" + rTableName + "String_Node_Str");
      line.append(StringUtilities.join(argDefs,"String_Node_Str"));
      line.append("String_Node_Str");
      r.add(line.toString());
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.addAll(insertLines);
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void createSetDefaultFunctions(List<String> r,DbOperations dbOps){
  for (  Table table : dbOps.getDatabase().getTables()) {
    if (!table.isStem()) {
      StringBuilder line=new StringBuilder();
      String rTableName=convertToRName(table.getName());
      List<String> argDefs=new ArrayList<String>();
      List<String> insertLines=new ArrayList<String>();
      for (      Field field : table.getFields()) {
        String rFieldName=convertToRName(field.getName());
        argDefs.add(rFieldName);
        insertLines.add("String_Node_Str" + rFieldName + "String_Node_Str");
        insertLines.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
        insertLines.add("String_Node_Str");
      }
      line.append("String_Node_Str" + rTableName + "String_Node_Str");
      line.append(StringUtilities.join(argDefs,"String_Node_Str"));
      line.append("String_Node_Str");
      r.add(line.toString());
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.addAll(insertLines);
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
    }
  }
}
Program: 85407
Project: 85407
Buggy source:
private static String convertToRName(String name){
  name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  return name;
}

Fixed version (ground truth):
public static String convertToRName(String name){
  name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  return name;
}
Program: 85409
Project: 85409
Buggy source:
private static void createAddFunctions(List<String> r,DbOperations dbOps){
  for (  Table table : dbOps.getDatabase().getTables()) {
    if (!table.isStem()) {
      StringBuilder line=new StringBuilder();
      String rTableName=convertToRName(table.getName());
      List<String> argDefs=new ArrayList<String>();
      for (      Field field : table.getFields()) {
        String rFieldName=field.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        argDefs.add(rFieldName);
      }
      List<String> insertLines=dbOps.getInsertValues(table);
      line.append("String_Node_Str" + rTableName + "String_Node_Str");
      line.append(StringUtilities.join(argDefs,"String_Node_Str"));
      line.append("String_Node_Str");
      r.add(line.toString());
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.addAll(insertLines);
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str" + table + "String_Node_Str");
      r.add("String_Node_Str");
      r.add(dbOps.getInsertStatement(table));
      r.add("String_Node_Str" + table + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void createAddFunctions(List<String> r,DbOperations dbOps){
  for (  Table table : dbOps.getDatabase().getTables()) {
    if (!table.isStem()) {
      StringBuilder line=new StringBuilder();
      String rTableName=convertToRName(table.getName());
      List<String> argDefs=new ArrayList<String>();
      for (      Field field : table.getFields()) {
        String rFieldName=convertToRName(field.getName());
        argDefs.add(rFieldName);
      }
      List<String> insertLines=dbOps.getInsertValues(table);
      line.append("String_Node_Str" + rTableName + "String_Node_Str");
      line.append(StringUtilities.join(argDefs,"String_Node_Str"));
      line.append("String_Node_Str");
      r.add(line.toString());
      r.add("String_Node_Str" + rTableName + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.addAll(insertLines);
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str" + table + "String_Node_Str");
      r.add("String_Node_Str");
      r.add(dbOps.getInsertStatement(table));
      r.add("String_Node_Str" + table + "String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
      r.add("String_Node_Str");
    }
  }
}
Program: 85410
Project: 85410
Buggy source:
private static void createGenerateInsertSqlFunction(List<String> r,DbOperations dbOps){
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  String tableFooter=dbOps.getTableFooter();
  if (tableFooter != null && !tableFooter.isEmpty()) {
    r.add("String_Node_Str");
    r.add("String_Node_Str" + dbOps.dropTableIfExists() + "String_Node_Str");
    r.add("String_Node_Str" + tableFooter + "String_Node_Str");
  }
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
}

Fixed version (ground truth):
private static void createGenerateInsertSqlFunction(List<String> r,DbOperations dbOps){
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  String tableFooter=dbOps.getTableFooter();
  if (tableFooter != null && !tableFooter.isEmpty()) {
    r.add("String_Node_Str");
    r.add("String_Node_Str" + dbOps.dropTableIfExists() + "String_Node_Str");
    r.add("String_Node_Str" + tableFooter + "String_Node_Str");
  }
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
  r.add("String_Node_Str");
}
Program: 85411
Project: 85411
Buggy source:
@Override public List<String> getInsertValues(Table table){
  List<String> result=new ArrayList<String>();
  for (  Field field : table.getFields()) {
    String rFieldName=field.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName+ "String_Node_Str");
    result.add("String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName+ "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
@Override public List<String> getInsertValues(Table table){
  List<String> result=new ArrayList<String>();
  for (  Field field : table.getFields()) {
    String rFieldName=ETLTestFrameWorkGenerator.convertToRName(field.getName());
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName+ "String_Node_Str");
    result.add("String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName+ "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str");
  }
  return result;
}
Program: 85412
Project: 85412
Buggy source:
@Override public List<String> getInsertValues(Table table){
  List<String> result=new ArrayList<String>();
  for (  Field field : table.getFields()) {
    String rFieldName=field.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
    String sqlFieldName=this.convertToSqlName(field.getName());
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
    result.add("String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + sqlFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str");
    result.add("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
@Override public List<String> getInsertValues(Table table){
  List<String> result=new ArrayList<String>();
  for (  Field field : table.getFields()) {
    String rFieldName=ETLTestFrameWorkGenerator.convertToRName(field.getName());
    String sqlFieldName=this.convertToSqlName(field.getName());
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str"+ rFieldName);
    result.add("String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str" + sqlFieldName + "String_Node_Str");
    result.add("String_Node_Str" + rFieldName + "String_Node_Str");
    result.add("String_Node_Str");
    result.add("String_Node_Str");
  }
  return result;
}
Program: 85413
Project: 85413
Buggy source:
private void LabeledRectangleClicked(MouseEvent event,List<LabeledRectangle> components){
  int startIndex=0;
  int endIndex=0;
  for (  LabeledRectangle component : components) {
    if (component.contains(event.getPoint())) {
      if (event.isControlDown()) {
        component.toggleSelected();
      }
 else       if (event.isShiftDown()) {
        startIndex=Math.min(components.indexOf(lastSelectedRectangle),components.indexOf(component));
        endIndex=Math.max(components.indexOf(lastSelectedRectangle),components.indexOf(component));
        if (startIndex >= 0 && endIndex >= 0) {
          for (int i=startIndex; i <= endIndex; i++) {
            components.get(i).setSelected(true);
          }
        }
 else {
          component.toggleSelected();
        }
      }
 else {
        component.setSelected(true);
      }
      if (component.isSelected()) {
        lastSelectedRectangle=component;
      }
 else {
        lastSelectedRectangle=null;
      }
      detailsListener.showDetails(component.getItem());
      repaint();
      break;
    }
  }
}

Fixed version (ground truth):
private void LabeledRectangleClicked(MouseEvent event,List<LabeledRectangle> components){
  int startIndex=0;
  int endIndex=0;
  for (  LabeledRectangle component : components) {
    if (component.contains(event.getPoint())) {
      if ((event.getModifiers() & shortcutMask) == shortcutMask) {
        component.toggleSelected();
      }
 else       if (event.isShiftDown()) {
        startIndex=Math.min(components.indexOf(lastSelectedRectangle),components.indexOf(component));
        endIndex=Math.max(components.indexOf(lastSelectedRectangle),components.indexOf(component));
        if (startIndex >= 0 && endIndex >= 0) {
          for (int i=startIndex; i <= endIndex; i++) {
            components.get(i).setSelected(true);
          }
        }
 else {
          component.toggleSelected();
        }
      }
 else {
        component.setSelected(true);
      }
      if (component.isSelected()) {
        lastSelectedRectangle=component;
      }
 else {
        lastSelectedRectangle=null;
      }
      detailsListener.showDetails(component.getItem());
      repaint();
      break;
    }
  }
}
Program: 85415
Project: 85415
Buggy source:
private void doSetTargetCustom(String fileName){
  ETL etl=new ETL(ObjectExchange.etl.getSourceDatabase(),Database.generateModelFromCSV(fileName));
  etl.copyETLMappings(ObjectExchange.etl);
  tableMappingPanel.setMapping(etl.getTableToTableMapping());
  ObjectExchange.etl=etl;
}

Fixed version (ground truth):
private void doSetTargetCustom(String fileName){
  if (fileName != null) {
    File file=new File(fileName);
    InputStream stream;
    try {
      stream=new FileInputStream(file);
      ETL etl=new ETL(ObjectExchange.etl.getSourceDatabase(),Database.generateModelFromCSV(stream,file.getName()));
      etl.copyETLMappings(ObjectExchange.etl);
      tableMappingPanel.setMapping(etl.getTableToTableMapping());
      ObjectExchange.etl=etl;
    }
 catch (    IOException e) {
    }
  }
}
Program: 85417
Project: 85417
Buggy source:
private void doSetTargetCustom(String fileName){
  ETL etl=new ETL(ObjectExchange.etl.getSourceDatabase(),Database.generateModelFromCSV(fileName));
  etl.copyETLMappings(ObjectExchange.etl);
  tableMappingPanel.setMapping(etl.getTableToTableMapping());
  ObjectExchange.etl=etl;
}

Fixed version (ground truth):
private void doSetTargetCustom(String fileName){
  if (fileName != null) {
    File file=new File(fileName);
    InputStream stream;
    try {
      stream=new FileInputStream(file);
      ETL etl=new ETL(ObjectExchange.etl.getSourceDatabase(),Database.generateModelFromCSV(stream,file.getName()));
      etl.copyETLMappings(ObjectExchange.etl);
      tableMappingPanel.setMapping(etl.getTableToTableMapping());
      ObjectExchange.etl=etl;
    }
 catch (    IOException e) {
    }
  }
}
Program: 85418
Project: 85418
Buggy source:
public Arrow(LabeledRectangle source,LabeledRectangle target){
  this.source=source;
  this.target=target;
}

Fixed version (ground truth):
public Arrow(LabeledRectangle source,LabeledRectangle target,ItemToItemMap itemToItemMap){
  this.source=source;
  this.target=target;
  this.itemToItemMap=itemToItemMap;
}
Program: 85419
Project: 85419
Buggy source:
public HighlightStatus getHighlightStatus(){
  if (isSelected()) {
    return HighlightStatus.IS_SELECTED;
  }
 else   if (isSourceSelected() && isTargetSelected()) {
    return HighlightStatus.BOTH_SELECTED;
  }
 else   if (isSourceSelected()) {
    return HighlightStatus.SOURCE_SELECTED;
  }
 else   if (isTargetSelected()) {
    return HighlightStatus.TARGET_SELECTED;
  }
 else   if (isCompleted()) {
    return HighlightStatus.IS_COMPLETED;
  }
 else {
    return HighlightStatus.NONE_SELECTED;
  }
}

Fixed version (ground truth):
public HighlightStatus getHighlightStatus(){
  if (isSelected()) {
    return HighlightStatus.IS_SELECTED;
  }
 else   if (isSourceSelected() && isTargetSelected()) {
    return HighlightStatus.BOTH_SELECTED;
  }
 else   if (isSourceSelected()) {
    return HighlightStatus.SOURCE_SELECTED;
  }
 else   if (isTargetSelected()) {
    return HighlightStatus.TARGET_SELECTED;
  }
 else   if (isCompleted() && getHideCompleted()) {
    return HighlightStatus.IS_COMPLETED;
  }
 else {
    return HighlightStatus.NONE_SELECTED;
  }
}
Program: 85420
Project: 85420
Buggy source:
public boolean isCompleted(){
  return isCompleted;
}

Fixed version (ground truth):
public boolean isCompleted(){
  if (getItemToItemMap() != null) {
    return (!getItemToItemMap().getComment().equals("String_Node_Str")) || (!getItemToItemMap().getLogic().equals("String_Node_Str"));
  }
 else {
    return false;
  }
}
Program: 85421
Project: 85421
Buggy source:
private void makeMapSourceToTarget(LabeledRectangle source,LabeledRectangle target){
  boolean isNew=true;
  for (  Arrow other : arrows) {
    if (source == other.getSource() && target == other.getTarget()) {
      isNew=false;
    }
  }
  if (isNew) {
    Arrow arrow=new Arrow(source);
    arrow.setTarget(target);
    arrows.add(arrow);
    mapping.addSourceToTargetMap(source.getItem(),target.getItem());
  }
  repaint();
}

Fixed version (ground truth):
private void makeMapSourceToTarget(LabeledRectangle source,LabeledRectangle target){
  boolean isNew=true;
  for (  Arrow other : arrows) {
    if (source == other.getSource() && target == other.getTarget()) {
      isNew=false;
    }
  }
  if (isNew) {
    Arrow arrow=new Arrow(source);
    arrow.setTarget(target);
    mapping.addSourceToTargetMap(source.getItem(),target.getItem());
    arrow.setItemToItemMap(mapping.getSourceToTargetMap(source.getItem(),target.getItem()));
    arrow.setHideCompleted(hiding);
    arrows.add(arrow);
  }
  repaint();
}
Program: 85423
Project: 85423
Buggy source:
private void renderModel(){
  sourceComponents.clear();
  cdmComponents.clear();
  arrows.clear();
  for (  MappableItem item : mapping.getSourceItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(255,128,0));
    sourceComponents.add(component);
  }
  for (  MappableItem item : mapping.getTargetItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(128,128,255));
    cdmComponents.add(component);
  }
  for (  ItemToItemMap map : mapping.getSourceToTargetMaps()) {
    Arrow component=new Arrow(getComponentWithItem(map.getSourceItem(),sourceComponents),getComponentWithItem(map.getTargetItem(),cdmComponents));
    if (!showCommented && (!(map.getComment().equals("String_Node_Str")) || !(map.getLogic().equals("String_Node_Str"))))     component.setCompleted(true);
    arrows.add(component);
  }
  layoutItems();
  repaint();
}

Fixed version (ground truth):
private void renderModel(){
  sourceComponents.clear();
  cdmComponents.clear();
  arrows.clear();
  for (  MappableItem item : mapping.getSourceItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(255,128,0));
    sourceComponents.add(component);
  }
  for (  MappableItem item : mapping.getTargetItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(128,128,255));
    cdmComponents.add(component);
  }
  for (  ItemToItemMap map : mapping.getSourceToTargetMaps()) {
    Arrow component=new Arrow(getComponentWithItem(map.getSourceItem(),sourceComponents),getComponentWithItem(map.getTargetItem(),cdmComponents),map);
    arrows.add(component);
  }
  layoutItems();
  repaint();
}
Program: 85424
Project: 85424
Buggy source:
public void itemStateChanged(ItemEvent e){
  if (hideCommented.isSelected()) {
    doHideCommented();
  }
 else {
    doShowCommented();
  }
}

Fixed version (ground truth):
public void itemStateChanged(ItemEvent e){
  if (hideCompleted.isSelected())   doHideCompleted();
 else   doShowCompleted();
}
Program: 85426
Project: 85426
Buggy source:
@Override public void actionPerformed(ActionEvent event){
switch (event.getActionCommand()) {
case ACTION_CMD_SAVE:
    String filename=ObjectExchange.etl.getFilename();
  doSave((filename == null || !filename.toLowerCase().endsWith("String_Node_Str")) ? chooseSavePath(FILE_FILTER_GZ) : filename);
break;
case ACTION_CMD_SAVE_AS:
doSave(chooseSavePath(FILE_FILTER_GZ));
break;
case ACTION_CMD_OPEN_ETL_SPECS:
doOpenSpecs(chooseOpenPath(FILE_FILTER_GZ));
break;
case ACTION_CMD_OPEN_SCAN_REPORT:
doOpenScanReport(chooseOpenPath());
break;
case ACTION_CMD_GENERATE_ETL_DOCUMENT:
doGenerateEtlDoc(chooseSavePath(FILE_FILTER_DOCX));
break;
case ACTION_CMD_DISCARD_COUNTS:
doDiscardCounts();
break;
case ACTION_CMD_FILTER:
doOpenFilterDialog();
case ACTION_CMD_MAKE_MAPPING:
doMakeMappings();
break;
case ACTION_CMD_REMOVE_MAPPING:
doRemoveMappings();
break;
}
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent event){
switch (event.getActionCommand()) {
case ACTION_CMD_SAVE:
    String filename=ObjectExchange.etl.getFilename();
  doSave((filename == null || !filename.toLowerCase().endsWith("String_Node_Str")) ? chooseSavePath(FILE_FILTER_GZ) : filename);
break;
case ACTION_CMD_SAVE_AS:
doSave(chooseSavePath(FILE_FILTER_GZ));
break;
case ACTION_CMD_OPEN_ETL_SPECS:
doOpenSpecs(chooseOpenPath(FILE_FILTER_GZ));
break;
case ACTION_CMD_OPEN_SCAN_REPORT:
doOpenScanReport(chooseOpenPath());
break;
case ACTION_CMD_GENERATE_ETL_DOCUMENT:
doGenerateEtlDoc(chooseSavePath(FILE_FILTER_DOCX));
break;
case ACTION_CMD_DISCARD_COUNTS:
doDiscardCounts();
break;
case ACTION_CMD_FILTER:
doOpenFilterDialog();
break;
case ACTION_CMD_MAKE_MAPPING:
doMakeMappings();
break;
case ACTION_CMD_REMOVE_MAPPING:
doRemoveMappings();
break;
}
}
Program: 85427
Project: 85427
Buggy source:
private void layoutItems(){
  if (minimized) {
    for (    LabeledRectangle targetComponent : getVisibleTargetComponents()) {
      targetComponent.setLocation(targetX,targetComponent.getY());
    }
  }
 else {
    setLabeledRectanglesLocation(getVisibleSourceComponents(),sourceX);
    setLabeledRectanglesLocation(getVisibleTargetComponents(),targetX);
  }
}

Fixed version (ground truth):
private void layoutItems(){
  if (minimized) {
    for (    LabeledRectangle targetComponent : getVisibleTargetComponents()) {
      targetComponent.setLocation(cdmX,targetComponent.getY());
    }
  }
 else {
    setLabeledRectanglesLocation(getVisibleSourceComponents(),sourceX);
    setLabeledRectanglesLocation(getVisibleTargetComponents(),cdmX);
  }
}
Program: 85430
Project: 85430
Buggy source:
public void filterComponents(String searchTerm,boolean filterTarget){
  List<LabeledRectangle> components;
  if (filterTarget == true) {
    components=targetComponents;
    lastTargetFilter=searchTerm;
  }
 else {
    components=sourceComponents;
    lastSourceFilter=searchTerm;
  }
  for (  LabeledRectangle c : components) {
    c.filter(searchTerm);
  }
  layoutItems();
  repaint();
}

Fixed version (ground truth):
public void filterComponents(String searchTerm,boolean filterTarget){
  List<LabeledRectangle> components;
  if (filterTarget == true) {
    components=cdmComponents;
    lastTargetFilter=searchTerm;
  }
 else {
    components=sourceComponents;
    lastSourceFilter=searchTerm;
  }
  for (  LabeledRectangle c : components) {
    c.filter(searchTerm);
  }
  layoutItems();
  repaint();
}
Program: 85432
Project: 85432
Buggy source:
public List<LabeledRectangle> getVisibleTargetComponents(){
  return getVisibleRectangles(targetComponents);
}

Fixed version (ground truth):
public List<LabeledRectangle> getVisibleTargetComponents(){
  return getVisibleRectangles(cdmComponents);
}
Program: 85433
Project: 85433
Buggy source:
public Dimension getMinimumSize(){
  Dimension dimension=new Dimension();
  dimension.width=2 * (ITEM_WIDTH + MARGIN) + MIN_SPACE_BETWEEN_COLUMNS;
  dimension.height=Math.min(HEADER_HEIGHT + HEADER_TOP_MARGIN + Math.max(sourceComponents.size(),targetComponents.size()) * (ITEM_HEIGHT + MARGIN),maxHeight);
  return dimension;
}

Fixed version (ground truth):
public Dimension getMinimumSize(){
  Dimension dimension=new Dimension();
  dimension.width=2 * (ITEM_WIDTH + MARGIN) + MIN_SPACE_BETWEEN_COLUMNS;
  dimension.height=Math.min(HEADER_HEIGHT + HEADER_TOP_MARGIN + Math.max(sourceComponents.size(),cdmComponents.size()) * (ITEM_HEIGHT + MARGIN),maxHeight);
  return dimension;
}
Program: 85435
Project: 85435
Buggy source:
public void makeMapSelectedSourceAndTarget(){
  for (  LabeledRectangle source : getSelectedRectangles(sourceComponents)) {
    for (    LabeledRectangle target : getSelectedRectangles(targetComponents)) {
      makeMapSourceToTarget(source,target);
    }
  }
}

Fixed version (ground truth):
public void makeMapSelectedSourceAndTarget(){
  for (  LabeledRectangle source : getSelectedRectangles(sourceComponents)) {
    for (    LabeledRectangle target : getSelectedRectangles(cdmComponents)) {
      makeMapSourceToTarget(source,target);
    }
  }
}
Program: 85436
Project: 85436
Buggy source:
private void renderModel(){
  sourceComponents.clear();
  targetComponents.clear();
  arrows.clear();
  for (  MappableItem item : mapping.getSourceItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(255,128,0));
    sourceComponents.add(component);
  }
  for (  MappableItem item : mapping.getTargetItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(128,128,255));
    targetComponents.add(component);
  }
  for (  ItemToItemMap map : mapping.getSourceToTargetMaps()) {
    Arrow component=new Arrow(getComponentWithItem(map.getSourceItem(),sourceComponents),getComponentWithItem(map.getTargetItem(),targetComponents));
    arrows.add(component);
  }
  layoutItems();
  repaint();
}

Fixed version (ground truth):
private void renderModel(){
  sourceComponents.clear();
  cdmComponents.clear();
  arrows.clear();
  for (  MappableItem item : mapping.getSourceItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(255,128,0));
    sourceComponents.add(component);
  }
  for (  MappableItem item : mapping.getTargetItems())   if (!showOnlyConnectedItems || isConnected(item)) {
    LabeledRectangle component=new LabeledRectangle(0,400,ITEM_WIDTH,ITEM_HEIGHT,item,new Color(128,128,255));
    cdmComponents.add(component);
  }
  for (  ItemToItemMap map : mapping.getSourceToTargetMaps()) {
    Arrow component=new Arrow(getComponentWithItem(map.getSourceItem(),sourceComponents),getComponentWithItem(map.getTargetItem(),cdmComponents));
    arrows.add(component);
  }
  layoutItems();
  repaint();
}