nus-yam/ex-repair huggingface dataset:
Program: 45375
Project: 45375
Buggy source:
void warning(int pos,InputBuffer input,int code,String errorArg1,String errorArg2,String errorArg3){
  if (first_pass || (enabledMap.containsKey(code) && !enabledMap.get(code)) || ignorableFile(input)|| (pos == 0))   return;
  CodeLocation loc=new CodeLocation();
  loc.pos=pos;
  loc.input=input;
  if (input != null) {
    int colPos=input.getColPos(loc.pos);
    if (colPos > 300) {
      colPos=1;
    }
    WarningRecord rec=new WarningRecord(loc,input.getLnNum(loc.pos),colPos,code,errorArg1,errorArg2,errorArg3);
    ObjectList<WarningRecord> warnList=pWarnings.get(code);
    if (warnList == null)     warnList=new ObjectList<WarningRecord>();
    for (    WarningRecord test : warnList) {
      if (test.colNum == rec.colNum && test.lineNum == rec.lineNum && test.errStringArg1.equals(rec.errStringArg1) && test.errStringArg2.equals(rec.errStringArg2) && test.errStringArg3.equals(rec.errStringArg3) && test.loc.input.equals(rec.loc.input))       return;
    }
    warnList.add(rec);
    pWarnings.put(code,warnList);
    String origin=loc.input.origin;
    TreeMap<Integer,WarningRecord> locMap=warningsByLoc.get(origin);
    if (locMap == null) {
      locMap=new TreeMap<Integer,WarningRecord>();
      warningsByLoc.put(origin,locMap);
    }
    locMap.put(rec.lineNum,rec);
  }
 else   assert(false);
}

Fixed version (ground truth):
void warning(int pos,InputBuffer input,int code,String errorArg1,String errorArg2,String errorArg3){
  if (first_pass || (enabledMap.containsKey(code) && !enabledMap.get(code)) || ignorableFile(input)|| (pos == 0))   return;
  CodeLocation loc=new CodeLocation();
  loc.pos=pos;
  loc.input=input;
  if (input != null) {
    int colPos=input.getColPos(loc.pos);
    if (colPos > 300) {
      colPos=1;
    }
    WarningRecord rec=new WarningRecord(loc,input.getLnNum(loc.pos),colPos,code,errorArg1,errorArg2,errorArg3);
    ObjectList<WarningRecord> warnList=pWarnings.get(code);
    if (warnList == null)     warnList=new ObjectList<WarningRecord>();
    for (    WarningRecord test : warnList) {
      if (test.colNum == rec.colNum && test.lineNum == rec.lineNum && test.errStringArg1.equals(rec.errStringArg1) && test.errStringArg2.equals(rec.errStringArg2) && test.errStringArg3.equals(rec.errStringArg3) && test.loc.input.equals(rec.loc.input))       return;
    }
    warnList.add(rec);
    pWarnings.put(code,warnList);
    String origin=loc.input.origin;
    TreeMap<Integer,Set<WarningRecord>> locMap=warningsByLoc.get(origin);
    if (locMap == null) {
      locMap=new TreeMap<Integer,Set<WarningRecord>>();
      warningsByLoc.put(origin,locMap);
    }
    Set<WarningRecord> records=locMap.get(rec.lineNum);
    if (records == null) {
      records=new HashSet<WarningRecord>(1);
      locMap.put(rec.lineNum,records);
    }
    records.add(rec);
  }
 else   assert(false);
}
Program: 45376
Project: 45376
Buggy source:
/** 
 * Log warnings with little formatting to the warning or error stream FLEX hooks into this method, nothing in ASC uses it.
 */
public int simpleLogWarnings(Context cx,boolean logAsErrors){
  CompilerHandler handler=cx.getHandler();
  if (handler == null) {
    handler=cx.statics.handler;
  }
  int count=0;
  for (  TreeMap<Integer,WarningRecord> locMap : warningsByLoc.values()) {
    for (    WarningRecord pRec : locMap.values()) {
      StringBuilder sb=new StringBuilder();
      InputBuffer input=pRec.loc.input;
      createErrorMessage(pRec,sb,pRec.code);
      String source=input.getLineText(pRec.loc.pos);
      if (logAsErrors) {
        handler.error(input.origin,pRec.lineNum,pRec.colNum,sb.toString(),source,pRec.code);
      }
 else {
        handler.warning(input.origin,pRec.lineNum,pRec.colNum,sb.toString(),source,pRec.code);
      }
      count++;
    }
  }
  return count;
}

Fixed version (ground truth):
/** 
 * Log warnings with little formatting to the warning or error stream FLEX hooks into this method, nothing in ASC uses it.
 */
public int simpleLogWarnings(Context cx,boolean logAsErrors){
  CompilerHandler handler=cx.getHandler();
  if (handler == null) {
    handler=cx.statics.handler;
  }
  int count=0;
  for (  TreeMap<Integer,Set<WarningRecord>> locMap : warningsByLoc.values()) {
    for (    Set<WarningRecord> records : locMap.values()) {
      for (      WarningRecord record : records) {
        StringBuilder sb=new StringBuilder();
        InputBuffer input=record.loc.input;
        createErrorMessage(record,sb,record.code);
        String source=input.getLineText(record.loc.pos);
        if (logAsErrors) {
          handler.error(input.origin,record.lineNum,record.colNum,sb.toString(),source,record.code);
        }
 else {
          handler.warning(input.origin,record.lineNum,record.colNum,sb.toString(),source,record.code);
        }
        count++;
      }
    }
  }
  return count;
}
Program: 45378
Project: 45378
Buggy source:
Name readName(Reader p){
  int kind=p.readU8();
switch (kind) {
default :
    throw new RuntimeException("String_Node_Str" + kind);
case CONSTANT_TypeName:
{
    int index=p.readU30();
    int count=p.readU30();
    assert(count == 1);
    int typeparm=p.readU30();
    Name mn=this.names[index];
    return new Name(kind,mn.name,mn.nsset,typeparm);
  }
case CONSTANT_Qname:
case CONSTANT_QnameA:
return new Name(kind,namespaces[p.readU30()],strings[p.readU30()]);
case CONSTANT_Multiname:
case CONSTANT_MultinameA:
return new Name(kind,strings[p.readU30()],nssets[p.readU30()]);
case CONSTANT_RTQname:
case CONSTANT_RTQnameA:
return new Name(kind,uniqueNs(),strings[p.readU30()]);
case CONSTANT_MultinameL:
case CONSTANT_MultinameLA:
return new Name(kind,unique(),nssets[p.readU30()]);
case CONSTANT_RTQnameL:
case CONSTANT_RTQnameLA:
return new Name(kind);
}
}

