nus-yam/ex-repair huggingface dataset:
Program: 171594
Project: 171594
Buggy source:
public BuilderTurn(World world,int x,int y,int z,EnumFacing rotation,TrackType type){
  super(world,x,y,z,rotation);
  int radius=0;
switch (type.getType()) {
case TURN_MEDIUM:
    radius=9;
  break;
case TURN_LARGE:
radius=19;
break;
default :
return;
}
HashSet<Pair<Integer,Integer>> positions=new HashSet<Pair<Integer,Integer>>();
for (int angle=0; angle < 90; angle++) {
int gagX=MathHelper.floor(Math.sin(Math.toRadians(angle)) * radius);
int gagZ=MathHelper.floor(Math.cos(Math.toRadians(angle)) * radius);
positions.add(Pair.of(gagX + 1,gagZ));
positions.add(Pair.of(gagX + 1,gagZ + 1));
positions.add(Pair.of(gagX + 2,gagZ));
}
int xMult=type.getDirection() == TrackDirection.LEFT ? -1 : 1;
int zMult=1;
TrackRail turnTrack=new TrackRail(this,0,0,0,EnumFacing.NORTH,type);
turnTrack.setRotationCenter(xMult * radius,0,0,radius - 1f);
tracks.add(turnTrack);
for (Pair<Integer,Integer> pair : positions) {
int gagX=pair.getLeft() * xMult - xMult * radius;
int gagZ=pair.getRight() * zMult;
if (gagX == 0 && gagZ == 0) {
continue;
}
if (gagX > radius || gagZ > radius) {
continue;
}
tracks.add(new TrackGag(this,gagX,0,gagZ));
}
}

Fixed version (ground truth):
public BuilderTurn(World world,int x,int y,int z,EnumFacing rotation,TrackType type){
  super(world,x,y,z,rotation);
  int radius=0;
switch (type.getType()) {
case TURN_MEDIUM:
    radius=9;
  break;
case TURN_LARGE:
radius=19;
break;
default :
return;
}
HashSet<Pair<Integer,Integer>> positions=new HashSet<Pair<Integer,Integer>>();
for (int angle=0; angle < 90; angle++) {
int gagX=MathHelper.floor(Math.sin(Math.toRadians(angle)) * radius);
int gagZ=MathHelper.floor(Math.cos(Math.toRadians(angle)) * radius);
if (angle > 10 && angle < 80) {
positions.add(Pair.of(gagX,gagZ));
positions.add(Pair.of(gagX + 1,gagZ - 1));
}
positions.add(Pair.of(gagX + 1,gagZ));
positions.add(Pair.of(gagX + 1,gagZ + 1));
positions.add(Pair.of(gagX + 2,gagZ));
}
int xMult=type.getDirection() == TrackDirection.LEFT ? -1 : 1;
int zMult=1;
TrackRail turnTrack=new TrackRail(this,0,0,0,EnumFacing.NORTH,type);
turnTrack.setRotationCenter(xMult * radius,0,0,radius - 1f);
tracks.add(turnTrack);
for (Pair<Integer,Integer> pair : positions) {
int gagX=pair.getLeft() * xMult - xMult * radius;
int gagZ=pair.getRight() * zMult;
if (gagX == 0 && gagZ == 0) {
continue;
}
if (gagX > radius || gagZ > radius) {
continue;
}
tracks.add(new TrackGag(this,gagX,0,gagZ));
}
}
Program: 171595
Project: 171595
Buggy source:
private Object[] extractDataSupplierArgs(final Tuple4<Class<?>,String,ITestContext,Method> metaData){
  return StreamEx.of(extractDataSupplierMetaData(metaData._1,metaData._2).getParameterTypes()).map(t -> Match((Class)t).of(Case($(ITestContext.class),() -> metaData._3),Case($(Method.class),() -> metaData._4),Case($(),p -> {
    throw new IllegalArgumentException(p + "String_Node_Str");
  }
))).toArray();
}

Fixed version (ground truth):
private Object[] extractDataSupplierArgs(final Tuple4<Class<?>,String,ITestContext,Method> metaData){
  final Function<Class,Object> argsMatcher=t -> Match(t).of(Case($(ITestContext.class),() -> metaData._3),Case($(Method.class),() -> metaData._4),Case($(),pt -> {
    throw new IllegalArgumentException(pt + "String_Node_Str");
  }
));
  return StreamEx.of(extractDataSupplierMetaData(metaData._1,metaData._2).getParameterTypes()).map(argsMatcher).toArray();
}
Program: 171601
Project: 171601
Buggy source:
public Command(String opcode,Arg arg1,Arg arg2,Arg arg3,String tag){
  super();
  this.opcode=opcode;
  this.arg1=arg1.dup();
  this.arg2=arg2.dup();
  this.arg3=arg3.dup();
  this.tag=tag;
}

Fixed version (ground truth):
public Command(String opcode,Arg arg1,Arg arg2,Arg arg3,String tag){
  super();
  this.opcode=opcode;
  this.arg1=arg1.dup();
  this.arg2=arg2.dup();
  this.arg3=arg3.dup();
  this.tags.add(tag);
}
Program: 171602
Project: 171602
Buggy source:
public String toString(){
  String res=opcode + "String_Node_Str" + arg1+ "String_Node_Str"+ arg2+ "String_Node_Str"+ arg3+ "String_Node_Str";
  if (tag != null) {
    res+="String_Node_Str" + tag;
  }
  return res;
}

Fixed version (ground truth):
public String toString(){
  String res=opcode + "String_Node_Str" + arg1+ "String_Node_Str"+ arg2+ "String_Node_Str"+ arg3+ "String_Node_Str";
  for (  String tag : tags) {
    res+="String_Node_Str" + tag;
  }
  return res;
}
Program: 171604
Project: 171604
Buggy source:
/** 
 * Main compiler loop Iterates over each statement, identifies the statement type, and then calls a more specialized compiler method
 */
