nus-yam/ex-repair huggingface dataset:
Program: 39975
Project: 39975
Buggy source:
private void closeBrace(Integer pos,Character currentPrev,Character prevAtRebuilded,Stack<Character> temp) throws ParsingException {
  if (currentPrev == '(') {
    throw new ParsingException("String_Node_Str");
  }
  if (temp.peek() == '#') {
    throw new ParsingException("String_Node_Str");
  }
  if (temp.peek() == '(') {
    currentPrev=')';
    pos++;
    temp.pop();
  }
 else {
    if (NUMBERS.indexOf(prevAtRebuilded) != -1) {
      rebuildedExpression=rebuildedExpression.concat("String_Node_Str");
    }
    prevAtRebuilded=' ';
    rebuildedExpression=rebuildedExpression.concat(temp.pop() + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void closeBrace(Stack<Character> temp) throws ParsingException {
  if (currentPrev == '(') {
    throw new ParsingException("String_Node_Str");
  }
  if (temp.peek() == '#') {
    throw new ParsingException("String_Node_Str");
  }
  if (temp.peek() == '(') {
    currentPrev=')';
    pos++;
    temp.pop();
  }
 else {
    if (NUMBERS.indexOf(prevAtRebuilded) != -1) {
      rebuildedExpression=rebuildedExpression.concat("String_Node_Str");
    }
    prevAtRebuilded=' ';
    rebuildedExpression=rebuildedExpression.concat(temp.pop() + "String_Node_Str");
  }
}
Program: 39977
Project: 39977
Buggy source:
/** 
 * Initializes Evaluator and creates it's inner state
 * @param rpnExpression_ expression in Reverse Polish Notation
 * @return {@code Evaluator} object
 */
Evaluator(String rpnExpression_){
  rpnExpression=rpnExpression_;
  rpnStack=new java.util.Stack<>();
}

Fixed version (ground truth):
/** 
 * Initializes Evaluator and creates it's inner state
 * @param rpnExpr expression in Reverse Polish Notation
 * @return {@code Evaluator} object
 */
Evaluator(String rpnExpr){
  rpnExpression=rpnExpr;
  rpnStack=new java.util.Stack<>();
}
Program: 39978
Project: 39978
Buggy source:
@Override public double calculate(String expression) throws ParsingException {
  if (expression == null) {
    throw new ParsingException("String_Node_Str");
  }
 else {
    Parser LocalParser=new Parser(expression);
    String rpnExpression=LocalParser.parseRPN();
    Evaluator Evaluator=new Evaluator(rpnExpression);
    return Evaluator.evaluateRPN();
  }
}

Fixed version (ground truth):
@Override public double calculate(String expression) throws ParsingException {
  if (expression == null) {
    throw new ParsingException("String_Node_Str");
  }
 else {
    Parser localParser=new Parser(expression);
    String rpnExpression=localParser.parseRPN();
    Evaluator evaluator=new Evaluator(rpnExpression);
    return evaluator.evaluateRPN();
  }
}
Program: 39979
Project: 39979
Buggy source:
protected double evalUnary(String op,double a){
  if (op.equals("String_Node_Str")) {
    return a;
  }
  if (op.equals("String_Node_Str")) {
    return -a;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Evaluates the unary operation.
 * @param op operation to evaluate
 * @param a  argument of the operation
 * @return the result of evaluation
 */
protected double evalUnary(String op,double a){
  if (op.equals("String_Node_Str")) {
    return a;
  }
  if (op.equals("String_Node_Str")) {
    return -a;
  }
  return 0;
}
Program: 39980
Project: 39980
Buggy source:
protected ArrayList<Token> reorder(ArrayList<Token> tokens){
  ArrayList<Token> result=new ArrayList<>();
  Stack<Token> stack=new Stack<>();
  for (  Token t : tokens) {
switch (t.getType()) {
case NUMBER:
      stack.push(t);
    break;
case UNARY_OP:
case BINARY_OP:
  while (!stack.empty() && stack.peek().getType() != TokenType.LEFTPAR && getPriority(stack.peek()) >= getPriority(t) && !isRightAssoc(stack.peek())) {
    result.add(stack.pop());
  }
case LEFTPAR:
stack.push(t);
break;
case RIGHTPAR:
while (!stack.empty() && stack.peek().getType() != TokenType.LEFTPAR) {
result.add(stack.pop());
}
stack.pop();
default :
}
}
while (!stack.empty()) {
result.add(stack.pop());
}
return result;
}

Fixed version (ground truth):
/** 
 * Converts the list of tokens in natural order into postfix notation.
 * @param tokens the list of tokens
 * @return the list of tokens in postfix notation
 */
protected ArrayList<Token> reorder(ArrayList<Token> tokens){
  ArrayList<Token> result=new ArrayList<>();
  Stack<Token> stack=new Stack<>();
  for (  Token t : tokens) {
switch (t.getType()) {
case NUMBER:
      stack.push(t);
    break;
case UNARY_OP:
case BINARY_OP:
  while (!stack.empty() && stack.peek().getType() != TokenType.LEFTPAR && getPrecedence(stack.peek()) >= getPrecedence(t) && !isRightAssoc(stack.peek())) {
    result.add(stack.pop());
  }
case LEFTPAR:
stack.push(t);
break;
case RIGHTPAR:
while (!stack.empty() && stack.peek().getType() != TokenType.LEFTPAR) {
result.add(stack.pop());
}
stack.pop();
default :
}
}
while (!stack.empty()) {
result.add(stack.pop());
}
return result;
}
Program: 39981
Project: 39981
Buggy source:
public double calculate(String expression) throws ParsingException {
  if (expression == null || expression.length() == 0) {
    throw new ParsingException("String_Node_Str");
  }
  ArrayList<Token> tokens=reorder(tokenize(expression));
  Stack<Double> st=new Stack<>();
  for (  Token t : tokens) {
    if (t.getType() == TokenType.NUMBER) {
      try {
        st.push(Double.parseDouble(t.getValue()));
      }
 catch (      NumberFormatException e) {
        throw new ParsingException("String_Node_Str" + t.getValue());
      }
    }
 else     if (t.getType() == TokenType.UNARY_OP) {
      if (st.empty()) {
        throw new ParsingException("String_Node_Str");
      }
      st.push(evalUnary(t.getValue(),st.pop()));
    }
 else     if (t.getType() == TokenType.BINARY_OP) {
      if (st.size() < 2) {
        throw new ParsingException("String_Node_Str");
      }
      double b=st.pop();
      double a=st.pop();
      st.push(evalBinary(t.getValue(),a,b));
    }
  }
  if (st.size() != 1) {
    throw new ParsingException("String_Node_Str");
  }
  return st.pop();
}

Fixed version (ground truth):
/** 
 * Evaluates an expression.
 * @param expression the expression to evaluate
 * @return the value of the expression
 * @throws ParsingException if the expression is invalid
 */
public double calculate(String expression) throws ParsingException {
  if (expression == null || expression.length() == 0) {
    throw new ParsingException("String_Node_Str");
  }
  ArrayList<Token> tokens=reorder(tokenize(expression));
  Stack<Double> st=new Stack<>();
  for (  Token t : tokens) {
    if (t.getType() == TokenType.NUMBER) {
      try {
        st.push(Double.parseDouble(t.getValue()));
      }
 catch (      NumberFormatException e) {
        throw new ParsingException("String_Node_Str" + t.getValue());
      }
    }
 else     if (t.getType() == TokenType.UNARY_OP) {
      if (st.empty()) {
        throw new ParsingException("String_Node_Str");
      }
      st.push(evalUnary(t.getValue(),st.pop()));
    }
 else     if (t.getType() == TokenType.BINARY_OP) {
      if (st.size() < 2) {
        throw new ParsingException("String_Node_Str");
      }
      double b=st.pop();
      double a=st.pop();
      st.push(evalBinary(t.getValue(),a,b));
    }
  }
  if (st.size() != 1) {
    throw new ParsingException("String_Node_Str");
  }
  return st.pop();
}
Program: 39982
Project: 39982
Buggy source:
protected boolean isRightAssoc(Token t){
  return t.getType() == TokenType.UNARY_OP;
}

Fixed version (ground truth):
/** 
 * Checks whether the operation is right-asociative.
 * @param t token with the operation
 * @return true if the operation is right-associative, false otherwise
 */
protected boolean isRightAssoc(Token t){
  return t.getType() == TokenType.UNARY_OP;
}
Program: 39984
Project: 39984
Buggy source:
protected double evalBinary(String op,double a,double b){
  if (op.equals("String_Node_Str")) {
    return a + b;
  }
  if (op.equals("String_Node_Str")) {
    return a - b;
  }
  if (op.equals("String_Node_Str")) {
    return a * b;
  }
  if (op.equals("String_Node_Str")) {
    return a / b;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Evaluates the binary operation.
 * @param op operation to evaluate
 * @param a  first argumrnt of the operation
 * @param b  second argument of the operation
 * @return the result of evaluation
 */
protected double evalBinary(String op,double a,double b){
  if (op.equals("String_Node_Str")) {
    return a + b;
  }
  if (op.equals("String_Node_Str")) {
    return a - b;
  }
  if (op.equals("String_Node_Str")) {
    return a * b;
  }
  if (op.equals("String_Node_Str")) {
    return a / b;
  }
  return 0;
}
Program: 39986
Project: 39986
Buggy source:
private List<String> contents(final Path workspacePath){
  try {
    return Files.walk(workspacePath).map(Path::toString).collect(Collectors.toList());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private List<String> contents(final Path workspacePath){
  try {
    try (Stream<Path> files=Files.walk(workspacePath)){
      return files.map(Path::toString).collect(Collectors.toList());
    }
   }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 39987
Project: 39987
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL("String_Node_Str" + "String_Node_Str");
  db.execSQL("String_Node_Str");
  for (int i=0; i < 10; i++) {
    db.execSQL("String_Node_Str");
  }
}
Program: 39988
Project: 39988
Buggy source:
private static String getTableName(String selectQuery){
  return null;
}

Fixed version (ground truth):
private static String getTableName(String selectQuery){
  TableNameParser tableNameParser=new TableNameParser(selectQuery);
  HashSet<String> tableName=(HashSet<String>)tableNameParser.tables();
  for (  String table : tableName) {
    if (!TextUtils.isEmpty(table)) {
      return table;
    }
  }
  return null;
}
Program: 39990
Project: 39990
Buggy source:
public static UpdateRowResponse addRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  ContentValues contentValues=new ContentValues();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
      contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
    break;
case DataType.REAL:
  contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
}
}
db.insert(tableName,null,contentValues);
updateRowResponse.isSuccessful=true;
return updateRowResponse;
}

Fixed version (ground truth):
public static UpdateRowResponse addRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  ContentValues contentValues=new ContentValues();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
      contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
    break;
case DataType.REAL:
  contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
}
}
long result=db.insert(tableName,null,contentValues);
updateRowResponse.isSuccessful=result > 0;
return updateRowResponse;
}
Program: 39991
Project: 39991
Buggy source:
public static UpdateRowResponse updateRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  ContentValues contentValues=new ContentValues();
  String whereClause=null;
  List<String> whereArgsList=new ArrayList<>();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
    if (rowDataRequest.isPrimary) {
      if (whereClause == null) {
        whereClause=rowDataRequest.title + "String_Node_Str";
      }
 else {
        whereClause="String_Node_Str" + rowDataRequest.title + "String_Node_Str";
      }
      whereArgsList.add(rowDataRequest.value);
    }
 else {
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
        contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
      break;
case DataType.REAL:
    contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
  break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
}
}
}
String[] whereArgs=new String[whereArgsList.size()];
for (int i=0; i < whereArgsList.size(); i++) {
whereArgs[i]=whereArgsList.get(i);
}
db.update(tableName,contentValues,whereClause,whereArgs);
updateRowResponse.isSuccessful=true;
return updateRowResponse;
}