Fixed version (ground truth):
Name readName(Reader p){
  int kind=p.readU8();
switch (kind) {
default :
    throw new RuntimeException("String_Node_Str" + kind);
case CONSTANT_TypeName:
{
    int index=p.readU30();
    int count=p.readU30();
    assert(count == 1);
    int typeparm=p.readU30();
    Name mn=this.names[index];
    Name type_param=this.names[typeparm];
    return new Name(kind,mn.name,mn.nsset,type_param.name);
  }
case CONSTANT_Qname:
case CONSTANT_QnameA:
return new Name(kind,namespaces[p.readU30()],strings[p.readU30()]);
case CONSTANT_Multiname:
case CONSTANT_MultinameA:
return new Name(kind,strings[p.readU30()],nssets[p.readU30()]);
case CONSTANT_RTQname:
case CONSTANT_RTQnameA:
return new Name(kind,uniqueNs(),strings[p.readU30()]);
case CONSTANT_MultinameL:
case CONSTANT_MultinameLA:
return new Name(kind,unique(),nssets[p.readU30()]);
case CONSTANT_RTQnameL:
case CONSTANT_RTQnameLA:
return new Name(kind);
}
}
Program: 45383
Project: 45383
Buggy source:
private void buildLineMap(char[] src,int max){
  int line=0;
  int pos=0;
  int[] lb=new int[max + 1];
  while (pos < max) {
    lb[line++]=pos;
    do {
      char ch=src[pos];
      if (ch == '\r' || ch == '\n') {
        if (ch == '\r' && (pos + 1) < max && src[pos + 1] == '\n')         pos+=2;
 else         ++pos;
        break;
      }
    }
 while (++pos < max);
  }
  lb[line++]=pos;
  lineMap=new int[line];
  System.arraycopy(lb,0,lineMap,0,line);
}

Fixed version (ground truth):
private void buildLineMap(String src,int max){
  int line=0;
  int pos=0;
  int[] lb=new int[max + 1];
  while (pos < max) {
    lb[line++]=pos;
    do {
      char ch=src.charAt(pos);
      if (ch == '\r' || ch == '\n') {
        if (ch == '\r' && (pos + 1) < max && src.charAt(pos + 1) == '\n')         pos+=2;
 else         ++pos;
        break;
      }
    }
 while (++pos < max);
  }
  lb[line++]=pos;
  lineMap=new int[line];
  System.arraycopy(lb,0,lineMap,0,line);
}
Program: 45384
Project: 45384
Buggy source:
public String getLineText(int srcPos){
  int i, start;
  start=getLineStartPos(srcPos);
  for (i=start; i < text.length; i++) {
    char c=text[i];
    if (c == '\n' || c == '\r' || c == 0x00 || c == 0x2028 || c == 0x2029)     break;
  }
  return String.valueOf(text,start,i - start);
}

Fixed version (ground truth):
public String getLineText(int srcPos){
  int i, start;
  start=getLineStartPos(srcPos);
  for (i=start; i < text.length(); i++) {
    char c=text.charAt(i);
    if (c == '\n' || c == '\r' || c == 0x00 || c == 0x2028 || c == 0x2029)     break;
  }
  return text.substring(start,i);
}
Program: 45385
Project: 45385
Buggy source:
/** 
 * Copies a string from index <from> to <to>, interpreting escape characters
 */
private String escapeString(char[] src,int from,int to){
  int len=1 + to - from;
  if (has_escape(src,from,to) == false) {
    return String.valueOf(src,from,len);
  }
  final StringBuilder buf=new StringBuilder(len);
  for (int i=from; i <= to; i++) {
    char c=src[i];
    if (c == '\\') {
      int c2=src[i + 1];
switch (c2) {
case '\'':
case '\"':
        continue;
case '\r':
      if (src[i + 2] == '\n') {
        i++;
      }
case '\n':
    i++;
  continue;
case '\\':
c='\\';
++i;
break;
case 'u':
{
int thisChar=0;
int y, digit;
for (y=i + 2; y < i + 6 && y < to + 1; y++) {
digit=Character.digit(src[y],16);
if (digit == -1) break;
thisChar=(thisChar << 4) + digit;
}
if (y != i + 6 || Character.isDefined((char)thisChar) == false) {
c=src[++i];
}
 else {
c=(char)thisChar;
i+=5;
}
break;
}
default :
{
if (PASS_ESCAPES_TO_BACKEND) {
c=src[++i];
break;
}
switch (c2) {
case 'b':
c='\b';
++i;
break;
case 'f':
c='\f';
++i;
break;
case 'n':
c='\n';
++i;
break;
case 'r':
c='\r';
++i;
break;
case 't':
c='\t';
++i;
break;
case 'v':
c=0xb;
++i;
break;
case 'x':
{
int d1, d2;
if (i + 4 > to || (d1=Character.digit(src[i + 2],16)) == -1 || (d2=Character.digit(src[i + 3],16)) == -1) {
++i;
c='x';
}
 else {
i+=3;
c=(char)((d1 << 4) + d2);
}
break;
}
default :
c=src[++i];
break;
}
}
}
}
buf.append(c);
}
return buf.toString();
}

Fixed version (ground truth):
/** 
 * Copies a string from index <from> to <to>, interpreting escape characters
 */
private String escapeString(String src,int from,int to){
  if (has_escape(src,from,to) == false) {
    return src.substring(from,to);
  }
  int len=to - from;
  final StringBuilder buf=new StringBuilder(len);
  for (int i=from; i < to; i++) {
    char c=src.charAt(i);
    if (c == '\\') {
      int c2=src.charAt(i + 1);
switch (c2) {
case '\'':
case '\"':
        continue;
case '\r':
      if (src.charAt(i + 2) == '\n') {
        i++;
      }
case '\n':
    i++;
  continue;
case '\\':
c='\\';
++i;
break;
case 'u':
{
int thisChar=0;
int y, digit;
for (y=i + 2; y < i + 6 && y < to + 1; y++) {
digit=Character.digit(src.charAt(y),16);
if (digit == -1) break;
thisChar=(thisChar << 4) + digit;
}
if (y != i + 6 || Character.isDefined((char)thisChar) == false) {
c=src.charAt(++i);
}
 else {
c=(char)thisChar;
i+=5;
}
break;
}
default :
{
if (PASS_ESCAPES_TO_BACKEND) {
c=src.charAt(++i);
break;
}
switch (c2) {
case 'b':
c='\b';
++i;
break;
case 'f':
c='\f';
++i;
break;
case 'n':
c='\n';
++i;
break;
case 'r':
c='\r';
++i;
break;
case 't':
c='\t';
++i;
break;
case 'v':
c=0xb;
++i;
break;
case 'x':
{
int d1, d2;
if (i + 4 > to || (d1=Character.digit(src.charAt(i + 2),16)) == -1 || (d2=Character.digit(src.charAt(i + 3),16)) == -1) {
++i;
c='x';
}
 else {
i+=3;
c=(char)((d1 << 4) + d2);
}
break;
}
default :
c=src.charAt(++i);
break;
}
}
}
}
buf.append(c);
}
return buf.toString();
}
Program: 45386
Project: 45386
Buggy source:
private CharBuffer createBuffer(InputStream in,String encoding){
}