public static void compile(){
  ArrayList<CallStatement> calls=new ArrayList<CallStatement>();
  while (tokens.size() > 0) {
    clearS();
    if (tokens.get(0).equals("String_Node_Str")) {
      compileDef();
    }
 else     if (tokens.get(0).equals("String_Node_Str") || tokens.get(0).equals("String_Node_Str")) {
      compileLoopStart(mainROM);
    }
 else     if (tokens.get(0).equals("String_Node_Str")) {
      compileSub(mainROM);
    }
 else     if (tokens.get(0).equals("String_Node_Str")) {
      compileLoopStop(mainROM);
    }
 else     if (tokens.get(0).equals("String_Node_Str")) {
      CallStatement call=new CallStatement(mainROM.size(),rmStatementTokens());
      Subroutine isLocal=null;
      for (int i=subs.size() - 1; i >= 0; i--) {
        if (subs.get(i).args.contains(call.pointerName())) {
          isLocal=subs.get(i);
        }
      }
      if (isLocal == null) {
        type.put(call.pointerName(),call.subName());
      }
 else {
        isLocal.type.put(call.pointerName(),call.subName());
      }
      calls.add(0,call);
    }
 else {
      compileMove(mainROM);
    }
  }
  for (int i=0; i < calls.size(); i++) {
    clearS();
    compileCall(mainROM,calls.get(i));
  }
}

Fixed version (ground truth):
/** 
 * Main compiler loop Iterates over each statement, identifies the statement type, and then calls a more specialized compiler method
 */
public static void compile(){
  ArrayList<CallStatement> calls=new ArrayList<CallStatement>();
  while (tokens.size() > 0) {
    clearS();
    if (tokens.get(0).equals("String_Node_Str")) {
      CallStatement call=new CallStatement(mainROM.size(),rmStatementTokens());
      Subroutine isLocal=null;
      for (int i=subs.size() - 1; i >= 0; i--) {
        if (subs.get(i).args.contains(call.pointerName())) {
          isLocal=subs.get(i);
        }
      }
      if (isLocal == null) {
        type.put(call.pointerName(),call.subName());
      }
 else {
        isLocal.type.put(call.pointerName(),call.subName());
      }
      calls.add(0,call);
      prevCall=call;
    }
 else {
      if (tokens.get(0).equals("String_Node_Str")) {
        compileDef();
      }
 else       if (tokens.get(0).equals("String_Node_Str") || tokens.get(0).equals("String_Node_Str")) {
        compileLoopStart(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileSub(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileLoopStop(mainROM);
      }
 else {
        compileMove(mainROM);
      }
      prevCall=null;
    }
  }
  for (int i=0; i < calls.size(); i++) {
    clearS();
    compileCall(mainROM,calls.get(i));
  }
}
Program: 171605
Project: 171605
Buggy source:
/** 
 * Appends the loop ending that was computed during loop creation It also handles ELSE statements by creating another loop
 * @param ROM
 */
public static void compileLoopStop(ArrayList<Command> ROM){
  tokens.remove(0);
  OpenLoop loop=loops.remove(0);
  ROM.addAll(loop.commands);
  if (loop.type.equals("String_Node_Str")) {
    if (tokens.get(0).equals("String_Node_Str")) {
      tokens.remove(0);
      OpenLoop loop2=new OpenLoop("String_Node_Str");
      loops.add(0,loop2);
      String oBrace=tokens.remove(0);
      while (!oBrace.equals("String_Node_Str")) {
        loop2.name+="String_Node_Str" + oBrace;
        oBrace=tokens.remove(0);
      }
      ROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + loop2,1),new Arg(address.get(ProgramCounter)),"String_Node_Str" + loop2));
      compileDelaySlots(ROM);
    }
  }
  if (loop.type.equals("String_Node_Str") || loop.type.equals("String_Node_Str") || loop.type.equals("String_Node_Str")) {
    ROM.get(ROM.size() - 1).tag="String_Node_Str" + loop;
  }
  if (loop.type.equals("String_Node_Str")) {
    subs.remove(0);
  }
}

Fixed version (ground truth):
/** 
 * Appends the loop ending that was computed during loop creation It also handles ELSE statements by creating another loop
 * @param ROM
 */
public static void compileLoopStop(ArrayList<Command> ROM){
  tokens.remove(0);
  OpenLoop loop=loops.remove(0);
  ROM.addAll(loop.commands);
  if (loop.type.equals("String_Node_Str")) {
    if (tokens.get(0).equals("String_Node_Str")) {
      tokens.remove(0);
      OpenLoop loop2=new OpenLoop("String_Node_Str");
      loops.add(0,loop2);
      String oBrace=tokens.remove(0);
      while (!oBrace.equals("String_Node_Str")) {
        loop2.name+="String_Node_Str" + oBrace;
        oBrace=tokens.remove(0);
      }
      ROM.add(new Command("String_Node_Str",new Arg(-1),new Arg("String_Node_Str" + loop2,1),new Arg(address.get(ProgramCounter)),"String_Node_Str" + loop2));
      compileDelaySlots(ROM);
    }
  }
  if (loop.type.equals("String_Node_Str") || loop.type.equals("String_Node_Str") || loop.type.equals("String_Node_Str")) {
    if (prevCall == null) {
      ROM.get(ROM.size() - 1).tags.add("String_Node_Str" + loop);
    }
 else {
      prevCall.tags.add("String_Node_Str" + loop);
    }
  }
  if (loop.type.equals("String_Node_Str")) {
    subs.remove(0);
  }
}
Program: 171608
Project: 171608
Buggy source:
public CallStatement(int loc,ArrayList<String> statement){
  super();
  this.loc=loc;
  this.statement=statement;
  this.cursubs=new ArrayList<Subroutine>();
  cursubs.addAll(subs);
}