Fixed version (ground truth):
public static UpdateRowResponse updateRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  tableName=getQuotedTableName(tableName);
  ContentValues contentValues=new ContentValues();
  String whereClause=null;
  List<String> whereArgsList=new ArrayList<>();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
    if (rowDataRequest.isPrimary) {
      if (whereClause == null) {
        whereClause=rowDataRequest.title + "String_Node_Str";
      }
 else {
        whereClause="String_Node_Str" + rowDataRequest.title + "String_Node_Str";
      }
      whereArgsList.add(rowDataRequest.value);
    }
 else {
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
        contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
      break;
case DataType.REAL:
    contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
  break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
}
}
}
String[] whereArgs=new String[whereArgsList.size()];
for (int i=0; i < whereArgsList.size(); i++) {
whereArgs[i]=whereArgsList.get(i);
}
db.update(tableName,contentValues,whereClause,whereArgs);
updateRowResponse.isSuccessful=true;
return updateRowResponse;
}
Program: 39992
Project: 39992
Buggy source:
public static UpdateRowResponse deleteRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  String whereClause=null;
  List<String> whereArgsList=new ArrayList<>();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
    if (rowDataRequest.isPrimary) {
      if (whereClause == null) {
        whereClause=rowDataRequest.title + "String_Node_Str";
      }
 else {
        whereClause="String_Node_Str" + rowDataRequest.title + "String_Node_Str";
      }
      whereArgsList.add(rowDataRequest.value);
    }
  }
  if (whereArgsList.size() == 0) {
    updateRowResponse.isSuccessful=true;
    return updateRowResponse;
  }
  String[] whereArgs=new String[whereArgsList.size()];
  for (int i=0; i < whereArgsList.size(); i++) {
    whereArgs[i]=whereArgsList.get(i);
  }
  db.delete(tableName,whereClause,whereArgs);
  updateRowResponse.isSuccessful=true;
  return updateRowResponse;
}