Fixed version (ground truth):
private String createBuffer(InputStream in,String encoding){
}
Program: 45387
Project: 45387
Buggy source:
/** 
 * Advance the input cursor if advance is true.
 * @return the Unicode character class of the currentcharacter
 */
public char nextcharClass(char c,boolean advance){
  int distance=0;
  if (c == '\\' && text[textPos] == 'u') {
    int y, digit, thisChar=0;
    for (y=textPos + 1; y < textPos + 5 && y < text.length; y++) {
      digit=Character.digit(text[y],16);
      if (digit == -1)       break;
      thisChar=(thisChar << 4) + digit;
    }
    if (y == textPos + 5 && Character.isDefined((char)thisChar)) {
      c=(char)thisChar;
      distance=5;
    }
 else {
      distance=1;
    }
  }
  if (advance)   textPos+=distance;
  return javaTypeOfToCharacterClass(Character.getType(c));
}

Fixed version (ground truth):
/** 
 * Advance the input cursor if advance is true.
 * @return the Unicode character class of the currentcharacter
 */
public char nextcharClass(char c,boolean advance){
  int distance=0;
  if (c == '\\' && text.charAt(textPos) == 'u') {
    int y, digit, thisChar=0;
    for (y=textPos + 1; y < textPos + 5 && y < text.length(); y++) {
      digit=Character.digit(text.charAt(y),16);
      if (digit == -1)       break;
      thisChar=(thisChar << 4) + digit;
    }
    if (y == textPos + 5 && Character.isDefined((char)thisChar)) {
      c=(char)thisChar;
      distance=5;
    }
 else {
      distance=1;
    }
  }
  if (advance)   textPos+=distance;
  return javaTypeOfToCharacterClass(Character.getType(c));
}
Program: 45388
Project: 45388
Buggy source:
public String substringReplaceUnicodeEscapes(int begin,int end){
  int len=(end - begin) + 1;
  if (len <= 0)   return null;
  return escapeUnicode(text,begin,end);
}

Fixed version (ground truth):
public String substringReplaceUnicodeEscapes(int begin,int end){
  final int len=(end - begin);
  if (len <= 0)   return null;
  return escapeUnicode(text,begin,end);
}
Program: 45389
Project: 45389
Buggy source:
/** 
 * nextchar, advance pos
 */
public int nextchar(){
  int c;
  if (textPos >= text.length) {
    textPos=text.length + 1;
    return 0;
  }
  c=text[textPos++];
  return c;
}

Fixed version (ground truth):
/** 
 * nextchar, advance pos
 */
public int nextchar(){
  int c;
  if (textPos >= text.length()) {
    textPos=text.length() + 1;
    return 0;
  }
  c=text.charAt(textPos++);
  return c;
}
Program: 45390
Project: 45390
Buggy source:
public char markCharAt(int offset){
  return text[textMarkPos - offset];
}

Fixed version (ground truth):
public char markCharAt(int offset){
  return text.charAt(textMarkPos - offset);
}
Program: 45391
Project: 45391
Buggy source:
/** 
 * Binary search for nearest newline, given a position in text, note that lines start at 1 Returns 0 if pos is low, max if high
 * @param sourcePos -- file based source position, converted to text[pos]
 * @return line map index
 */
private int getLineMapIndex(int srcPos){
  int pos=srcPos - startSourcePos;
  if (pos < 0)   return 0;
  if (lineMap == null)   buildLineMap(text,text.length);
  if (pos == cachedLastLineMapPos)   return cachedLastLineMapIndex;
  cachedLastLineMapPos=pos;
  int low=0;
  int high=lineMap.length - 1;
  while (low <= high) {
    int mid=(low + high) >> 1;
    int midPos=lineMap[mid];
    if (midPos < pos)     low=mid + 1;
 else     if (midPos > pos)     high=mid - 1;
 else {
      cachedLastLineMapIndex=mid + 1;
      return cachedLastLineMapIndex;
    }
  }
  cachedLastLineMapIndex=low;
  return cachedLastLineMapIndex;
}

Fixed version (ground truth):
/** 
 * Binary search for nearest newline, given a position in text, note that lines start at 1 Returns 0 if pos is low, max if high
 * @param sourcePos -- file based source position, converted to text[pos]
 * @return line map index
 */