Fixed version (ground truth):
public CallStatement(int loc,ArrayList<String> statement){
  super();
  this.loc=loc;
  this.statement=statement;
  cursubs.addAll(subs);
}
Program: 171609
Project: 171609
Buggy source:
/** 
 * Optimize individual commands for speed
 */
static void simplify(){
  for (  Command c : mainROM) {
    c.simplify();
  }
  for (int i=0; i < mainROM.size() - 1; i++) {
    Command c=mainROM.get(i);
    if (c.isEquivalent("String_Node_Str",0,-1,0,null,0,0)) {
      Command d=mainROM.get(i + 1);
      if (d.isEquivalent("String_Node_Str",0,0,0,0,0,0)) {
        if (c.arg2.val < mainROM.size()) {
          mainROM.set(i + 1,mainROM.get(c.arg2.val).dupWithoutTags());
          c.arg2.val++;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Optimize individual commands for speed
 */
static void simplify(){
  for (  Command c : mainROM) {
    c.simplify();
  }
  for (int i=0; i < mainROM.size() - 1; i++) {
    Command c=mainROM.get(i);
    if (c.isEquivalent("String_Node_Str",0,-1,0,null,0,0)) {
      Command d=mainROM.get(i + 1);
      if (d.isEquivalent("String_Node_Str",0,0,0,0,0,0)) {
        if (c.arg2.val < mainROM.size()) {
          Command replacement=mainROM.get(c.arg2.val).dupWithoutTags();
          replacement.tags.addAll(d.tags);
          mainROM.set(i + 1,replacement);
          c.arg2.val++;
        }
      }
    }
  }
}
Program: 171610
Project: 171610
Buggy source:
@Override public HttpContent readChunk(ChannelHandlerContext ctx) throws Exception {
  return queue.poll();
}

Fixed version (ground truth):
public HttpContent readChunk(ChannelHandlerContext ctx) throws Exception {
  return queue.poll();
}
Program: 171611
Project: 171611
Buggy source:
@Override public boolean isEndOfInput() throws Exception {
  return false;
}

Fixed version (ground truth):
public boolean isEndOfInput() throws Exception {
  return false;
}
Program: 171612
Project: 171612
Buggy source:
@Override public void close() throws Exception {
}

Fixed version (ground truth):
public void close() throws Exception {
}
Program: 171613
Project: 171613
Buggy source:
@Override public void afterPropertiesSet() throws Exception {
  try {
    String classpath=Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getPath();
    String proxoolPath=classpath + "String_Node_Str";
    JAXPConfigurator.configure(proxoolPath,false);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void afterPropertiesSet() throws Exception {
  try {
    String classpath=Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getPath();
    String proxoolPath=classpath + "String_Node_Str";
    JAXPConfigurator.configure(proxoolPath,false);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 171614
Project: 171614
Buggy source:
@Bean @Primary protected ResourceServerTokenServices resourceServerTokenServices(TokenStore tokenStore,OktaOAuth2Properties properties){
  DefaultTokenServices services=new Non500ErrorDefaultTokenServices(properties.getAudience());
  services.setTokenStore(tokenStore);
  return services;
}

Fixed version (ground truth):
@Bean @Primary protected ResourceServerTokenServices resourceServerTokenServices(TokenStore tokenStore,OktaOAuth2Properties properties){
  DefaultTokenServices services=new CodeFlowAudienceValidatingTokenServices(properties.getAudience());
  services.setTokenStore(tokenStore);
  return services;
}
Program: 171615
Project: 171615
Buggy source:
@Bean @Primary protected ResourceServerTokenServices resourceServerTokenServices(TokenStore tokenStore){
  DefaultTokenServices services=new Non500ErrorDefaultTokenServices();
  services.setTokenStore(tokenStore);
  return services;
}

Fixed version (ground truth):
@Bean @Primary protected ResourceServerTokenServices resourceServerTokenServices(TokenStore tokenStore,OktaOAuth2Properties properties){
  DefaultTokenServices services=new ImplicitAudienceValidatingTokenServices(properties.getAudience());
  services.setTokenStore(tokenStore);
  return services;
}
Program: 171616
Project: 171616
Buggy source:
/** 
 * Decide whether to pass the update to the associated   {@link Listener}
 * @param oldState old state
 * @param newState new state
 * @return {@code true} if the component or listener should be notified, {@link false} if not
 */
boolean filter(@NonNull E oldState,@NonNull E newState);

Fixed version (ground truth):
/** 
 * Decide whether to pass the update to the associated   {@link Listener}
 * @param oldState old state
 * @param newState new state
 * @return {@code true} if the component or listener should be notified, {@code false} otherwise
 */
boolean filter(@NonNull E oldState,@NonNull E newState);
Program: 171617
Project: 171617
Buggy source:
/** 
 * Called before an   {@link Action} gets passed to the {@link Reducer}s. <p> Examples: Log state changes: <pre> void onAction(...) { State oldState = state.getState(); continuation.next(action); State newState = state.getState(); System.out.println(stateDiff(oldState, newState)); } </pre> Consume an   {@link Action} and dispatch it on a background thread:<pre> void onAction(...) { if(action.getData() instanceof AsyncAction) { // consume action backgroundTask.start(action.getData, dispatcher); } else { continuation.next(action); } } </pre> </p>
 * @param action a dispatched action
 * @param state access to the current state
 * @param dispatcher access to the dispatcher for dispatching a new action
 * @param continuation callback for passing the action to the next middleware
 */
void onAction(@NonNull Action<?> action,@NonNull GetState state,@NonNull Dispatcher dispatcher,@NonNull Continuation continuation);

Fixed version (ground truth):
/** 
 * Called before an   {@link Action} gets passed to the {@link Reducer}s. <p> Examples: Log state changes: <pre> void onAction(...) { State oldState = state.getState(); continuation.next(action); State newState = state.getState(); System.out.println(stateDiff(oldState, newState)); } </pre> Consume an   {@link Action} and dispatch it on a background thread:<pre> void onAction(...) { if(action.getData() instanceof AsyncAction) { // consume action backgroundTask.start(action.getData, dispatcher); } else { continuation.next(action); } } </pre>
 * @param action a dispatched action
 * @param state access to the current state
 * @param dispatcher access to the dispatcher for dispatching a new action
 * @param continuation callback for passing the action to the next middleware
 */
void onAction(@NonNull Action<?> action,@NonNull GetState state,@NonNull Dispatcher dispatcher,@NonNull Continuation continuation);
Program: 171618
Project: 171618
Buggy source:
/** 
 * Resets the full internal state with a new state and notifies all registered   {@link Listener}
 * @param state the new state
 * @return a subscription for managing the listener's lifecycle
 */
void reset(@NonNull State state);

Fixed version (ground truth):
/** 
 * Resets the full internal state with a new state and notifies all registered   {@link Listener}
 * @param state the new state
 */
void reset(@NonNull State state);
Program: 171619
Project: 171619
Buggy source:
/** 
 * Configure the   {@link Store} with a non empty {@link State}
 * @param state an initial state
 */
public Builder withInitialState(@NonNull State state){
  assertArgumentsNotNull(state,"String_Node_Str");
  this.state=state;
  return this;
}

Fixed version (ground truth):
/** 
 * Configure the   {@link Store} with a non empty {@link State}
 * @param state an initial state
 * @return a instance of {@link Builder} for further configuration
 */
public Builder withInitialState(@NonNull State state){
  assertArgumentsNotNull(state,"String_Node_Str");
  this.state=state;
  return this;
}
Program: 171620
Project: 171620
Buggy source:
/** 
 * Configure the   {@link Store} with one or many {@link Middleware}
 * @param middleware a list of {@link Middleware}
 */
public Builder withMiddleware(@NonNull Middleware... middleware){
  assertArgumentsNotNull(middleware,"String_Node_Str");
  this.middleware=Arrays.asList(middleware);
  return this;
}

Fixed version (ground truth):
/** 
 * Configure the   {@link Store} with one or many {@link Middleware}
 * @param middleware a list of {@link Middleware}
 * @return a instance of {@link Builder} for further configuration
 */
public Builder withMiddleware(@NonNull Middleware... middleware){
  assertArgumentsNotNull(middleware,"String_Node_Str");
  this.middleware=Arrays.asList(middleware);
  return this;
}
Program: 171621
Project: 171621
Buggy source:
/** 
 * Creates an instance   {@link Store} with the provided options.
 * @return a new store
 */
public Store build(){
  final CombinedReducer combinedReducer=new CombinedReducer(reducers);
  final CombinedMiddleware combinedMiddleware=new CombinedMiddleware(middleware);
  final State initialState=State.mergeStates(combinedReducer.getEmptyState(),state);
  final Executor executor=getExecutor();
  return new SuasStore(initialState,combinedReducer,combinedMiddleware,notifier,executor);
}

Fixed version (ground truth):
/** 
 * Creates an instance   {@link Store} with the provided options.
 * @return a new {@link Store}
 */
public Store build(){
  final CombinedReducer combinedReducer=new CombinedReducer(reducers);
  final CombinedMiddleware combinedMiddleware=new CombinedMiddleware(middleware);
  final State initialState=State.mergeStates(combinedReducer.getEmptyState(),state);
  final Executor executor=getExecutor();
  return new SuasStore(initialState,combinedReducer,combinedMiddleware,notifier,executor);
}
Program: 171622
Project: 171622
Buggy source:
/** 
 * Configure the   {@link Store} with a default {@link Filter}. <p> Default:   {@link Filters#DEFAULT}</p>
 * @param filter a custom default filter
 */
public Builder withDefaultFilter(Filter<Object> filter){
  assertArgumentsNotNull(filter,"String_Node_Str");
  this.notifier=filter;
  return this;
}

Fixed version (ground truth):
/** 
 * Configure the   {@link Store} with a default {@link Filter}. <p> Default:   {@link Filters#DEFAULT}</p>
 * @param filter a custom default filter
 * @return a instance of {@link Builder} for further configuration
 */
public Builder withDefaultFilter(Filter<Object> filter){
  assertArgumentsNotNull(filter,"String_Node_Str");
  this.notifier=filter;
  return this;
}
Program: 171623
Project: 171623
Buggy source:
/** 
 * Enable/disable debugging over ADB.
 */
@NonNull public Builder withEnableAdb(boolean enableAdb){
  this.enableAdb=enableAdb;
  return this;
}

Fixed version (ground truth):
/** 
 * Enable/disable debugging over ADB.
 * @param enableAdb true for enabling ADB, false otherwise.
 */
@NonNull public Builder withEnableAdb(boolean enableAdb){
  this.enableAdb=enableAdb;
  return this;
}
Program: 171624
Project: 171624
Buggy source:
/** 
 * Enable/disable debugging over the network/bonjour.
 */
@NonNull public Builder withEnableBonjour(boolean enableBonjour){
  this.enableBonjour=enableBonjour;
  return this;
}

Fixed version (ground truth):
/** 
 * Enable/disable debugging over the network/bonjour.
 * @param enableBonjour true for enabling Bonjour, false otherwise.
 */
@NonNull public Builder withEnableBonjour(boolean enableBonjour){
  this.enableBonjour=enableBonjour;
  return this;
}
Program: 171625
Project: 171625
Buggy source:
private void applyDefaultViewOn(RemoteViews remoteViews){
  remoteViews.setTextColor(R.id.widget_todo_list_item_title,context.getResources().getColor(R.color.dark_gray));
  remoteViews.setImageViewResource(R.id.widget_todo_list_item_details,R.drawable.ic_lightbulb_outline_gray_24dp);
}

Fixed version (ground truth):
private void applyDefaultViewOn(RemoteViews remoteViews){
  remoteViews.setTextColor(R.id.widget_todo_list_item_title,context.getResources().getColor(R.color.dark_gray));
  remoteViews.setImageViewResource(R.id.widget_todo_list_item_details,R.drawable.ic_lightbulb_outline_gray_24dp);
  remoteViews.setViewVisibility(R.id.widget_todo_list_item_details,GONE);
}
Program: 171626
Project: 171626
Buggy source:
@Override public RemoteViews getViewAt(int position){
  if (position >= itemList.size())   return null;
  RemoteViews remoteViews;
  BaseModel listItem=itemList.get(position);
  if (listItem instanceof TodoListItem) {
    remoteViews=setupItem((TodoListItem)listItem);
  }
 else {
    remoteViews=setupHeader((TodoListHeader)listItem);
  }
  return remoteViews;
}

Fixed version (ground truth):
@Override public RemoteViews getViewAt(int position){
  if (position >= itemList.size())   return null;
  BaseModel listItem=itemList.get(position);
  if (listItem instanceof TodoListHeader) {
    return remoteViewsFor((TodoListHeader)listItem);
  }
  return remoteViewsFor((TodoListItem)listItem);
}
Program: 171627
Project: 171627
Buggy source:
@Override public void onItemMove(int fromPosition,int toPosition){
  AbstractFlexibleItem draggedItem=mAdapter.getItem(toPosition);
  AbstractFlexibleItem movedItem=mAdapter.getItem(fromPosition);
  if (draggedItem instanceof TodoListItemViewModel && movedItem instanceof TodoListHeaderViewModel) {
    TodoListHeaderViewModel newHeader=(TodoListHeaderViewModel)mAdapter.getHeaderOf(draggedItem);
    TodoListHeaderViewModel oldHeader=mAdapter.evaluateOldHeader(fromPosition,toPosition);
    int location=mAdapter.evaluateDistanceToHeader(draggedItem);
    oldHeader.removeSubItem((TodoListItemViewModel)draggedItem);
    newHeader.addSubItem(location,(TodoListItemViewModel)draggedItem);
  }
}

Fixed version (ground truth):
@Override public void onItemMove(int fromPosition,int toPosition){
  AbstractFlexibleItem draggedItem=mAdapter.getItem(toPosition);
  AbstractFlexibleItem movedItem=mAdapter.getItem(fromPosition);
  if (draggedItem instanceof TodoListItemViewModel && movedItem instanceof TodoListHeaderViewModel) {
    TodoListHeaderViewModel newHeader=(TodoListHeaderViewModel)mAdapter.getHeaderOf(draggedItem);
    TodoListHeaderViewModel oldHeader=mAdapter.evaluateOldHeader(fromPosition,toPosition);
    int location=mAdapter.evaluateDistanceToHeader(draggedItem);
    oldHeader.removeSubItem((TodoListItemViewModel)draggedItem);
    newHeader.addSubItem(location,(TodoListItemViewModel)draggedItem);
    newHeader.setExpanded(true);
    mAdapter.updateItem(newHeader);
  }
}
Program: 171628
Project: 171628
Buggy source:
public static CharSequence stripHtml(String html){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
    return Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY);
  }
 else {
    return Html.fromHtml(html);
  }
}

Fixed version (ground truth):
public static String stripHtml(String html){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
    return Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY).toString();
  }
 else {
    return Html.fromHtml(html).toString();
  }
}
Program: 171629
Project: 171629
Buggy source:
private void copyDetailsToClipboard(){
  copyToClipboard(stripHtml(richEditor.getHtml()).toString());
}

Fixed version (ground truth):
private void copyDetailsToClipboard(){
  String html=richEditor.getHtml();
  copyToClipboard(stripHtml((html != null) ? html : "String_Node_Str"));
}
Program: 171630
Project: 171630
Buggy source:
@Override public void onDestroyActionMode(ActionMode mode){
  changeAppbarColor(getActivity(),R.color.colorPrimary);
  for (  IHeader header : mAdapter.getHeaderItems()) {
    TodoListHeaderViewModel vm=(TodoListHeaderViewModel)header;
    boolean shouldExpand=vm.getHeader().isExpanded();
    if (shouldExpand)     mAdapter.expand(vm);
  }
}

Fixed version (ground truth):
@Override public void onDestroyActionMode(ActionMode mode){
  changeAppbarColor(getActivity(),R.color.colorPrimary);
  for (  IHeader header : mAdapter.getHeaderItems()) {
    TodoListHeaderViewModel vm=(TodoListHeaderViewModel)header;
    boolean shouldExpand=vm.getHeader().isExpanded();
    if (shouldExpand && !omitActionModeExpansion)     mAdapter.expand(vm);
  }
}
Program: 171631
Project: 171631
Buggy source:
@Override public void onTodoListLoaded(List<AbstractFlexibleItem> items){
  boolean permanentDelete=!sharedPreferences.getBoolean(KEY_PREF_HEADER_OR_ITEM,true);
  if (mAdapter == null || mAdapter.getItemCount() == 0) {
    mAdapter=new SectionableAdapter(items);
    mRecyclerView.configure(mEmptyView,mAdapter,mFabMenu);
    mAdapter.setLongPressDragEnabled(true);
    setupFlexibleAdapter(this,mAdapter,permanentDelete);
    initializeActionModeHelper();
  }
 else {
    mAdapter.updateDataSet(items);
  }
}

Fixed version (ground truth):
@Override public void onTodoListLoaded(List<AbstractFlexibleItem> items){
  boolean permanentDelete=!sharedPreferences.getBoolean(KEY_PREF_HEADER_OR_ITEM,true);
  if (mAdapter == null || mAdapter.getItemCount() == 0) {
    mAdapter=new SectionableAdapter(items);
    mRecyclerView.configure(mEmptyView,mAdapter,mFabMenu);
    mAdapter.setLongPressDragEnabled(true);
    mAdapter.setHandleDragEnabled(true);
    setupFlexibleAdapter(this,mAdapter,permanentDelete);
    initializeActionModeHelper();
  }
 else {
    mAdapter.updateDataSet(items);
  }
}
Program: 171632
Project: 171632
Buggy source:
@Override public void onItemLongClick(int position){
  mAdapter.clearSelection();
  if (mAdapter.getItem(position) instanceof TodoListHeaderViewModel) {
    mActionModeHelper.onLongClick((AppCompatActivity)getActivity(),position);
  }
}

Fixed version (ground truth):
@Override public void onItemLongClick(int position){
  if (mAdapter.getItem(position) instanceof TodoListHeaderViewModel) {
    mPresenter.syncTodoList(mAdapter);
    omitActionModeExpansion=true;
    mActionModeHelper.destroyActionModeIfCan();
    omitActionModeExpansion=false;
    mActionModeHelper.onLongClick((AppCompatActivity)getActivity(),position);
  }
 else {
    mAdapter.clearSelection();
  }
}
Program: 171633
Project: 171633
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_item,container,false);
  InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  mUnbinder=ButterKnife.bind(this,view);
  final RichEditorNavigation richEditorNavigation=new RichEditorNavigation(view,richEditor);
  richEditorNavigation.setupRichEditor();
  richEditorNavigation.setupOnClickListeners();
  saveButton.setOnClickListener(this);
  copyTitleButton.setOnClickListener(this);
  copyDetailsButton.setOnClickListener(this);
  inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
  titleEditText.requestFocus();
  loadItems();
  configureAppbar(getActivity(),true);
  changeAppbarTitle(getActivity(),isEditMode() ? R.string.fragment_edit_item : R.string.add_item);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_item,container,false);
  InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  mUnbinder=ButterKnife.bind(this,view);
  final RichEditorNavigation richEditorNavigation=new RichEditorNavigation(view,richEditor);
  richEditorNavigation.setupRichEditor();
  richEditorNavigation.setupOnClickListeners();
  saveButton.setOnClickListener(this);
  copyTitleButton.setOnClickListener(this);
  copyDetailsButton.setOnClickListener(this);
  configureAppbar(getActivity(),true);
  changeAppbarTitle(getActivity(),isEditMode() ? R.string.fragment_edit_item : R.string.add_item);
  if (savedInstanceState == null) {
    inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
    titleEditText.requestFocus();
    loadItems();
  }
  return view;
}
Program: 171634
Project: 171634
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  SharedPreferences sharedPreferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  String repositoryName=sharedPreferences.getString(KEY_PREF_ACTIVE_REPO,FALLBACK_REALM);
  mPresenter=new DisplayNotePresenterImpl(ThreadExecutor.getInstance(),MainThreadImpl.getInstance(),this,new RepositoryImpl(repositoryName));
  Bundle bundle=getArguments();
  if (bundle != null) {
    uuid=bundle.getString(KEY_UUID);
    title=bundle.getString(KEY_TITLE);
  }
  mPresenter.loadNote(uuid);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  SharedPreferences sharedPreferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  String repositoryName=sharedPreferences.getString(KEY_PREF_ACTIVE_REPO,FALLBACK_REALM);
  mPresenter=new DisplayNotePresenterImpl(ThreadExecutor.getInstance(),MainThreadImpl.getInstance(),this,new RepositoryImpl(repositoryName));
  Bundle bundle=getArguments();
  if (bundle != null) {
    uuid=bundle.getString(KEY_UUID);
    title=bundle.getString(KEY_TITLE);
  }
}
Program: 171635
Project: 171635
Buggy source:
@Override public void onPause(){
  super.onPause();
  saveNoteToRepository();
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  inputManager.hideSoftInputFromWindow(getView().getWindowToken(),0);
  saveNoteToRepository();
}
Program: 171636
Project: 171636
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_note,container,false);
  mUnbinder=ButterKnife.bind(this,view);
  saveButton.setOnClickListener(this);
  final RichEditorNavigation richEditorNavigation=new RichEditorNavigation(view,richEditor);
  richEditorNavigation.setupRichEditor();
  richEditorNavigation.setupOnClickListeners();
  configureAppbar(getActivity(),true);
  changeAppbarTitle(getActivity(),title);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_note,container,false);
  mUnbinder=ButterKnife.bind(this,view);
  saveButton.setOnClickListener(this);
  final RichEditorNavigation richEditorNavigation=new RichEditorNavigation(view,richEditor);
  richEditorNavigation.setupRichEditor();
  richEditorNavigation.setupOnClickListeners();
  configureAppbar(getActivity(),true);
  changeAppbarTitle(getActivity(),title);
  if (savedInstanceState == null) {
    mPresenter.loadNote(uuid);
  }
  return view;
}
Program: 171637
Project: 171637
Buggy source:
@Override public void onPause(){
  super.onPause();
  if (mAdapter != null) {
    onDeleteConfirmed(0);
    mPresenter.syncPreviews(new ArrayList<>(mAdapter.getCurrentItems()));
  }
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  inputManager.hideSoftInputFromWindow(getView().getWindowToken(),0);
  if (mAdapter != null) {
    onDeleteConfirmed(0);
    mPresenter.syncPreviews(new ArrayList<>(mAdapter.getCurrentItems()));
  }
}
Program: 171638
Project: 171638
Buggy source:
@Override public void onPause(){
  super.onPause();
  if (mActionModeHelper != null)   mActionModeHelper.destroyActionModeIfCan();
  if (mAdapter != null) {
    onDeleteConfirmed(0);
    mPresenter.syncTodoList(mAdapter);
  }
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  inputManager.hideSoftInputFromWindow(getView().getWindowToken(),0);
  if (mActionModeHelper != null)   mActionModeHelper.destroyActionModeIfCan();
  if (mAdapter != null) {
    onDeleteConfirmed(0);
    mPresenter.syncTodoList(mAdapter);
  }
}
Program: 171639
Project: 171639
Buggy source:
private void fillRealm(){
  final TodoListDAO todoListDAO=new TodoListDAO("String_Node_Str","String_Node_Str",0,0,0);
  final TodoListHeaderDAO headerDAO=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  final TodoListHeaderDAO headerDAO2=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO2=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  final TodoListItemDAO itemDAO3=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  realm.executeTransaction(new Realm.Transaction(){
    @Override public void execute(    Realm realm){
      realm.copyToRealm(todoListDAO);
      realm.copyToRealm(headerDAO);
      realm.copyToRealm(headerDAO2);
      realm.copyToRealm(itemDAO);
      realm.copyToRealm(itemDAO2);
      realm.copyToRealm(itemDAO3);
    }
  }
);
}