Fixed version (ground truth):
public static UpdateRowResponse deleteRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  tableName=getQuotedTableName(tableName);
  String whereClause=null;
  List<String> whereArgsList=new ArrayList<>();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
    if (rowDataRequest.isPrimary) {
      if (whereClause == null) {
        whereClause=rowDataRequest.title + "String_Node_Str";
      }
 else {
        whereClause="String_Node_Str" + rowDataRequest.title + "String_Node_Str";
      }
      whereArgsList.add(rowDataRequest.value);
    }
  }
  if (whereArgsList.size() == 0) {
    updateRowResponse.isSuccessful=true;
    return updateRowResponse;
  }
  String[] whereArgs=new String[whereArgsList.size()];
  for (int i=0; i < whereArgsList.size(); i++) {
    whereArgs[i]=whereArgsList.get(i);
  }
  db.delete(tableName,whereClause,whereArgs);
  updateRowResponse.isSuccessful=true;
  return updateRowResponse;
}
Program: 39993
Project: 39993
Buggy source:
public static UpdateRowResponse addRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  ContentValues contentValues=new ContentValues();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
      contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
    break;
case DataType.REAL:
  contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
}
}
long result=db.insert(tableName,null,contentValues);
updateRowResponse.isSuccessful=result > 0;
return updateRowResponse;
}

Fixed version (ground truth):
public static UpdateRowResponse addRow(SQLiteDatabase db,String tableName,List<RowDataRequest> rowDataRequests){
  UpdateRowResponse updateRowResponse=new UpdateRowResponse();
  if (rowDataRequests == null || tableName == null) {
    updateRowResponse.isSuccessful=false;
    return updateRowResponse;
  }
  tableName=getQuotedTableName(tableName);
  ContentValues contentValues=new ContentValues();
  for (  RowDataRequest rowDataRequest : rowDataRequests) {
    if (Constants.NULL.equals(rowDataRequest.value)) {
      rowDataRequest.value=null;
    }
switch (rowDataRequest.dataType) {
case DataType.INTEGER:
      contentValues.put(rowDataRequest.title,Long.valueOf(rowDataRequest.value));
    break;
case DataType.REAL:
  contentValues.put(rowDataRequest.title,Double.valueOf(rowDataRequest.value));
break;
case DataType.TEXT:
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
default :
contentValues.put(rowDataRequest.title,rowDataRequest.value);
break;
}
}
long result=db.insert(tableName,null,contentValues);
updateRowResponse.isSuccessful=result > 0;
return updateRowResponse;
}
Program: 39995
Project: 39995
Buggy source:
public static TableDataResponse exec(SQLiteDatabase database,String sql){
  TableDataResponse tableDataResponse=new TableDataResponse();
  tableDataResponse.isSelectQuery=false;
  try {
    database.execSQL(sql);
  }
 catch (  Exception e) {
    e.printStackTrace();
    tableDataResponse.isSuccessful=false;
    tableDataResponse.errorMessage=e.getMessage();
    return tableDataResponse;
  }
  tableDataResponse.isSuccessful=true;
  return tableDataResponse;
}