private int getLineMapIndex(int srcPos){
  int pos=srcPos - startSourcePos;
  if (pos < 0)   return 0;
  if (lineMap == null)   buildLineMap(text,text.length());
  if (pos == cachedLastLineMapPos)   return cachedLastLineMapIndex;
  cachedLastLineMapPos=pos;
  int low=0;
  int high=lineMap.length - 1;
  while (low <= high) {
    int mid=(low + high) >> 1;
    int midPos=lineMap[mid];
    if (midPos < pos)     low=mid + 1;
 else     if (midPos > pos)     high=mid - 1;
 else {
      cachedLastLineMapIndex=mid + 1;
      return cachedLastLineMapIndex;
    }
  }
  cachedLastLineMapIndex=low;
  return cachedLastLineMapIndex;
}
Program: 45392
Project: 45392
Buggy source:
private boolean has_escape(char[] src,int from,int to){
  for (int i=from; i <= to; i++) {
    if (src[i] == '\\') {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean has_escape(String src,int from,int to){
  for (int i=from; i < to; i++) {
    if (src.charAt(i) == '\\') {
      return true;
    }
  }
  return false;
}
Program: 45393
Project: 45393
Buggy source:
private String escapeUnicode(char[] src,int from,int to){
  int len=1 + to - from;
  if (has_u_escape(src,from,to) == false) {
    return String.valueOf(src,from,len);
  }
  final StringBuilder buf=new StringBuilder(len);
  for (int i=from; i <= to; i++) {
    char c=src[i];
    if (c == '\\' && i < to) {
      if (src[i + 1] == 'u') {
        int thisChar=0;
        int y, digit;
        for (y=i + 2; y < i + 6 && y < to + 1; y++) {
          digit=Character.digit(src[y],16);
          if (digit == -1)           break;
          thisChar=(thisChar << 4) + digit;
        }
        if (y != i + 6 || Character.isDefined((char)thisChar) == false) {
          c=src[++i];
        }
 else {
          c=(char)thisChar;
          i+=5;
        }
      }
    }
    buf.append(c);
  }
  return buf.toString();
}

Fixed version (ground truth):
private String escapeUnicode(String src,int from,int to){
  if (has_u_escape(src,from,to) == false) {
    return src.substring(from,to);
  }
  final int len=to - from;
  final StringBuilder buf=new StringBuilder(len);
  for (int i=from; i < to; i++) {
    char c=src.charAt(i);
    if (c == '\\' && i < to) {
      if (src.charAt(i + 1) == 'u') {
        int thisChar=0;
        int y, digit;
        for (y=i + 2; y < i + 6 && y < to + 1; y++) {
          digit=Character.digit(src.charAt(y),16);
          if (digit == -1)           break;
          thisChar=(thisChar << 4) + digit;
        }
        if (y != i + 6 || Character.isDefined((char)thisChar) == false) {
          c=src.charAt(++i);
        }
 else {
          c=(char)thisChar;
          i+=5;
        }
      }
    }
    buf.append(c);
  }
  return buf.toString();
}
Program: 45394
Project: 45394
Buggy source:
private boolean has_u_escape(char[] src,int from,int to){
  for (int i=from; i <= to; i++) {
    if (src[i] == '\\' && i < to && src[i + 1] == 'u') {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean has_u_escape(String src,int from,int to){
  for (int i=from; i < to; i++) {
    if (src.charAt(i) == '\\' && i < to && src.charAt(i + 1) == 'u') {
      return true;
    }
  }
  return false;
}
Program: 45395
Project: 45395
Buggy source:
public void setPosition(int lnNum,int colPos,int pos){
  super.setPosition(lnNum,colPos,pos);
  if (emit_debug_info) {
    if (pos > 0) {
      if (debug_info.debug_linenum != lnNum) {
        debug_info.debug_linenum_dirty=true;
        debug_info.debug_linenum=lnNum;
      }
    }
 else {
      debug_info.debug_linenum=-1;
    }
  }
}

Fixed version (ground truth):
public void setPosition(int lnNum,int colPos,int pos){
  super.setPosition(lnNum,colPos,pos);
  if ((emit_debug_info) && (pos > 0) && (debug_info.debug_linenum != lnNum)) {
    debug_info.debug_linenum_dirty=true;
    debug_info.debug_linenum=lnNum;
  }
}
Program: 45397
Project: 45397
Buggy source:
public static String getRefName(Context cx,ReferenceValue ref){
  Slot s=ref.getSlot(cx,GET_TOKEN);
  if (s == null || s.getDebugName().length() == 0) {
    String name=ref.name;
    if (ref.type_params != null && s != null && s.getValue() instanceof TypeValue) {
      TypeValue t=(TypeValue)s.getValue();
      name+="String_Node_Str" + t.indexed_type;
    }
    return name;
  }
 else {
    return s.getDebugName();
  }
}

Fixed version (ground truth):
public static String getRefName(Context cx,ReferenceValue ref){
  Slot s=ref.getSlot(cx,GET_TOKEN);
  if (s == null || s.getDebugName().length() == 0) {
    String name=ref.name;
    if (ref.type_params != null && s != null && s.getValue() instanceof TypeValue) {
      TypeValue t=(TypeValue)s.getValue();
      name+=getIndexedTypeName(cx,t.indexed_type);
    }
    return name;
  }
 else {
    return s.getDebugName();
  }
}
Program: 45399
Project: 45399
Buggy source:
public IdentifierNode parseSimpleQualifiedIdentifier(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  IdentifierNode result=null;
  IdentifierNode first;
  boolean is_attr;
  if (HAS_ATTRIBUTEIDENTIFIERS && lookahead(AMPERSAND_TOKEN)) {
    match(AMPERSAND_TOKEN);
    is_attr=true;
  }
 else {
    is_attr=false;
  }
  if (is_attr && lookahead(LEFTBRACKET_TOKEN)) {
    MemberExpressionNode men=parseBrackets(null);
    GetExpressionNode gen=men.selector instanceof GetExpressionNode ? (GetExpressionNode)men.selector : null;
    result=nodeFactory.qualifiedExpression(null,gen.expr,gen.expr.pos());
  }
 else {
    first=parseQualifier();
    if (HAS_QUALIFIEDIDENTIFIERS && lookahead(DOUBLECOLON_TOKEN)) {
      match(DOUBLECOLON_TOKEN);
      MemberExpressionNode temp;
      temp=nodeFactory.memberExpression(null,nodeFactory.getExpression(first));
      if (lookahead(LEFTBRACKET_TOKEN)) {
        MemberExpressionNode men=parseBrackets(null);
        GetExpressionNode gen=men.selector instanceof GetExpressionNode ? (GetExpressionNode)men.selector : null;
        result=nodeFactory.qualifiedExpression(temp,gen.expr,gen.expr.pos());
      }
 else {
        QualifiedIdentifierNode qualid=nodeFactory.qualifiedIdentifier(temp,parsePropertyIdentifier());
        if (config_namespaces.last().contains(first.name))         qualid.is_config_name=true;
        result=qualid;
        result.setOrigTypeToken(DOUBLECOLON_TOKEN);
      }
    }
 else {
      result=first;
    }
  }
  result.setAttr(is_attr);
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
public IdentifierNode parseSimpleQualifiedIdentifier(){
}
Program: 45400
Project: 45400
Buggy source:
public NamespaceDefinitionNode parseConfigNamespaceDefinition(AttributeListNode first){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  NamespaceDefinitionNode result;
  match(NAMESPACE_TOKEN);
  IdentifierNode second=parseIdentifier();
  result=nodeFactory.configNamespaceDefinition(first,second,-1);
  config_namespaces.last().add(result.name.name);
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
public NamespaceDefinitionNode parseConfigNamespaceDefinition(AttributeListNode first){
}
Program: 45401
Project: 45401
Buggy source:
public Node parseFieldOrConfigName(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  Node result;
  if (HAS_NONIDENTFIELDNAMES && lookahead(STRINGLITERAL_TOKEN)) {
    boolean[] is_single_quoted=new boolean[1];
    String enclosedText=scanner.getStringTokenText(match(STRINGLITERAL_TOKEN),is_single_quoted);
    result=nodeFactory.literalString(enclosedText,ctx.input.positionOfMark(),is_single_quoted[0]);
  }
 else   if (HAS_NONIDENTFIELDNAMES && lookahead(NUMBERLITERAL_TOKEN)) {
    result=nodeFactory.literalNumber(scanner.getTokenText(match(NUMBERLITERAL_TOKEN)),ctx.input.positionOfMark());
  }
 else   if (HAS_NONIDENTFIELDNAMES && lookahead(LEFTPAREN_TOKEN)) {
    result=parseParenExpression();
  }
 else {
    IdentifierNode ident=parseIdentifier();
    if (config_namespaces.last().contains(ident.name) && lookahead(DOUBLECOLON_TOKEN)) {
      match(DOUBLECOLON_TOKEN);
      QualifiedIdentifierNode qualid=nodeFactory.qualifiedIdentifier(ident,parseIdentifier());
      qualid.is_config_name=true;
      result=qualid;
    }
 else {
      result=ident;
    }
  }
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
public Node parseFieldOrConfigName(){
}
Program: 45404
Project: 45404
Buggy source:
public StringBuffer toCanonicalString(Context cx,StringBuffer buf){
  Slot s=ref.getSlot(cx,GET_TOKEN);
  buf.append((s == null || s.getDebugName().length() == 0) ? ref.name : s.getDebugName());
  return buf;
}

Fixed version (ground truth):
public StringBuffer toCanonicalString(Context cx,StringBuffer buf){
  buf.append(DocCommentNode.getRefName(cx,ref));
  return buf;
}
Program: 45411
Project: 45411
Buggy source:
public void addParameterizedTypeSlot(Context cx,Slot s){
  if (types == null)   types=new ObjectList<Slot>();
  types.add(s);
}

Fixed version (ground truth):
public void addParameterizedTypeSlot(Context cx,String name,Slot s){
  if (types == null)   types=new HashMap<String,Slot>();
  types.put(name,s);
}
Program: 45412
Project: 45412
Buggy source:
public long insert_garden(String name,int previewId,String bounds,String city,String state,int serverId,int is_public,String images){
  this.insertStmt_garden.clearBindings();
  this.insertStmt_garden.bindString(1,name);
  this.insertStmt_garden.bindLong(2,(long)previewId);
  this.insertStmt_garden.bindString(3,bounds);
  this.insertStmt_garden.bindString(4,city);
  this.insertStmt_garden.bindString(5,state);
  this.insertStmt_garden.bindLong(6,(long)serverId);
  this.insertStmt_garden.bindLong(7,(long)is_public);
  this.insertStmt_garden.bindString(8,images);
  return this.insertStmt_garden.executeInsert();
}

Fixed version (ground truth):
public long insert_garden(String name,int previewId,String bounds,String city,String state,int serverId,int is_public,String images){
  this.insertStmt_garden.clearBindings();
  this.insertStmt_garden.bindString(1,name);
  this.insertStmt_garden.bindLong(2,(long)previewId);
  this.insertStmt_garden.bindString(3,bounds);
  if (city == null)   city="String_Node_Str";
  if (state == null)   state="String_Node_Str";
  this.insertStmt_garden.bindString(4,city);
  this.insertStmt_garden.bindString(5,state);
  this.insertStmt_garden.bindLong(6,(long)serverId);
  this.insertStmt_garden.bindLong(7,(long)is_public);
  this.insertStmt_garden.bindString(8,images);
  return this.insertStmt_garden.executeInsert();
}
Program: 45413
Project: 45413
Buggy source:
/** 
 * downloads entire garden and adds it to the local database 
 */
public Garden getGarden(String serverId){
  HttpClient httpclient=new DefaultHttpClient();
  HttpGet httpget=new HttpGet(getString(R.string.server_url) + "String_Node_Str" + serverId+ "String_Node_Str");
  String result="String_Node_Str";
  try {
    HttpResponse response=httpclient.execute(httpget);
    HttpEntity entity=response.getEntity();
    result=EntityUtils.toString(entity);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
  System.out.println("String_Node_Str" + result);
  Garden garden=gson.fromJson(result,Garden.class);
  GardenGnome.addGarden(garden);
  getPlots(garden);
  getImages(garden);
  return garden;
}

Fixed version (ground truth):
/** 
 * downloads entire garden and adds it to the local database 
 */
public Garden getGarden(String serverId){
  HttpClient httpclient=new DefaultHttpClient();
  HttpGet httpget=new HttpGet(getString(R.string.server_url) + "String_Node_Str" + serverId+ "String_Node_Str");
  String result="String_Node_Str";
  try {
    HttpResponse response=httpclient.execute(httpget);
    HttpEntity entity=response.getEntity();
    result=EntityUtils.toString(entity);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
  System.out.println("String_Node_Str" + result);
  Garden garden=gson.fromJson(result,Garden.class);
  GardenGnome.addGardenServer(garden);
  getPlots(garden);
  getImages(garden);
  return garden;
}
Program: 45414
Project: 45414
Buggy source:
public void onClick(DialogInterface dialog,int whichButton){
  EditText textEntry=((EditText)textEntryView.findViewById(R.id.dialog_text_entry));
  String gardenName=textEntry.getText().toString().trim();
  if (gardenName.length() == 0)   gardenName="String_Node_Str";
  Intent intent=new Intent(this,GardenScreen.class);
  intent.putExtra("String_Node_Str",gardens.size());
  Garden garden=new Garden(gardenName);
  GardenGnome.addGarden(garden);
  adapter.notifyDataSetChanged();
  startActivityForResult(intent,0);
  new Thread(setLocation).start();
  removeDialog(0);
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int whichButton){
  EditText textEntry=((EditText)textEntryView.findViewById(R.id.dialog_text_entry));
  String gardenName=textEntry.getText().toString().trim();
  if (gardenName.length() == 0)   gardenName="String_Node_Str";
  Intent intent=new Intent(this,GardenScreen.class);
  intent.putExtra("String_Node_Str",gardens.size());
  Garden garden=new Garden(gardenName);
  GardenGnome.addGardenServer(garden);
  adapter.notifyDataSetChanged();
  startActivityForResult(intent,0);
  new Thread(setLocation).start();
  removeDialog(0);
}
Program: 45415
Project: 45415
Buggy source:
/** 
 * TODO: should manually set the id of the garden 
 */
public static void addGarden(Garden garden){
  gardens.add(garden);
  garden.setGardenNum(dh.count_garden());
  System.out.println("String_Node_Str" + dh.count_garden());
  dh.insert_garden(garden.getName(),R.drawable.preview,"String_Node_Str","String_Node_Str","String_Node_Str",0,-1,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * TODO: should manually set the id of the garden 
 */
public static void addGarden(Garden garden){
  dh.insert_garden(garden.getName(),R.drawable.preview,"String_Node_Str","String_Node_Str","String_Node_Str",0,-1,"String_Node_Str");
  garden.setGardenNum(dh.count_garden());
  gardens.add(garden);
  System.out.println("String_Node_Str" + dh.count_garden());
}
Program: 45416
Project: 45416
Buggy source:
public static void addEntry(int pa_pk,Plant plant,Entry entry){
  plant.addEntry(entry);
  entry.setEntryNum(dh.count_entry());
  System.out.println("String_Node_Str" + dh.count_entry());
  dh.insert_entry(entry.getName(),entry.getDate() + "String_Node_Str",entry.getServerId());
  dh.insert_map_pe(pa_pk,dh.count_entry());
}

Fixed version (ground truth):
public static void addEntry(int pa_pk,Plant plant,Entry entry){
  dh.insert_entry(entry.getName(),entry.getDate() + "String_Node_Str",entry.getServerId());
  dh.insert_map_pe(pa_pk,dh.count_entry());
  entry.setEntryNum(dh.count_entry());
  plant.addEntry(entry);
  System.out.println("String_Node_Str" + dh.count_entry());
}
Program: 45417
Project: 45417
Buggy source:
public static void addPlant(int po_pk,String name,Plot plot){
  Plant temp=new Plant(name);
  plot.addPlant(temp);
  temp.setPlantNum(dh.count_plant());
  System.out.println("String_Node_Str" + dh.count_plant());
  dh.insert_plant(name,0);
  dh.insert_map_pp(po_pk,dh.count_plant());
}

Fixed version (ground truth):
public static void addPlant(int po_pk,String name,Plot plot){
  dh.insert_plant(name,0);
  dh.insert_map_pp(po_pk,dh.count_plant());
  Plant temp=new Plant(name);
  temp.setPlantNum(dh.count_plant());
  plot.addPlant(temp);
  System.out.println("String_Node_Str" + dh.count_plant());
}
Program: 45418
Project: 45418
Buggy source:
public void createPolyPlot(){
  float[] pts=toFloatArray(editView.polyPts);
  plot.set(new Plot(plot.getName(),pts));
  plot.getPaint().setStrokeWidth(getResources().getDimension(R.dimen.strokesize_edit));
  oldPlot.set(plot);
  ((Button)findViewById(R.id.save_btn)).setText(R.string.btn_save_edit);
  if (hintsOn) {
    TextView hint=(TextView)findViewById(R.id.edit_hint);
    hint.setText(R.string.hint_editscreen);
  }
  String polyPoints_s="String_Node_Str";
  for (int i=0; i < pts.length; i++)   polyPoints_s+=pts[i];
  createPoly=false;
  editView.invalidate();
}

Fixed version (ground truth):
public void createPolyPlot(){
  float[] pts=toFloatArray(editView.polyPts);
  plot.set(new Plot(plot.getName(),pts));
  plot.getPaint().setStrokeWidth(getResources().getDimension(R.dimen.strokesize_edit));
  oldPlot.set(plot);
  ((Button)findViewById(R.id.save_btn)).setText(R.string.btn_save_edit);
  if (hintsOn) {
    TextView hint=(TextView)findViewById(R.id.edit_hint);
    hint.setText(R.string.hint_editscreen);
  }
  createPoly=false;
  editView.invalidate();
}
Program: 45419
Project: 45419
Buggy source:
public void createPlot(){
  RectF gBounds=garden.getRawBounds();
  if (garden.isEmpty()) {
    int width=getWindowManager().getDefaultDisplay().getWidth();
    int height=getWindowManager().getDefaultDisplay().getHeight();
    gBounds=new RectF(0,0,width,height);
  }
  int type=extras.getInt("String_Node_Str");
  String name=extras.getString("String_Node_Str");
  Rect bounds=new Rect((int)gBounds.left,(int)gBounds.top,(int)gBounds.right,(int)gBounds.bottom);
  bounds.inset((int)gBounds.width() / 3,(int)gBounds.height() / 3);
  if (type == Plot.POLY)   plot=new Plot(name,bounds,new float[]{0,0});
 else   plot=new Plot(name,bounds,type);
  GardenGnome.addPlot(garden,plot);
  garden.refreshBounds();
  String bounds_s="String_Node_Str" + garden.getBounds().left + "String_Node_Str"+ garden.getBounds().top+ "String_Node_Str"+ garden.getBounds().right+ "String_Node_Str"+ garden.getBounds().bottom;
  GardenGnome.tmpupdateGarden(extras.getInt("String_Node_Str"),bounds_s);
}

Fixed version (ground truth):
public void createPlot(){
  RectF gBounds=garden.getRawBounds();
  if (garden.isEmpty()) {
    int width=getWindowManager().getDefaultDisplay().getWidth();
    int height=getWindowManager().getDefaultDisplay().getHeight();
    gBounds=new RectF(0,0,width,height);
  }
  int type=extras.getInt("String_Node_Str");
  String name=extras.getString("String_Node_Str");
  Rect bounds=new Rect((int)gBounds.left,(int)gBounds.top,(int)gBounds.right,(int)gBounds.bottom);
  bounds.inset((int)gBounds.width() / 3,(int)gBounds.height() / 3);
  if (type == Plot.POLY)   plot=new Plot(name,bounds,new float[]{0,0});
 else   plot=new Plot(name,bounds,type);
  GardenGnome.addPlot(garden,plot);
  if (garden.getPlots().size() == 1) {
    garden.refreshBounds();
    String bounds_s="String_Node_Str" + garden.getBounds().left + "String_Node_Str"+ garden.getBounds().top+ "String_Node_Str"+ garden.getBounds().right+ "String_Node_Str"+ garden.getBounds().bottom;
    GardenGnome.tmpupdateGarden(extras.getInt("String_Node_Str"),bounds_s);
  }
}
Program: 45420
Project: 45420
Buggy source:
@Override public void onBackPressed(){
  if (createPoly && editView.polyPts.size() >= 6) {
    createPolyPlot();
    return;
  }
  if (createPoly)   garden.remove(plot);
  garden.remove(oldPlot);
  plot.getPaint().setStrokeWidth(getResources().getDimension(R.dimen.strokesize_default));
  Intent intent=new Intent().putExtra("String_Node_Str",editView.zoomScale);
  float[] values=new float[9], bgvalues=new float[9];
  editView.dragMatrix.getValues(values);
  editView.bgDragMatrix.getValues(bgvalues);
  intent.putExtra("String_Node_Str",values);
  intent.putExtra("String_Node_Str",bgvalues);
  setResult(RESULT_OK,intent);
  GardenGnome.updatePlot(extras.getInt("String_Node_Str"),plot);
  finish();
  overridePendingTransition(0,0);
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (createPoly && editView.polyPts.size() >= 6) {
    createPolyPlot();
    return;
  }
  if (createPoly)   garden.remove(plot);
  System.out.println("String_Node_Str" + garden.getBounds().toString());
  garden.remove(oldPlot);
  plot.getPaint().setStrokeWidth(getResources().getDimension(R.dimen.strokesize_default));
  Intent intent=new Intent().putExtra("String_Node_Str",editView.zoomScale);
  float[] values=new float[9], bgvalues=new float[9];
  editView.dragMatrix.getValues(values);
  editView.bgDragMatrix.getValues(bgvalues);
  intent.putExtra("String_Node_Str",values);
  intent.putExtra("String_Node_Str",bgvalues);
  setResult(RESULT_OK,intent);
  GardenGnome.updatePlot(extras.getInt("String_Node_Str"),plot);
  finish();
  overridePendingTransition(0,0);
}
Program: 45421
Project: 45421
Buggy source:
public void getImages(Garden garden){
  HttpClient httpclient=new DefaultHttpClient();
  HttpGet httpget=new HttpGet(getString(R.string.server_url) + "String_Node_Str" + garden.getServerId()+ "String_Node_Str");
  String result="String_Node_Str";
  try {
    HttpResponse response=httpclient.execute(httpget);
    HttpEntity entity=response.getEntity();
    result=EntityUtils.toString(entity);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  System.out.println("String_Node_Str" + result);
  Photo[] photos=gson.fromJson(result,Photo[].class);
  try {
    digester=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    return;
  }
  String accessKey="String_Node_Str";
  String secretKey="String_Node_Str";
  if (s3 == null) {
    BasicAWSCredentials credentials=new BasicAWSCredentials(accessKey,secretKey);
    s3=new AmazonS3Client(credentials);
  }
  for (  Photo photo : photos) {
    String code=garden.getServerId() + "String_Node_Str" + photo.getServerId()+ "String_Node_Str"+ accessKey;
    String fileName=hexCode(code) + "String_Node_Str";
    Uri imageUri=writeBitmap2(fileName);
    photo.setUri(imageUri);
    garden.addImage(photo);
  }
}

Fixed version (ground truth):
public void getImages(Garden garden){
  String state=Environment.getExternalStorageState();
  System.out.println("String_Node_Str" + state);
  if (!state.equals(Environment.MEDIA_MOUNTED))   return;
  HttpClient httpclient=new DefaultHttpClient();
  HttpGet httpget=new HttpGet(getString(R.string.server_url) + "String_Node_Str" + garden.getServerId()+ "String_Node_Str");
  String result="String_Node_Str";
  try {
    HttpResponse response=httpclient.execute(httpget);
    HttpEntity entity=response.getEntity();
    result=EntityUtils.toString(entity);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  System.out.println("String_Node_Str" + result);
  Photo[] photos=gson.fromJson(result,Photo[].class);
  try {
    digester=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    return;
  }
  String accessKey="String_Node_Str";
  String secretKey="String_Node_Str";
  if (s3 == null) {
    BasicAWSCredentials credentials=new BasicAWSCredentials(accessKey,secretKey);
    s3=new AmazonS3Client(credentials);
  }
  for (  Photo photo : photos) {
    String code=garden.getServerId() + "String_Node_Str" + photo.getServerId()+ "String_Node_Str"+ accessKey;
    String fileName=hexCode(code) + "String_Node_Str";
    Uri imageUri=writeBitmap2(fileName);
    photo.setUri(imageUri);
    garden.addImage(photo);
  }
}
Program: 45425
Project: 45425
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Intent intent=new Intent(this,GardenScreen.class);
  intent.putExtra("String_Node_Str",gardens.get(position).getId());
  startActivityForResult(intent,0);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Intent intent=new Intent(this,GardenScreen.class);
  System.out.println("String_Node_Str" + gardens.get(position).getId());
  intent.putExtra("String_Node_Str",gardens.get(position).getId());
  startActivityForResult(intent,0);
}
Program: 45426
Project: 45426
Buggy source:
public void createPlot(){
  RectF gBounds=mockGarden.getRawBounds();
  int type=extras.getInt("String_Node_Str");
  String name=extras.getString("String_Node_Str");
  Rect bounds=new Rect((int)gBounds.left,(int)gBounds.top,(int)gBounds.right,(int)gBounds.bottom);
  bounds.inset((int)gBounds.width() / 3,(int)gBounds.height() / 3);
  if (type == Plot.POLY)   plot=new Plot(name,bounds,new float[]{0,0});
 else   plot=new Plot(name,bounds,type);
  mockGarden.addPlot(plot);
}

Fixed version (ground truth):
public void createPlot(){
  RectF gBounds=mockGarden.getRawBounds();
  if (mockGarden.isEmpty()) {
    int width=getWindowManager().getDefaultDisplay().getWidth();
    int height=getWindowManager().getDefaultDisplay().getHeight();
    gBounds=new RectF(0,0,width,height);
  }
  int type=extras.getInt("String_Node_Str");
  String name=extras.getString("String_Node_Str");
  Rect bounds=new Rect((int)gBounds.left,(int)gBounds.top,(int)gBounds.right,(int)gBounds.bottom);
  bounds.inset((int)gBounds.width() / 3,(int)gBounds.height() / 3);
  System.out.println(bounds);
  if (type == Plot.POLY)   plot=new Plot(name,bounds,new float[]{0,0});
 else   plot=new Plot(name,bounds,type);
  mockGarden.addPlot(plot);
  mockGarden.refreshBounds();
}
Program: 45427
Project: 45427
Buggy source:
Garden(int resId,String gardenName){
  name=gardenName;
  previewId=resId;
}

Fixed version (ground truth):
Garden(int resId,String gardenName){
  bounds=new RectF(0,0,800,480);
  name=gardenName;
  previewId=resId;
}
Program: 45428
Project: 45428
Buggy source:
@Override public void onClick(View view){
  EditText et_plot_name=(EditText)findViewById(R.id.et_plot_name);
  if (view.getId() == R.id.b_add_cancel) {
    getIntent().putExtras(new Bundle());
    setResult(RESULT_CANCELED,getIntent());
    finish();
  }
 else   if (et_plot_name.getText().length() == 0)   Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
 else {
    Intent intent=new Intent(this,EditScreen.class);
    Bundle bundle=new Bundle();
    int radioId=((RadioGroup)findViewById(R.id.rg_shape)).getCheckedRadioButtonId();
    int shapeType;
switch (radioId) {
case R.id.rb_rectangle:
      shapeType=Plot.RECT;
    break;
case R.id.rb_ellipse:
  shapeType=Plot.OVAL;
break;
default :
shapeType=Plot.POLY;
break;
}
bundle.putString("String_Node_Str",et_plot_name.getText().toString());
bundle.putInt("String_Node_Str",shapeType);
intent.putExtras(bundle);
setResult(RESULT_OK,intent);
finish();
}
}

Fixed version (ground truth):
@Override public void onClick(View view){
  EditText et_plot_name=(EditText)findViewById(R.id.et_plot_name);
  if (view.getId() == R.id.b_add_cancel)   finish();
 else   if (et_plot_name.getText().length() == 0)   Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
 else {
    Intent intent=new Intent(this,EditScreen.class);
    Bundle bundle=new Bundle();
    int radioId=((RadioGroup)findViewById(R.id.rg_shape)).getCheckedRadioButtonId();
    int shapeType;
switch (radioId) {
case R.id.rb_rectangle:
      shapeType=Plot.RECT;
    break;
case R.id.rb_ellipse:
  shapeType=Plot.OVAL;
break;
default :
shapeType=Plot.POLY;
break;
}
bundle.putString("String_Node_Str",et_plot_name.getText().toString());
bundle.putInt("String_Node_Str",shapeType);
intent.putExtras(bundle);
setResult(RESULT_OK,intent);
finish();
}
}
Program: 45429
Project: 45429
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  Bundle extras=data.getExtras();
  if (extras.containsKey("String_Node_Str")) {
    extras.putInt("String_Node_Str",StartScreen.gardens.indexOf(mockGarden));
    extras.putInt("String_Node_Str",zoomLevel);
    float[] values=new float[9], bgvalues=new float[9];
    gardenView.dragMatrix.getValues(values);
    gardenView.bgDragMatrix.getValues(bgvalues);
    extras.putFloatArray("String_Node_Str",values);
    extras.putFloatArray("String_Node_Str",bgvalues);
    data.putExtras(extras);
    startActivityForResult(data,0);
    overridePendingTransition(0,0);
  }
 else   if (extras.containsKey("String_Node_Str")) {
    zoomLevel=extras.getInt("String_Node_Str");
    gardenView.dragMatrix.setValues(extras.getFloatArray("String_Node_Str"));
    gardenView.bgDragMatrix.setValues(extras.getFloatArray("String_Node_Str"));
    gardenView.onAnimationEnd();
    if (zoomAutoHidden)     zoom.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (data != null) {
    Bundle extras=data.getExtras();
    if (extras.containsKey("String_Node_Str")) {
      extras.putInt("String_Node_Str",StartScreen.gardens.indexOf(mockGarden));
      extras.putInt("String_Node_Str",zoomLevel);
      float[] values=new float[9], bgvalues=new float[9];
      gardenView.dragMatrix.getValues(values);
      gardenView.bgDragMatrix.getValues(bgvalues);
      extras.putFloatArray("String_Node_Str",values);
      extras.putFloatArray("String_Node_Str",bgvalues);
      data.putExtras(extras);
      startActivityForResult(data,0);
      overridePendingTransition(0,0);
    }
 else     if (extras.containsKey("String_Node_Str")) {
      zoomLevel=extras.getInt("String_Node_Str");
      gardenView.dragMatrix.setValues(extras.getFloatArray("String_Node_Str"));
      gardenView.bgDragMatrix.setValues(extras.getFloatArray("String_Node_Str"));
      gardenView.onAnimationEnd();
      if (zoomAutoHidden)       zoom.setVisibility(View.GONE);
    }
  }
}
Program: 45430
Project: 45430
Buggy source:
@Override public void onClick(View view){
  handleZoom();
  if (zoomPressed == 0) {
    zoomPressed=1;
    float zoomScalar=1 / getResources().getDimension(R.dimen.zoom_scalar);
    ScaleAnimation anim=new ScaleAnimation(1,zoomScalar,1,zoomScalar,editView.getWidth() / 2f,editView.getHeight() / 2f);
    anim.setDuration(getResources().getInteger(R.integer.zoom_duration));
    editView.startAnimation(anim);
  }
}

Fixed version (ground truth):
@Override public void onClick(View view){
  handleZoom();
  if (zoomPressed == 0) {
    zoomPressed=-1;
    float zoomScalar=1 / getResources().getDimension(R.dimen.zoom_scalar);
    ScaleAnimation anim=new ScaleAnimation(1,zoomScalar,1,zoomScalar,editView.getWidth() / 2f,editView.getHeight() / 2f);
    anim.setDuration(getResources().getInteger(R.integer.zoom_duration));
    editView.startAnimation(anim);
  }
}
Program: 45431
Project: 45431
Buggy source:
@Override public void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  gardenView.zoomScale=savedInstanceState.getFloat("String_Node_Str");
  boolean prevPortraitMode=savedInstanceState.getBoolean("String_Node_Str");
  int orien=getResources().getConfiguration().orientation;
  float[] values=savedInstanceState.getFloatArray("String_Node_Str");
  float[] bgvalues=savedInstanceState.getFloatArray("String_Node_Str");
  if (orien == Configuration.ORIENTATION_PORTRAIT && !prevPortraitMode) {
    float tmp=values[Matrix.MTRANS_X];
    values[Matrix.MTRANS_X]=-values[Matrix.MTRANS_Y];
    values[Matrix.MTRANS_Y]=tmp;
    tmp=bgvalues[Matrix.MTRANS_X];
    bgvalues[Matrix.MTRANS_X]=-bgvalues[Matrix.MTRANS_Y];
    bgvalues[Matrix.MTRANS_Y]=tmp;
  }
 else   if (orien == Configuration.ORIENTATION_LANDSCAPE && prevPortraitMode) {
    float tmp=values[Matrix.MTRANS_X];
    values[Matrix.MTRANS_X]=values[Matrix.MTRANS_Y];
    values[Matrix.MTRANS_Y]=-tmp;
    tmp=bgvalues[Matrix.MTRANS_X];
    bgvalues[Matrix.MTRANS_X]=bgvalues[Matrix.MTRANS_Y];
    bgvalues[Matrix.MTRANS_Y]=-tmp;
  }
  gardenView.dragMatrix.setValues(values);
  gardenView.bgDragMatrix.setValues(savedInstanceState.getFloatArray("String_Node_Str"));
  gardenView.onAnimationEnd();
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  gardenView.zoomScale=savedInstanceState.getFloat("String_Node_Str");
  boolean prevPortraitMode=savedInstanceState.getBoolean("String_Node_Str");
  int orien=getResources().getConfiguration().orientation;
  float[] values=savedInstanceState.getFloatArray("String_Node_Str");
  float[] bgvalues=savedInstanceState.getFloatArray("String_Node_Str");
  if (orien == Configuration.ORIENTATION_PORTRAIT && !prevPortraitMode) {
    float tmp=values[Matrix.MTRANS_X];
    values[Matrix.MTRANS_X]=-values[Matrix.MTRANS_Y];
    values[Matrix.MTRANS_Y]=tmp;
    tmp=bgvalues[Matrix.MTRANS_X];
    bgvalues[Matrix.MTRANS_X]=-bgvalues[Matrix.MTRANS_Y];
    bgvalues[Matrix.MTRANS_Y]=tmp;
  }
 else   if (orien == Configuration.ORIENTATION_LANDSCAPE && prevPortraitMode) {
    float tmp=values[Matrix.MTRANS_X];
    values[Matrix.MTRANS_X]=values[Matrix.MTRANS_Y];
    values[Matrix.MTRANS_Y]=-tmp;
    tmp=bgvalues[Matrix.MTRANS_X];
    bgvalues[Matrix.MTRANS_X]=bgvalues[Matrix.MTRANS_Y];
    bgvalues[Matrix.MTRANS_Y]=-tmp;
  }
  gardenView.dragMatrix.setValues(values);
  gardenView.bgDragMatrix.setValues(bgvalues);
  gardenView.onAnimationEnd();
}