Fixed version (ground truth):
private void fillRealm(){
  final TodoListDAO todoListDAO=new TodoListDAO("String_Node_Str","String_Node_Str",0,0,0);
  final TodoListHeaderDAO headerDAO=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  final TodoListHeaderDAO headerDAO2=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO2=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  final TodoListItemDAO itemDAO3=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  realm.executeTransaction(new Realm.Transaction(){
    @Override public void execute(    Realm realm){
      realm.copyToRealm(todoListDAO);
      realm.copyToRealm(headerDAO);
      realm.copyToRealm(headerDAO2);
      realm.copyToRealm(itemDAO);
      realm.copyToRealm(itemDAO2);
      realm.copyToRealm(itemDAO3);
    }
  }
);
}
Program: 171640
Project: 171640
Buggy source:
@Test public void testUpdateHeader() throws InterruptedException {
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  repository.insert(header);
  Thread.sleep(200);
  repository.update(header.update("String_Node_Str",0,new Color(0),"String_Node_Str"));
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertEquals(header.getCreatedAt(),fromDb.getCreatedAt());
  assertNotEquals(header.getChangedAt(),fromDb.getChangedAt());
  assertNotEquals(header.getTitle(),fromDb.getTitle());
}

Fixed version (ground truth):
@Test public void testUpdateHeader() throws InterruptedException {
  TodoListHeader header=createHeader();
  repository.insert(header);
  Thread.sleep(200);
  repository.update(header.update("String_Node_Str",0,"String_Node_Str"));
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertEquals(header.getCreatedAt(),fromDb.getCreatedAt());
  assertNotEquals(header.getChangedAt(),fromDb.getChangedAt());
  assertNotEquals(header.getTitle(),fromDb.getTitle());
}
Program: 171641
Project: 171641
Buggy source:
@Test public void testDeleteHeaderNotExisting(){
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  repository.delete(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertNull(fromDb);
}

Fixed version (ground truth):
@Test public void testDeleteHeaderNotExisting(){
  TodoListHeader header=createHeader();
  repository.delete(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertNull(fromDb);
}
Program: 171642
Project: 171642
Buggy source:
@Test public void testUpdateItemAsInsert(){
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.update(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertEquals(item,fromDb);
}

Fixed version (ground truth):
@Test public void testUpdateItemAsInsert(){
  TodoListItem item=new TodoListItem("String_Node_Str",0,false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.update(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertEquals(item,fromDb);
}
Program: 171643
Project: 171643
Buggy source:
@Test public void testTodoListItemInsert(){
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  boolean success=repository.insert(item);
  assertTrue(success);
  TodoListItemDAO dao=realm.where(TodoListItemDAO.class).equalTo("String_Node_Str",item.getUuid()).findFirst();
  assertNotNull(dao);
}

Fixed version (ground truth):
@Test public void testTodoListItemInsert(){
  TodoListItem item=createItem();
  boolean success=repository.insert(item);
  assertTrue(success);
  TodoListItemDAO dao=realm.where(TodoListItemDAO.class).equalTo("String_Node_Str",item.getUuid()).findFirst();
  assertNotNull(dao);
}
Program: 171644
Project: 171644
Buggy source:
@Test public void testUpdateItem() throws InterruptedException {
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.insert(item);
  Thread.sleep(200);
  repository.update(item.update("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str"));
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertEquals(item.getCreatedAt(),fromDb.getCreatedAt());
  assertNotEquals(item.getChangedAt(),fromDb.getChangedAt());
  assertNotEquals(item.getTitle(),fromDb.getTitle());
}

Fixed version (ground truth):
@Test public void testUpdateItem() throws InterruptedException {
  TodoListItem item=createItem();
  repository.insert(item);
  Thread.sleep(200);
  repository.update(item.update("String_Node_Str",0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str"));
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertEquals(item.getCreatedAt(),fromDb.getCreatedAt());
  assertNotEquals(item.getChangedAt(),fromDb.getChangedAt());
  assertNotEquals(item.getTitle(),fromDb.getTitle());
}
Program: 171645
Project: 171645
Buggy source:
@Test public void testItemDelete(){
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.insert(item);
  repository.delete(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertNull(fromDb);
}

Fixed version (ground truth):
@Test public void testItemDelete(){
  TodoListItem item=createItem();
  repository.insert(item);
  repository.delete(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertNull(fromDb);
}
Program: 171646
Project: 171646
Buggy source:
private void fillRealm(){
  final TodoListDAO todoListDAO=new TodoListDAO("String_Node_Str","String_Node_Str",0,0,0);
  final TodoListHeaderDAO headerDAO=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  final TodoListHeaderDAO headerDAO2=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO2=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  final TodoListItemDAO itemDAO3=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,new DeadlineDAO(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  realm.executeTransaction(new Realm.Transaction(){
    @Override public void execute(    Realm realm){
      realm.copyToRealm(todoListDAO);
      realm.copyToRealm(headerDAO);
      realm.copyToRealm(headerDAO2);
      realm.copyToRealm(itemDAO);
      realm.copyToRealm(itemDAO2);
      realm.copyToRealm(itemDAO3);
    }
  }
);
}

Fixed version (ground truth):
private void fillRealm(){
  final TodoListDAO todoListDAO=new TodoListDAO("String_Node_Str","String_Node_Str",0,0,0);
  final TodoListHeaderDAO headerDAO=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  final TodoListHeaderDAO headerDAO2=new TodoListHeaderDAO("String_Node_Str","String_Node_Str",0,0,0,"String_Node_Str");
  final TodoListItemDAO itemDAO2=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  final TodoListItemDAO itemDAO3=new TodoListItemDAO("String_Node_Str","String_Node_Str",0,0,0,false,"String_Node_Str",false,"String_Node_Str","String_Node_Str");
  realm.executeTransaction(new Realm.Transaction(){
    @Override public void execute(    Realm realm){
      realm.copyToRealm(todoListDAO);
      realm.copyToRealm(headerDAO);
      realm.copyToRealm(headerDAO2);
      realm.copyToRealm(itemDAO);
      realm.copyToRealm(itemDAO2);
      realm.copyToRealm(itemDAO3);
    }
  }
);
}
Program: 171647
Project: 171647
Buggy source:
@Test public void testTodoListItemInsertTwice(){
  clearRealm();
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.insert(item);
  boolean success=repository.insert(item);
  assertFalse(success);
  TodoListItemDAO dao=realm.where(TodoListItemDAO.class).equalTo("String_Node_Str",item.getUuid()).findFirst();
  assertNotNull(dao);
  fillRealm();
}

Fixed version (ground truth):
@Test public void testTodoListItemInsertTwice(){
  clearRealm();
  TodoListItem item=createItem();
  repository.insert(item);
  boolean success=repository.insert(item);
  assertFalse(success);
  TodoListItemDAO dao=realm.where(TodoListItemDAO.class).equalTo("String_Node_Str",item.getUuid()).findFirst();
  assertNotNull(dao);
  fillRealm();
}
Program: 171648
Project: 171648
Buggy source:
@Test public void testHeaderDelete(){
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  repository.insert(header);
  repository.delete(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertNull(fromDb);
}

Fixed version (ground truth):
@Test public void testHeaderDelete(){
  TodoListHeader header=createHeader();
  repository.insert(header);
  repository.delete(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertNull(fromDb);
}
Program: 171649
Project: 171649
Buggy source:
@Test public void testUpdateHeaderAsInsert(){
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  repository.update(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertEquals(header,fromDb);
}

Fixed version (ground truth):
@Test public void testUpdateHeaderAsInsert(){
  TodoListHeader header=createHeader();
  repository.update(header);
  TodoListHeader fromDb=repository.getHeaderById(header.getUuid());
  assertEquals(header,fromDb);
}
Program: 171650
Project: 171650
Buggy source:
@Test public void testTodoListHeaderInsert(){
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  boolean success=repository.insert(header);
  assertTrue(success);
  TodoListHeaderDAO dao=realm.where(TodoListHeaderDAO.class).equalTo("String_Node_Str",header.getUuid()).findFirst();
  assertNotNull(dao);
}

Fixed version (ground truth):
@Test public void testTodoListHeaderInsert(){
  TodoListHeader header=createHeader();
  boolean success=repository.insert(header);
  assertTrue(success);
  TodoListHeaderDAO dao=realm.where(TodoListHeaderDAO.class).equalTo("String_Node_Str",header.getUuid()).findFirst();
  assertNotNull(dao);
}
Program: 171651
Project: 171651
Buggy source:
@Test public void testTodoListHeaderInsertTwice(){
  clearRealm();
  TodoListHeader header=new TodoListHeader("String_Node_Str",0,new Color(0),"String_Node_Str");
  repository.insert(header);
  boolean success=repository.insert(header);
  assertFalse(success);
  TodoListHeaderDAO dao=realm.where(TodoListHeaderDAO.class).equalTo("String_Node_Str",header.getUuid()).findFirst();
  assertNotNull(dao);
  fillRealm();
}

Fixed version (ground truth):
@Test public void testTodoListHeaderInsertTwice(){
  clearRealm();
  TodoListHeader header=createHeader();
  repository.insert(header);
  boolean success=repository.insert(header);
  assertFalse(success);
  TodoListHeaderDAO dao=realm.where(TodoListHeaderDAO.class).equalTo("String_Node_Str",header.getUuid()).findFirst();
  assertNotNull(dao);
  fillRealm();
}
Program: 171652
Project: 171652
Buggy source:
@Test public void testDeleteItemNotExisting(){
  TodoListItem item=new TodoListItem("String_Node_Str",0,new Deadline(),false,"String_Node_Str","String_Node_Str","String_Node_Str");
  repository.delete(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertNull(fromDb);
}

Fixed version (ground truth):
@Test public void testDeleteItemNotExisting(){
  TodoListItem item=createItem();
  repository.delete(item);
  TodoListItem fromDb=repository.getItemById(item.getUuid());
  assertNull(fromDb);
}
Program: 171653
Project: 171653
Buggy source:
public AddHeaderInteractorImpl(Executor threadExecutor,MainThread mainThread,Callback callback,TodoListRepository repository,String title,int position,Color color,String parentTodoListUuid){
  super(threadExecutor,mainThread);
  this.callback=callback;
  this.repository=repository;
  this.title=title;
  this.position=position;
  this.color=color;
  this.parentTodoListUuid=parentTodoListUuid;
}

Fixed version (ground truth):
public AddHeaderInteractorImpl(Executor threadExecutor,MainThread mainThread,Callback callback,TodoListRepository repository,String title,int position,String parentTodoListUuid){
  super(threadExecutor,mainThread);
  this.callback=callback;
  this.repository=repository;
  this.title=title;
  this.position=position;
  this.parentTodoListUuid=parentTodoListUuid;
}