Fixed version (ground truth):
public static TableDataResponse exec(SQLiteDatabase database,String sql){
  TableDataResponse tableDataResponse=new TableDataResponse();
  tableDataResponse.isSelectQuery=false;
  try {
    String tableName=getTableName(sql);
    if (!TextUtils.isEmpty(tableName)) {
      String quotedTableName=getQuotedTableName(tableName);
      sql=sql.replace(tableName,quotedTableName);
    }
    database.execSQL(sql);
  }
 catch (  Exception e) {
    e.printStackTrace();
    tableDataResponse.isSuccessful=false;
    tableDataResponse.errorMessage=e.getMessage();
    return tableDataResponse;
  }
  tableDataResponse.isSuccessful=true;
  return tableDataResponse;
}
Program: 39996
Project: 39996
Buggy source:
public boolean insertContact(String name,String phone,String email,String street,String place){
  SQLiteDatabase db=this.getWritableDatabase();
  ContentValues contentValues=new ContentValues();
  contentValues.put("String_Node_Str",name);
  contentValues.put("String_Node_Str",phone);
  contentValues.put("String_Node_Str",email);
  contentValues.put("String_Node_Str",street);
  contentValues.put("String_Node_Str",place);
  db.insert("String_Node_Str",null,contentValues);
  return true;
}

Fixed version (ground truth):
public boolean insertContact(String name,String phone,String email,String street,String place){
  SQLiteDatabase db=this.getWritableDatabase();
  ContentValues contentValues=new ContentValues();
  contentValues.put("String_Node_Str",name);
  contentValues.put("String_Node_Str",phone);
  contentValues.put("String_Node_Str",email);
  contentValues.put("String_Node_Str",street);
  contentValues.put("String_Node_Str",place);
  contentValues.put(CONTACTS_CREATED_AT,Calendar.getInstance().getTimeInMillis());
  db.insert("String_Node_Str",null,contentValues);
  return true;
}
Program: 39997
Project: 39997
Buggy source:
private Response query(String sql){
  Cursor cursor;
  try {
    cursor=mDatabase.rawQuery(sql,null);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Response msg=new Response();
    msg.isSuccessful=false;
    msg.error=e.getMessage();
    return msg;
  }
  if (cursor != null) {
    cursor.moveToFirst();
    Response response=new Response();
    response.isSuccessful=true;
    List<String> columns=new ArrayList<>();
    for (int i=0; i < cursor.getColumnCount(); i++) {
      String name=cursor.getColumnName(i);
      columns.add(name);
    }
    response.columns=columns;
    if (cursor.getCount() > 0) {
      do {
        List<Object> row=new ArrayList<>();
        for (int i=0; i < cursor.getColumnCount(); i++) {
switch (cursor.getType(i)) {
case Cursor.FIELD_TYPE_BLOB:
            row.add(cursor.getBlob(i));
          break;
case Cursor.FIELD_TYPE_FLOAT:
        row.add(cursor.getFloat(i));
      break;
case Cursor.FIELD_TYPE_INTEGER:
    row.add(cursor.getInt(i));
  break;
case Cursor.FIELD_TYPE_STRING:
row.add(cursor.getString(i));
break;
default :
row.add("String_Node_Str");
}
}
response.rows.add(row);
}
 while (cursor.moveToNext());
}
cursor.close();
return response;
}
 else {
Response response=new Response();
response.isSuccessful=false;
response.error="String_Node_Str";
return response;
}
}

Fixed version (ground truth):
private Response query(String sql){
  Cursor cursor;
  try {
    cursor=mDatabase.rawQuery(sql,null);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Response msg=new Response();
    msg.isSuccessful=false;
    msg.error=e.getMessage();
    return msg;
  }
  if (cursor != null) {
    cursor.moveToFirst();
    Response response=new Response();
    response.isSuccessful=true;
    List<String> columns=new ArrayList<>();
    for (int i=0; i < cursor.getColumnCount(); i++) {
      String name=cursor.getColumnName(i);
      columns.add(name);
    }
    response.columns=columns;
    if (cursor.getCount() > 0) {
      do {
        List<Object> row=new ArrayList<>();
        for (int i=0; i < cursor.getColumnCount(); i++) {
switch (cursor.getType(i)) {
case Cursor.FIELD_TYPE_BLOB:
            row.add(cursor.getBlob(i));
          break;
case Cursor.FIELD_TYPE_FLOAT:
        row.add(cursor.getFloat(i));
      break;
case Cursor.FIELD_TYPE_INTEGER:
    row.add(cursor.getLong(i));
  break;
case Cursor.FIELD_TYPE_STRING:
row.add(cursor.getString(i));
break;
default :
row.add("String_Node_Str");
}
}
response.rows.add(row);
}
 while (cursor.moveToNext());
}
cursor.close();
return response;
}
 else {
Response response=new Response();
response.isSuccessful=false;
response.error="String_Node_Str";
return response;
}
}
Program: 39998
Project: 39998
Buggy source:
private void select(TaggingPreset preset){
  this.selectedPreset=preset;
}

Fixed version (ground truth):
private void select(TaggingPreset preset){
  selectedPreset=preset;
}
Program: 39999
Project: 39999
Buggy source:
@Override public void valueChanged(ListSelectionEvent e){
  reorderUpButton.setEnabled(e.getFirstIndex() > 0);
  reorderDownButton.setEnabled(e.getFirstIndex() < presets.length - 1);
  if (!isSelectionValid()) {
    editButton.setEnabled(false);
    deleteButton.setEnabled(false);
    return;
  }
  editButton.setEnabled(true);
  deleteButton.setEnabled(true);
  copyButton.setEnabled(true);
  select(presets[e.getFirstIndex()]);
}

Fixed version (ground truth):
@Override public void valueChanged(ListSelectionEvent evt){
  int index=list.getSelectedIndex();
  reorderUpButton.setEnabled(index > 0);
  reorderDownButton.setEnabled(index < presets.length - 1);
  if (!isSelectionValid()) {
    editButton.setEnabled(false);
    deleteButton.setEnabled(false);
    return;
  }
  editButton.setEnabled(true);
  deleteButton.setEnabled(true);
  copyButton.setEnabled(true);
  select(presets[index]);
}
Program: 40000
Project: 40000
Buggy source:
public void load(){
  BufferedReader bReader=null;
  FileReader fReader=null;
  try {
    fReader=new FileReader(EasyPresets.getInstance().getXMLPath());
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
    return;
  }
  bReader=new BufferedReader(fReader);
  Collection<TaggingPreset> readResult;
  try {
    readResult=TaggingPresetReader.readAll(bReader,true);
    presets=readResult;
    TaggingPresets.addTaggingPresets(readResult);
  }
 catch (  SAXException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void load(){
  ReaderUTF8 reader;
  try {
    reader=new ReaderUTF8(new FileInputStream(EasyPresets.getInstance().getXMLPath()));
  }
 catch (  FileNotFoundException ex) {
    ex.printStackTrace();
    return;
  }
  Collection<TaggingPreset> readResult;
  try {
    readResult=TaggingPresetReader.readAll(reader,true);
    presets=readResult;
    TaggingPresets.addTaggingPresets(readResult);
  }
 catch (  SAXException e) {
    e.printStackTrace();
  }
}
Program: 40001
Project: 40001
Buggy source:
public double getAspectRatio(){
  if (aspectY == 0) {
    return 0;
  }
 else {
    return aspectX / aspectY;
  }
}

Fixed version (ground truth):
public double getAspectRatio(){
  if (aspectY == 0) {
    return 0;
  }
 else {
    return ((double)aspectX) / ((double)aspectY);
  }
}
Program: 40002
Project: 40002
Buggy source:
public static Project fromBytes(byte[] bytes,Gson gson) throws IOException {
  InputStreamReader reader=new InputStreamReader(new ByteArrayInputStream(bytes));
  return fromReader(reader,gson);
}

Fixed version (ground truth):
public static Project fromBytes(byte[] bytes,Gson gson) throws IOException {
  InputStreamReader reader=new InputStreamReader(new ByteArrayInputStream(bytes),Charset.forName("String_Node_Str"));
  return fromReader(reader,gson);
}
Program: 40003
Project: 40003
Buggy source:
public static void toStream(Project project,OutputStream stream,Gson gson) throws IOException {
  Writer writer=new OutputStreamWriter(stream);
  ExportPackage p=new ExportPackage();
  p.project=project;
  p.version=Application.getVersion().toString();
  gson.toJson(p,writer);
  writer.close();
}

Fixed version (ground truth):
public static void toStream(Project project,OutputStream stream,Gson gson) throws IOException {
  Writer writer=new OutputStreamWriter(stream,Charset.forName("String_Node_Str"));
  ExportPackage p=new ExportPackage();
  p.project=project;
  p.version=Application.getVersion().toString();
  gson.toJson(p,writer);
  writer.close();
}
Program: 40004
Project: 40004
Buggy source:
private void rollback(){
  logger.info("String_Node_Str");
  bounds.upperSection-=1;
  if (bounds.upperSection < bounds.lowerSection) {
    logger.info("String_Node_Str");
    probeSubdivided();
  }
 else {
    loadSections(this::render);
  }
}

Fixed version (ground truth):
private void rollback(){
  logger.info("String_Node_Str");
  bounds.upperSection-=1;
  if (bounds.upperSection < bounds.lowerSection) {
    logger.info("String_Node_Str");
    probeSubdivided();
  }
 else {
    loadSections(() -> {
      if (height <= heightLimit)       render();
 else       probeSubdivided();
    }
);
  }
}
Program: 40005
Project: 40005
Buggy source:
/** 
 * Search for XmEntity by type key and query.
 * @param query the query
 * @param typeKey the type key
 * @param pageable the page info
 * @param privilegeKey the privilege key
 * @return permitted entities
 */
public Page<XmEntity> searchByQueryAndTypeKey(String query,String typeKey,Pageable pageable,String privilegeKey){
  String permittedQuery=buildPermittedQuery(query,privilegeKey);
  val prefix=(typeKey + "String_Node_Str").toLowerCase();
  val typeKeyQuery=boolQuery().should(matchQuery(TYPE_KEY,typeKey)).should(prefixQuery(TYPE_KEY,prefix)).minimumNumberShouldMatch(1);
  val esQuery=isEmpty(permittedQuery) ? boolQuery().must(typeKeyQuery) : typeKeyQuery.must(simpleQueryStringQuery(permittedQuery));
  log.debug("String_Node_Str",esQuery);
  NativeSearchQuery queryBuilder=new NativeSearchQueryBuilder().withQuery(esQuery).withPageable(pageable).build();
  return getElasticsearchTemplate().queryForPage(queryBuilder,XmEntity.class);
}

Fixed version (ground truth):
/** 
 * Search for XmEntity by type key and query.
 * @param query the query
 * @param typeKey the type key
 * @param pageable the page info
 * @param privilegeKey the privilege key
 * @return permitted entities
 */
public Page<XmEntity> searchByQueryAndTypeKey(String query,String typeKey,Pageable pageable,String privilegeKey){
  String permittedQuery=buildPermittedQuery(query,privilegeKey);
  val typeKeyQuery=boolQuery().should(matchQuery(TYPE_KEY,typeKey)).minimumNumberShouldMatch(1);
  val esQuery=isEmpty(permittedQuery) ? boolQuery().must(typeKeyQuery) : typeKeyQuery.must(simpleQueryStringQuery(permittedQuery));
  log.debug("String_Node_Str",esQuery);
  NativeSearchQuery queryBuilder=new NativeSearchQueryBuilder().withQuery(esQuery).withPageable(pageable).build();
  return getElasticsearchTemplate().queryForPage(queryBuilder,XmEntity.class);
}
Program: 40006
Project: 40006
Buggy source:
private void createTenant(Tenant tenant){
  forEachDomainDocument(beanDefinition -> {
    try {
      Class<?> cl=Class.forName(beanDefinition.getBeanClassName());
      elasticsearchTemplate.createIndex(cl);
    }
 catch (    ClassNotFoundException e) {
      log.error("String_Node_Str",beanDefinition.getBeanClassName(),tenant.getTenantKey());
      throw new IllegalStateException(e);
    }
  }
);
}

Fixed version (ground truth):
private void createTenant(Tenant tenant){
  forEachDomainDocument(beanDefinition -> {
    try {
      Class<?> cl=Class.forName(beanDefinition.getBeanClassName());
      elasticsearchTemplate.createIndex(cl);
      elasticsearchTemplate.putMapping(cl);
    }
 catch (    ClassNotFoundException e) {
      log.error("String_Node_Str",beanDefinition.getBeanClassName(),tenant.getTenantKey());
      throw new IllegalStateException(e);
    }
  }
);
}
Program: 40007
Project: 40007
Buggy source:
@After public void afterTest(){
  tenantContextHolder.getPrivilegedContext().destroyCurrentContext();
}

Fixed version (ground truth):
@After public void afterTest(){
  elasticsearchTemplate.deleteIndex(XmEntity.class);
  tenantContextHolder.getPrivilegedContext().destroyCurrentContext();
}
Program: 40008
Project: 40008
Buggy source:
@BeforeTransaction public void beforeTransaction(){
  TenantContextUtils.setTenant(tenantContextHolder,"String_Node_Str");
  elasticsearchTemplate.createIndex(XmEntity.class);
  elasticsearchTemplate.putMapping(XmEntity.class);
  MockitoAnnotations.initMocks(this);
  when(authContextHolder.getContext()).thenReturn(context);
  when(context.getRequiredUserKey()).thenReturn("String_Node_Str");
  String tenantName=getRequiredTenantKeyValue(tenantContextHolder);
  String config=getXmEntityTemplatesSpec(tenantName);
  String key=applicationProperties.getSpecificationTemplatesPathPattern().replace("String_Node_Str",tenantName);
  xmEntityTemplatesSpecService.onRefresh(key,config);
  xmEntityService=new XmEntityServiceImpl(xmEntitySpecService,xmEntityTemplatesSpecService,xmEntityRepository,xmEntitySearchRepository,lifecycleService,null,profileService,linkService,storageService,attachmentService,permittedSearchRepository,startUpdateDateGenerationStrategy,authContextHolder,objectMapper,tenantConfigService);
  xmEntityService.setSelf(xmEntityService);
  lepManager.beginThreadContext(ctx -> {
    ctx.setValue(THREAD_CONTEXT_KEY_TENANT_CONTEXT,tenantContextHolder.getContext());
    ctx.setValue(THREAD_CONTEXT_KEY_AUTH_CONTEXT,authContextHolder.getContext());
  }
);
}

Fixed version (ground truth):
@BeforeTransaction public void beforeTransaction(){
  TenantContextUtils.setTenant(tenantContextHolder,"String_Node_Str");
  elasticsearchTemplate.deleteIndex(XmEntity.class);
  elasticsearchTemplate.createIndex(XmEntity.class);
  elasticsearchTemplate.putMapping(XmEntity.class);
  MockitoAnnotations.initMocks(this);
  when(authContextHolder.getContext()).thenReturn(context);
  when(context.getRequiredUserKey()).thenReturn("String_Node_Str");
  String tenantName=getRequiredTenantKeyValue(tenantContextHolder);
  String config=getXmEntityTemplatesSpec(tenantName);
  String key=applicationProperties.getSpecificationTemplatesPathPattern().replace("String_Node_Str",tenantName);
  xmEntityTemplatesSpecService.onRefresh(key,config);
  xmEntityService=new XmEntityServiceImpl(xmEntitySpecService,xmEntityTemplatesSpecService,xmEntityRepository,xmEntitySearchRepository,lifecycleService,null,profileService,linkService,storageService,attachmentService,permittedSearchRepository,startUpdateDateGenerationStrategy,authContextHolder,objectMapper,tenantConfigService);
  xmEntityService.setSelf(xmEntityService);
  lepManager.beginThreadContext(ctx -> {
    ctx.setValue(THREAD_CONTEXT_KEY_TENANT_CONTEXT,tenantContextHolder.getContext());
    ctx.setValue(THREAD_CONTEXT_KEY_AUTH_CONTEXT,authContextHolder.getContext());
  }
);
}
Program: 40009
Project: 40009
Buggy source:
/** 
 * PUT  /locations : Updates an existing location.
 * @param location the location to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated location,or with status 400 (Bad Request) if the location is not valid, or with status 500 (Internal Server Error) if the location couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("String_Node_Str") @Timed @PreAuthorize("String_Node_Str") public ResponseEntity<Location> updateLocation(@Valid @RequestBody Location location) throws URISyntaxException {
  if (location.getId() == null) {
    return this.locationResource.createLocation(location);
  }
  Location result=locationRepository.save(location);
  locationSearchRepository.save(result);
  return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME,location.getId().toString())).body(result);
}

Fixed version (ground truth):
/** 
 * PUT  /locations : Updates an existing location.
 * @param location the location to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated location,or with status 400 (Bad Request) if the location is not valid, or with status 500 (Internal Server Error) if the location couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("String_Node_Str") @Timed @PreAuthorize("String_Node_Str") public ResponseEntity<Location> updateLocation(@Valid @RequestBody Location location) throws URISyntaxException {
  if (location.getId() == null) {
    return this.locationResource.createLocation(location);
  }
  Location result=locationService.save(location);
  return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME,location.getId().toString())).body(result);
}
Program: 40010
Project: 40010
Buggy source:
/** 
 * POST  /locations : Create a new location.
 * @param location the location to create
 * @return the ResponseEntity with status 201 (Created) and with body the new location, or with status 400 (Bad Request) if the location has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("String_Node_Str") @Timed @PreAuthorize("String_Node_Str") public ResponseEntity<Location> createLocation(@Valid @RequestBody Location location) throws URISyntaxException {
  if (location.getId() != null) {
    throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,"String_Node_Str");
  }
  Location result=locationRepository.save(location);
  locationSearchRepository.save(result);
  return ResponseEntity.created(new URI("String_Node_Str" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME,result.getId().toString())).body(result);
}

Fixed version (ground truth):
/** 
 * POST  /locations : Create a new location.
 * @param location the location to create
 * @return the ResponseEntity with status 201 (Created) and with body the new location, or with status 400 (Bad Request) if the location has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("String_Node_Str") @Timed @PreAuthorize("String_Node_Str") public ResponseEntity<Location> createLocation(@Valid @RequestBody Location location) throws URISyntaxException {
  if (location.getId() != null) {
    throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,"String_Node_Str");
  }
  Location result=locationService.save(location);
  return ResponseEntity.created(new URI("String_Node_Str" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME,result.getId().toString())).body(result);
}
Program: 40011
Project: 40011
Buggy source:
/** 
 * Save a functionContext.
 * @param functionContext the entity to save
 * @return the persisted entity
 */
public FunctionContext save(FunctionContext functionContext){
  startUpdateDateGenerationStrategy.preProcessStartUpdateDates(functionContext,functionContext.getId(),functionContextRepository,FunctionContext::setStartDate,FunctionContext::getStartDate,FunctionContext::setUpdateDate);
  functionContext.setXmEntity(xmEntityRepository.getOne(functionContext.getXmEntity().getId()));
  FunctionContext result=functionContextRepository.save(functionContext);
  functionContextSearchRepository.save(result);
  return result;
}

Fixed version (ground truth):
/** 
 * Save a functionContext.
 * @param functionContext the entity to save
 * @return the persisted entity
 */
public FunctionContext save(FunctionContext functionContext){
  startUpdateDateGenerationStrategy.preProcessStartUpdateDates(functionContext,functionContext.getId(),functionContextRepository,FunctionContext::setStartDate,FunctionContext::getStartDate,FunctionContext::setUpdateDate);
  if (functionContext.getXmEntity() != null) {
    functionContext.setXmEntity(xmEntityRepository.getOne(functionContext.getXmEntity().getId()));
  }
  FunctionContext result=functionContextRepository.save(functionContext);
  functionContextSearchRepository.save(result);
  return result;
}
Program: 40012
Project: 40012
Buggy source:
@Override public Object findById(Object id){
  return findOne(IdOrKey.of((String)id));
}

Fixed version (ground truth):
@Override public Object findById(Object id){
  return findOne(IdOrKey.of(String.valueOf(id)));
}
Program: 40013
Project: 40013
Buggy source:
@SuppressWarnings("String_Node_Str") public Object apply(List args){
  if (args.size() > 1) {
    List firstArg=(List)args.get(0);
    return firstArg.subList(1,firstArg.size());
  }
 else {
    return Environment.FALSE;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object apply(List args){
  if (args.size() == 1) {
    List firstArg=(List)args.get(0);
    return firstArg.subList(1,firstArg.size());
  }
 else {
    return Environment.FALSE;
  }
}
Program: 40014
Project: 40014
Buggy source:
public static String prelude(String namespace){
  StringBuilder builder=new StringBuilder();
  builder.append(jsNamespace + "String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  return builder.toString();
}

Fixed version (ground truth):
public static String prelude(String namespace){
  StringBuilder builder=new StringBuilder();
  builder.append(jsNamespace + "String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  builder.append("String_Node_Str");
  return builder.toString();
}
Program: 40016
Project: 40016
Buggy source:
public void onPictureTaken(byte[] data,Camera camera){
  saveImg.setVisibility(View.VISIBLE);
  reloadButton.setVisibility(View.VISIBLE);
  captureButton.setVisibility(View.INVISIBLE);
  mCurrentPictureData=data;
  tmpImageFile=null;
  try {
    tmpImageFile=File.createTempFile("String_Node_Str",null,getCacheDir());
  }
 catch (  IOException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
  try {
    FileOutputStream fo=new FileOutputStream(tmpImageFile);
    fo.write(data);
    fo.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  setPic();
  safeToTakePicture=true;
}

Fixed version (ground truth):
public void onPictureTaken(byte[] data,Camera camera){
  captureButton.setVisibility(View.INVISIBLE);
  cancelImg.setVisibility(View.INVISIBLE);
  mCurrentPictureData=data;
  tmpImageFile=null;
  try {
    tmpImageFile=File.createTempFile("String_Node_Str",null,getCacheDir());
  }
 catch (  IOException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
  try {
    FileOutputStream fo=new FileOutputStream(tmpImageFile);
    fo.write(data);
    fo.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  setPic();
  safeToTakePicture=true;
  savePicture();
  releaseCamera();
}
Program: 40017
Project: 40017
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.camera_preview);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
    mAlbumStorageDirFactory=new FroyoAlbumDirFactory();
  }
 else {
    mAlbumStorageDirFactory=new BaseAlbumDirFactory();
  }
  mImageView=(ImageView)findViewById(R.id.camera_preview_taken);
  saveImg=(ImageButton)findViewById(R.id.camera_preview_ok);
  cancelImg=(ImageButton)findViewById(R.id.camera_preview_cancel);
  captureButton=(ImageButton)findViewById(R.id.button_capture);
  reloadButton=(ImageButton)findViewById(R.id.camera_preview_reload);
  captureButton.setOnClickListener(CameraActivity.this);
  cancelImg.setOnClickListener(CameraActivity.this);
  saveImg.setOnClickListener(CameraActivity.this);
  reloadButton.setOnClickListener(CameraActivity.this);
  openCameraTask=new OpenCameraTask().execute(new String[]{});
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.camera_preview);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
    mAlbumStorageDirFactory=new FroyoAlbumDirFactory();
  }
 else {
    mAlbumStorageDirFactory=new BaseAlbumDirFactory();
  }
  mImageView=(ImageView)findViewById(R.id.camera_preview_taken);
  cancelImg=(ImageButton)findViewById(R.id.camera_preview_cancel);
  captureButton=(ImageButton)findViewById(R.id.button_capture);
  captureButton.setOnClickListener(CameraActivity.this);
  cancelImg.setOnClickListener(CameraActivity.this);
  openCameraTask=new OpenCameraTask().execute(new String[]{});
}
Program: 40018
Project: 40018
Buggy source:
private void releaseCamera(){
  if (mCamera != null) {
    mCamera.release();
    mCamera=null;
  }
}

Fixed version (ground truth):
private void releaseCamera(){
  if (mCamera != null) {
    mCamera.release();
    mCamera=null;
    Timber.d("String_Node_Str");
  }
}
Program: 40019
Project: 40019
Buggy source:
public void onClick(View v){
  v.setHapticFeedbackEnabled(true);
switch (v.getId()) {
case R.id.button_capture:
    if (safeToTakePicture) {
      safeToTakePicture=false;
      mCamera.takePicture(null,null,CameraActivity.this);
      Log.e("String_Node_Str","String_Node_Str");
    }
  break;
case R.id.camera_preview_cancel:
setResult(Activity.RESULT_CANCELED);
finish();
break;
case R.id.camera_preview_reload:
mCamera.startPreview();
FrameLayout preview=(FrameLayout)findViewById(R.id.camera_preview);
preview.removeAllViews();
preview.addView(mPreview);
mImageView.setImageDrawable(null);
reloadButton.setVisibility(View.INVISIBLE);
captureButton.setVisibility(View.VISIBLE);
saveImg.setVisibility(View.INVISIBLE);
break;
case R.id.camera_preview_ok:
File pictureFile=null;
try {
pictureFile=setUpPhotoFile();
mCurrentPhotoPath=pictureFile.getAbsolutePath();
}
 catch (IOException e) {
e.printStackTrace();
pictureFile=null;
mCurrentPhotoPath=null;
}
boolean saved=true;
try {
FileOutputStream fos=new FileOutputStream(pictureFile);
fos.write(mCurrentPictureData);
fos.close();
galleryAddPic();
}
 catch (FileNotFoundException e) {
Log.d(TAG,"String_Node_Str" + e.getMessage());
saved=false;
}
catch (IOException e) {
Log.d(TAG,"String_Node_Str" + e.getMessage());
saved=false;
}
catch (Exception e) {
Log.d(TAG,"String_Node_Str" + e.getMessage());
saved=false;
}
if (saved) {
Intent data=new Intent();
data.putExtra(ValueHelper.TAKEN_IMAGE_PATH,mCurrentPhotoPath);
setResult(Activity.RESULT_OK,data);
}
 else {
setResult(Activity.RESULT_CANCELED);
}
finish();
break;
default :
break;
}
}

Fixed version (ground truth):
public void onClick(View v){
  v.setHapticFeedbackEnabled(true);
  if (safeToTakePicture) {
    safeToTakePicture=false;
    mCamera.takePicture(null,null,CameraActivity.this);
    Log.e("String_Node_Str","String_Node_Str");
  }
}
Program: 40020
Project: 40020
Buggy source:
protected void onPreExecute(){
  cancelImg.setVisibility(View.INVISIBLE);
  captureButton.setVisibility(View.INVISIBLE);
  saveImg.setVisibility(View.INVISIBLE);
}

Fixed version (ground truth):
protected void onPreExecute(){
  cancelImg.setVisibility(View.INVISIBLE);
  captureButton.setVisibility(View.INVISIBLE);
}