nus-yam/ex-repair huggingface dataset:
Program: 44860
Project: 44860
Buggy source:
private static Pattern[] readPatterns(ByteReader reader,int n,ModFormat format,Instrument[] ins){
  Pattern[] patterns=new Pattern[n];
  for (int i=0; i < n; i++) {
    if (format.type == trekker && format.tracks == 8) {
      Pattern pattern1=readPattern(reader,format.type,4);
      Pattern pattern2=readPattern(reader,format.type,4);
      if (pattern1 == null || pattern2 == null)       return null;
      patterns[i]=new Pattern(8,64);
      for (int row=0; row < 64; row++) {
        for (int track=0; track < 4; track++) {
          patterns[i].setNote(track,row,pattern1.getNote(track,row));
          patterns[i].setNote(track + 4,row,pattern2.getNote(track,row));
        }
      }
    }
 else {
      patterns[i]=readPattern(reader,format.type,format.tracks);
      if (patterns[i] == null)       return null;
    }
  }
  return patterns;
}

Fixed version (ground truth):
private static Pattern[] readPatterns(ByteReader reader,int n,ModFormat format){
  Pattern[] patterns=new Pattern[n];
  for (int i=0; i < n; i++) {
    if (format.type == trekker && format.tracks == 8) {
      Pattern pattern1=readPattern(reader,format.type,4);
      Pattern pattern2=readPattern(reader,format.type,4);
      if (pattern1 == null || pattern2 == null)       return null;
      patterns[i]=new Pattern(8,64);
      for (int row=0; row < 64; row++) {
        for (int track=0; track < 4; track++) {
          patterns[i].setNote(track,row,pattern1.getNote(track,row));
          patterns[i].setNote(track + 4,row,pattern2.getNote(track,row));
        }
      }
    }
 else {
      patterns[i]=readPattern(reader,format.type,format.tracks);
      if (patterns[i] == null)       return null;
    }
  }
  return patterns;
}
Program: 44861
Project: 44861
Buggy source:
public static long create(int key,int instrument,int effect,int param,boolean hold){
  key=Tools.crop(key,0,128);
  long x=hold && key < 128 ? holdMask : 0;
  x|=(instrument & 0xFFFL) << 40;
  x|=(key & 0xFFL) << 32;
  x|=(effect & 0xFFFFL) << 16;
  x|=param & 0xFFFFL;
  return x;
}

Fixed version (ground truth):
public static long create(int key,int instrument,int effect,int param){
  return create(key,instrument,effect,param,false);
}
Program: 44862
Project: 44862
Buggy source:
@Override public String createMetadata(Object nativeItem) throws CannotDisseminateFormatException {
  try {
    DatasetRecordBean dataset=(DatasetRecordBean)nativeItem;
    String result=XMLUtil.toXMLString(dataset.getMetadata(),"String_Node_Str");
    return result;
  }
 catch (  Exception e) {
    throw (CannotDisseminateFormatException)new CannotDisseminateFormatException(METADATA_PREFIX).initCause(e);
  }
}

Fixed version (ground truth):
@Override public String createMetadata(Object nativeItem) throws CannotDisseminateFormatException {
  try {
    DatasetRecordBean dataset=(DatasetRecordBean)nativeItem;
    ServiceCollection services=ServiceCollection.getInstance();
    TransformerService service=services.getTransformerService();
    String result=service.doTransformIdentity(dataset.getMetadata());
    result=XMLUtil.cleanXML(result);
    return result;
  }
 catch (  Exception e) {
    throw (CannotDisseminateFormatException)new CannotDisseminateFormatException(METADATA_PREFIX).initCause(e);
  }
}
Program: 44863
Project: 44863
Buggy source:
/** 
 * Builds an oai_datacite format representation of a record.
 * @param rec The record
 * @return XML metadata in oai_datacite format.
 */
private String buildDocument(DatasetRecordBean rec) throws UnsupportedEncodingException {
  StringBuilder doc=new StringBuilder();
  String[] attribs=new String[]{"String_Node_Str" + schemaNamespace + "String_Node_Str","String_Node_Str" + schemaNamespace + "String_Node_Str"+ schemaLocation+ "String_Node_Str"};
  String metadata=XMLUtil.toXMLString(rec.getMetadata(),"String_Node_Str");
  doc.append(openTagWithAttrib(rootElement,attribs));
  doc.append(openTag(rqElement));
  doc.append(rec.isRefQuality() ? "String_Node_Str" : "String_Node_Str");
  doc.append(closeTag(rqElement));
  doc.append(openTag(versionElement));
  doc.append(rec.getSchemaVersion());
  doc.append(closeTag(versionElement));
  doc.append(openTag(symbolElement));
  doc.append(StringEscapeUtils.escapeXml(rec.getSymbol()));
  doc.append(closeTag(symbolElement));
  doc.append(openTag(payloadElement));
  doc.append(metadata);
  doc.append(closeTag(payloadElement));
  doc.append(closeTag(rootElement));
  return doc.toString();
}

Fixed version (ground truth):
/** 
 * Builds an oai_datacite format representation of a record.
 * @param rec The record
 * @return XML metadata in oai_datacite format.
 */
private String buildDocument(DatasetRecordBean rec) throws UnsupportedEncodingException, ServiceException {
  StringBuilder doc=new StringBuilder();
  String[] attribs=new String[]{"String_Node_Str" + schemaNamespace + "String_Node_Str","String_Node_Str" + schemaNamespace + "String_Node_Str"+ schemaLocation+ "String_Node_Str"};
  ServiceCollection services=ServiceCollection.getInstance();
  TransformerService service=services.getTransformerService();
  String metadata=service.doTransformIdentity(rec.getMetadata());
  metadata=XMLUtil.cleanXML(metadata);
  doc.append(openTagWithAttrib(rootElement,attribs));
  doc.append(openTag(rqElement));
  doc.append(rec.isRefQuality() ? "String_Node_Str" : "String_Node_Str");
  doc.append(closeTag(rqElement));
  doc.append(openTag(versionElement));
  doc.append(rec.getSchemaVersion());
  doc.append(closeTag(versionElement));
  doc.append(openTag(symbolElement));
  doc.append(StringEscapeUtils.escapeXml(rec.getSymbol()));
  doc.append(closeTag(symbolElement));
  doc.append(openTag(payloadElement));
  doc.append(metadata);
  doc.append(closeTag(payloadElement));
  doc.append(closeTag(rootElement));
  return doc.toString();
}
Program: 44864
Project: 44864
Buggy source:
/** 
 * Transform DataCite Metadata Scheme to OAI Dubmin Core.
 * @param schemaVersion The schema verion being transformed.
 * @param metadata The metadata to transform
 * @return The resulting metadata as a String
 * @throws ServiceException
 */
public String doTransformKernelToOaidc(String schemaVersion,byte[] metadata) throws ServiceException {
  Templates transform=getTransform(schemaVersion);
  return doTransform_kernelToOaidc(metadata,transform,schemaVersion);
}

Fixed version (ground truth):
/** 
 * Transform DataCite Metadata Scheme to OAI Dubmin Core.
 * @param schemaVersion The schema verion being transformed.
 * @param metadata The metadata to transform
 * @return The resulting metadata as a String
 * @throws ServiceException
 */
public String doTransformKernelToOaidc(String schemaVersion,byte[] metadata) throws ServiceException {
  try {
    Templates transform=getTransform(schemaVersion);
    return doTransform(metadata,transform);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + schemaVersion + "String_Node_Str"+ metadata,e);
    throw new ServiceException("String_Node_Str" + schemaVersion + "String_Node_Str",e);
  }
}
Program: 44866
Project: 44866
Buggy source:
public boolean teleportTo(String pstring,Integer x,Integer y,Integer z,String world){
  if (tcutils == null)   tcutils=TweakcraftUtils.getInstance();
  Player player=plugin.getServer().getPlayerExact(pstring);
  World w=null;
  if (player == null)   return false;
  if (world == null || world.equals("String_Node_Str")) {
    w=player.getWorld();
  }
 else {
    w=plugin.getServer().getWorld(world);
    if (w == null)     w=player.getWorld();
  }
  if (tcutils != null) {
    tcutils.getTelehistory().addHistory(player.getName(),player.getLocation());
  }
  Location loc=new Location(w,x,y,z);
  return player.teleport(loc);
}

Fixed version (ground truth):
public boolean teleportTo(String pstring,Integer x,Integer y,Integer z,String world){
  Player player=plugin.getServer().getPlayerExact(pstring);
  World w=null;
  if (player == null)   return false;
  if (world == null || world.equals("String_Node_Str")) {
    w=player.getWorld();
  }
 else {
    w=plugin.getServer().getWorld(world);
    if (w == null)     w=player.getWorld();
  }
  plugin.getTweakcraftUtilsHelper().addTeleportHistory(player);
  Location loc=new Location(w,x,y,z);
  return player.teleport(loc);
}
Program: 44872
Project: 44872
Buggy source:
public static String[] BrayAndTravasarou2007(final double ky,final double ts,final double sa,final double m){
  String ret[]=new String[3];
  final double p=0.2316419;
  final double b1=0.319381530;
  final double b2=-0.356563782;
  final double b3=1.781477937;
  final double b4=-1.821255978;
  final double b5=1.330274429;
  final double lnky=Math.log(ky);
  final double lnky2=lnky * lnky;
  final double ts15=ts * 1.5;
  final double lnsats15=Math.log(sa * ts15);
  final double lnsats15_2=lnsats15 * lnsats15;
  double dispcm=Math.pow(Math.E,-1.1 - 2.83 * lnky - 0.333 * lnky2 + 0.566 * lnky * lnsats15 + 3.04 * lnsats15 - 0.244 * lnsats15_2 + ts15 + 0.278 * (m - 7.0));
  double dispin=dispcm / 2.54;
  double x=-1.76 - 3.22 * lnky - 0.484 * ts * lnky + 3.52 * lnsats15;
  double zx=(1. / Math.sqrt(2 * Math.PI)) * Math.exp(-(x * x) / 2.);
  double t=1. / (1. + p * x);
  double t2=t * t;
  double t3=t2 * t;
  double t4=t3 * t;
  double t5=t4 * t;
  double px=1 - zx * (b1 * t + b2 * t2 + b3 * t3 + b4 * t4 + b5 * t5);
  double prob_zero_disp=1.0 - px;
  int incr=0;
  ret[incr++]=fmtOne.format(dispcm);
  ret[incr++]=fmtOne.format(dispin);
  ret[incr++]=fmtTwo.format(prob_zero_disp);
  return ret;
}

Fixed version (ground truth):
public static String[] BrayAndTravasarou2007(final double ky,final double ts,final double sa,final double m){
  String ret[]=new String[3];
  final double p=0.2316419;
  final double b1=0.319381530;
  final double b2=-0.356563782;
  final double b3=1.781477937;
  final double b4=-1.821255978;
  final double b5=1.330274429;
  final double lnky=Math.log(ky);
  final double lnky2=lnky * lnky;
  final double ts15=ts * 1.5;
  final double lnsats15=Math.log(sa);
  final double lnsats15_2=lnsats15 * lnsats15;
  double dispcm=Math.exp(-1.1 - 2.83 * lnky - 0.333 * lnky2 + 0.566 * lnky * lnsats15 + 3.04 * lnsats15 - 0.244 * lnsats15_2 + ts15 + 0.278 * (m - 7.0));
  double dispin=dispcm / 2.54;
  double x=-1.76 - 3.22 * lnky - 0.484 * ts * lnky + 3.52 * lnsats15;
  double zx=(1. / Math.sqrt(2 * Math.PI)) * Math.exp(-(x * x) / 2.);
  double t=1. / (1. + p * x);
  double t2=t * t;
  double t3=t2 * t;
  double t4=t3 * t;
  double t5=t4 * t;
  double px=1 - zx * (b1 * t + b2 * t2 + b3 * t3 + b4 * t4 + b5 * t5);
  double prob_zero_disp=1.0 - px;
  int incr=0;
  ret[incr++]=fmtOne.format(dispcm);
  ret[incr++]=fmtOne.format(dispin);
  ret[incr++]=fmtTwo.format(prob_zero_disp);
  return ret;
}
Program: 44876
Project: 44876
Buggy source:
public void run(){
  Analysis a;
  if (analysis == RB) {
    a=new RigidBlock();
    result=a.SlammerRigorous(ain,di,ca,scale,paramDualslope,thrust,scaleRB);
  }
 else   if (analysis == DC) {
    a=new Decoupled();
    result=a.Decoupled(ain,uwgt,height,vs,damp,refstrain,di,scale,g,vr,ca,dv3);
    _kmax=Math.abs(a._kmax);
    _vs=Math.abs(a._vs);
    _damp=Math.abs(a._damp);
    _dampf=Math.abs(a._dampf);
    _omega=Math.abs(a._omega);
  }
 else   if (analysis == CP) {
    a=new Coupled();
    result=a.Coupled(ain,uwgt,height,vs,damp,refstrain,di,scale,g,vr,ca,dv3);
    _kmax=Math.abs(a._kmax);
    _vs=Math.abs(a._vs);
    _damp=Math.abs(a._damp);
    _dampf=Math.abs(a._dampf);
    _omega=Math.abs(a._omega);
  }
 else   a=null;
  graphData=a.graphData;
  finished=true;
  pm.incr(eq + "String_Node_Str" + record);
}

Fixed version (ground truth):
public void run(){
  Analysis a;
  if (analysis == RB) {
    a=new RigidBlock();
    result=a.SlammerRigorous(ain,di,ca,scale,paramDualslope,thrust,scaleRB);
  }
 else   if (analysis == DC) {
    a=new Decoupled();
    result=a.Decoupled(ain,uwgt,height,vs,damp,refstrain,di,scale,g,vr,ca,dv3);
    _kmax=Math.abs(a._kmax);
    _vs=Math.abs(a._vs);
    _damp=Math.abs(a._damp);
    _dampf=Math.abs(a._dampf);
  }
 else   if (analysis == CP) {
    a=new Coupled();
    result=a.Coupled(ain,uwgt,height,vs,damp,refstrain,di,scale,g,vr,ca,dv3);
    _kmax=Math.abs(a._kmax);
    _vs=Math.abs(a._vs);
    _damp=Math.abs(a._damp);
    _dampf=Math.abs(a._dampf);
  }
 else   a=null;
  graphData=a.graphData;
  finished=true;
  pm.incr(eq + "String_Node_Str" + record);
}
Program: 44879
Project: 44879
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  File calFile=new File(cal_path);
  if (!calFile.exists()) {
    Intent starterIntent=new Intent(this,TSCalibration.class);
    startActivityForResult(starterIntent,0);
  }
  deleteFromPackageManger();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  File calFile=new File(cal_path);
  if (!calFile.exists()) {
    Intent starterIntent=new Intent(this,TSCalibration.class);
    startActivityForResult(starterIntent,0);
  }
 else {
    deleteFromPackageManger();
  }
}
Program: 44880
Project: 44880
Buggy source:
/** 
 * Persists RSS item to the database.
 * @param id item ID
 * @param folderId ID of containing folder
 * @param rssurl URL of RSS feed
 * @return long containing ID of inserted item
 * @throws Exception
 */
public long syncDb(long id,long folderId,String rssurl) throws Exception {
  mId=id;
  mFolderId=folderId;
  mRssUrl=rssurl;
  SAXParserFactory factory=SAXParserFactory.newInstance();
  SAXParser parser=factory.newSAXParser();
  XMLReader reader=parser.getXMLReader();
  reader.setContentHandler(this);
  reader.setErrorHandler(this);
  URL url=new URL(mRssUrl);
  URLConnection c=url.openConnection();
  c.setRequestProperty("String_Node_Str","String_Node_Str");
  try {
    BufferedReader bufReader=new BufferedReader(new InputStreamReader(c.getInputStream()),65535);
    reader.parse(new InputSource(bufReader));
  }
 catch (  NullPointerException e) {
    Log.e(TAG,Log.getStackTraceString(e));
    Log.e(TAG,"String_Node_Str");
  }
  return mId;
}

Fixed version (ground truth):
/** 
 * Persists RSS item to the database.
 * @param id item ID
 * @param folderId ID of containing folder
 * @param rssurl URL of RSS feed
 * @return long containing ID of inserted item
 * @throws Exception
 */
public long syncDb(long id,long folderId,String rssurl) throws Exception {
  mId=id;
  mFolderId=folderId;
  mRssUrl=rssurl;
  SAXParserFactory factory=SAXParserFactory.newInstance();
  SAXParser parser=factory.newSAXParser();
  XMLReader reader=parser.getXMLReader();
  reader.setContentHandler(this);
  reader.setErrorHandler(this);
  URL url=new URL(mRssUrl);
  URLConnection c=url.openConnection();
  c.setRequestProperty("String_Node_Str","String_Node_Str");
  try {
    BufferedReader bufReader=new BufferedReader(new InputStreamReader(c.getInputStream()),65535);
    reader.parse(new InputSource(bufReader));
  }
 catch (  NullPointerException e) {
    Log.e(TAG,Log.getStackTraceString(e));
    Log.e(TAG,"String_Node_Str" + url.toString());
  }
  return mId;
}
Program: 44881
Project: 44881
Buggy source:
/** 
 * {@inheritDoc}
 */
public void characters(char[] ch,int start,int length){
  if ((mId == -1) && (mState & STATE_IN_TITLE) != 0) {
    ContentValues values=new ContentValues();
    values.put(FeedDroid.Channels.TITLE,new String(ch,start,length));
    values.put(FeedDroid.Channels.URL,mRssUrl);
    values.put(FeedDroid.Channels.FOLDER_ID,mFolderId);
    Uri added=mResolver.insert(FeedDroid.Channels.CONTENT_URI,values);
    mId=Long.parseLong(added.getPathSegments().get(1));
    mState&=~STATE_IN_TITLE;
    return;
  }
  if ((mState & STATE_IN_ITEM) == 0)   return;
  StringBuilder str=new StringBuilder();
switch (mState) {
case STATE_IN_ITEM | STATE_IN_ITEM_TITLE:
    str.append(new String(ch,start,length).trim());
  if (mPostBuf.title == null)   mPostBuf.title=str.toString();
 else   mPostBuf.title+=str.toString();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_DESC:
str.append(new String(ch,start,length).trim());
if (mPostBuf.desc == null) mPostBuf.desc=str.toString();
 else mPostBuf.desc+=str.toString();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_LINK:
mPostBuf.link=new String(ch,start,length).trim();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_DATE:
mPostBuf.setDate(new String(ch,start,length).trim());
break;
case STATE_IN_ITEM | STATE_IN_ITEM_AUTHOR:
mPostBuf.author=new String(ch,start,length).trim();
break;
default :
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void characters(char[] ch,int start,int length){
  if ((mId == -1) && (mState & STATE_IN_TITLE) != 0) {
    ContentValues values=new ContentValues();
    values.put(FeedDroid.Channels.TITLE,new String(ch,start,length));
    values.put(FeedDroid.Channels.URL,mRssUrl);
    values.put(FeedDroid.Channels.FOLDER_ID,mFolderId);
    Uri added=mResolver.insert(FeedDroid.Channels.CONTENT_URI,values);
    mId=Long.parseLong(added.getPathSegments().get(1));
    mState&=~STATE_IN_TITLE;
    return;
  }
  if ((mState & STATE_IN_ITEM) == 0)   return;
  StringBuilder str=new StringBuilder();
switch (mState) {
case STATE_IN_ITEM | STATE_IN_ITEM_TITLE:
    str.append(new String(ch,start,length).trim());
  if (mPostBuf.title == null)   mPostBuf.title=str.toString();
 else   mPostBuf.title+=str.toString();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_DESC:
str.append(new String(ch,start,length).trim());
if (mPostBuf.desc == null) mPostBuf.desc=str.toString();
 else mPostBuf.desc+=str.toString();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_LINK:
mPostBuf.link=new String(ch,start,length).trim();
break;
case STATE_IN_ITEM | STATE_IN_ITEM_DATE:
mPostBuf.setDate(new String(ch,start,length).trim());
break;
case STATE_IN_ITEM | STATE_IN_ITEM_AUTHOR:
mPostBuf.author=new String(ch,start,length).trim();
if (mPostBuf.author == null) mPostBuf.author="String_Node_Str";
break;
default :
}
}
Program: 44882
Project: 44882
Buggy source:
/** 
 * {@inheritDoc}
 */
public void endElement(String uri,String name,String qName){
  Integer state=mStateMap.get(name);
  if (state != null) {
    mState&=~(state.intValue());
    if (state.intValue() == STATE_IN_ITEM) {
      if (mId == -1) {
        Log.d(TAG,"String_Node_Str");
        return;
      }
      ContentValues values=new ContentValues();
      values.put(FeedDroid.Posts.CHANNEL_ID,mId);
      values.put(FeedDroid.Posts.TITLE,mPostBuf.title);
      values.put(FeedDroid.Posts.URL,mPostBuf.link);
      if (mPostBuf.author == null)       mPostBuf.author="String_Node_Str";
      values.put(FeedDroid.Posts.AUTHOR,mPostBuf.author);
      values.put(FeedDroid.Posts.DATE,mPostBuf.getDate());
      values.put(FeedDroid.Posts.BODY,reEncodeHtml(mPostBuf.desc));
      try {
        mResolver.insert(FeedDroid.Posts.CONTENT_URI,values);
      }
 catch (      SQLException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void endElement(String uri,String name,String qName){
  Integer state=mStateMap.get(name);
  if (state != null) {
    mState&=~(state.intValue());
    if (state.intValue() == STATE_IN_ITEM) {
      if (mId == -1) {
        Log.d(TAG,"String_Node_Str");
        return;
      }
      ContentValues values=new ContentValues();
      values.put(FeedDroid.Posts.CHANNEL_ID,mId);
      values.put(FeedDroid.Posts.TITLE,mPostBuf.title);
      values.put(FeedDroid.Posts.URL,mPostBuf.link);
      values.put(FeedDroid.Posts.AUTHOR,mPostBuf.author);
      values.put(FeedDroid.Posts.DATE,mPostBuf.getDate());
      values.put(FeedDroid.Posts.BODY,reEncodeHtml(mPostBuf.desc));
      try {
        mResolver.insert(FeedDroid.Posts.CONTENT_URI,values);
      }
 catch (      SQLException e) {
      }
    }
  }
}
Program: 44883
Project: 44883
Buggy source:
/** 
 * Examines string and replaces XML-escaped HTML entities with their appropriate equivalents.
 * @param str String to examine
 * @return String with proper HTML elements
 */
private String reEncodeHtml(String str){
  StringBuilder builder=new StringBuilder();
  String[] sources=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] dests=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  builder.append(TextUtils.replace(str,sources,dests));
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Examines string and replaces XML-escaped HTML entities with their appropriate equivalents.
 * @param str String to examine
 * @return String with proper HTML elements
 */
private String reEncodeHtml(String str){
  StringBuilder builder=new StringBuilder();
  if (str == null)   return "String_Node_Str";
  String[] sources=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] dests=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  builder.append(TextUtils.replace(str,sources,dests));
  return builder.toString();
}
Program: 44884
Project: 44884
Buggy source:
/** 
 * @{inheritDoc }
 */
@Override public Uri insert(Uri url,ContentValues initialValues){
  long rowId;
  ContentValues values;
  if (initialValues != null)   values=new ContentValues(initialValues);
 else   values=new ContentValues();
  Uri uri;
switch (URL_MATCHER.match(url)) {
case CHANNELS:
    rowId=insertChannels(values);
  uri=ContentUris.withAppendedId(FeedDroid.Channels.CONTENT_URI,rowId);
break;
case POSTS:
rowId=insertPosts(values);
uri=ContentUris.withAppendedId(FeedDroid.Posts.CONTENT_URI,rowId);
break;
case FOLDERS:
rowId=insertFolders(values);
uri=ContentUris.withAppendedId(FeedDroid.Folders.CONTENT_URI,rowId);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + url);
}
if (rowId > 0) getContext().getContentResolver().notifyChange(uri,null);
 else Log.e(TAG,"String_Node_Str" + values.getAsString(FeedDroid.Folders.NAME));
return uri;
}

Fixed version (ground truth):
/** 
 * @{inheritDoc }
 */
@Override public Uri insert(Uri url,ContentValues initialValues){
  long rowId;
  ContentValues values;
  if (initialValues != null)   values=new ContentValues(initialValues);
 else   values=new ContentValues();
  Uri uri;
switch (URL_MATCHER.match(url)) {
case CHANNELS:
    rowId=insertChannels(values);
  uri=ContentUris.withAppendedId(FeedDroid.Channels.CONTENT_URI,rowId);
break;
case POSTS:
rowId=insertPosts(values);
uri=ContentUris.withAppendedId(FeedDroid.Posts.CONTENT_URI,rowId);
break;
case FOLDERS:
rowId=insertFolders(values);
uri=ContentUris.withAppendedId(FeedDroid.Folders.CONTENT_URI,rowId);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + url);
}
if (rowId > 0) getContext().getContentResolver().notifyChange(uri,null);
return uri;
}
Program: 44885
Project: 44885
Buggy source:
/** 
 * Inserts post into the database.
 * @param values ContentValues containing post details
 * @return ID of new post
 */
private long insertPosts(ContentValues values){
  long id=-1;
  try {
    if (!checkForDuplicatePost(values.getAsString("String_Node_Str")))     mDb.insert("String_Node_Str","String_Node_Str",values);
  }
 catch (  SQLiteConstraintException e) {
  }
  return id;
}

Fixed version (ground truth):
/** 
 * Inserts post into the database.
 * @param values ContentValues containing post details
 * @return ID of new post
 */
private long insertPosts(ContentValues values){
  long id=-1;
  try {
    if (!checkForDuplicatePost(values.getAsString("String_Node_Str")))     mDb.insert("String_Node_Str","String_Node_Str",values);
  }
 catch (  SQLiteConstraintException e) {
    Log.d(TAG,"String_Node_Str" + values.getAsString("String_Node_Str"));
  }
  return id;
}
Program: 44886
Project: 44886
Buggy source:
/** 
 * Sends a notification of new RSS posts to the NotificationManager.
 */
private void sendNotification(){
  mNotificationMgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  int icon=R.drawable.rss_status_bar;
  String tickerTxt=getString(R.string.updates_available);
  String titleTxt=getString(R.string.app_name);
  Notification notification=new Notification(icon,tickerTxt,System.currentTimeMillis());
  notification.ledOffMS=0;
  notification.ledOnMS=1;
  notification.flags|=Notification.FLAG_SHOW_LIGHTS;
  notification.flags|=Notification.DEFAULT_SOUND;
  Intent appIntent=new Intent(getApplicationContext(),HomeScreenActivity.class);
  PendingIntent pending=PendingIntent.getActivity(getApplicationContext(),0,appIntent,0);
  notification.setLatestEventInfo(getApplicationContext(),titleTxt,tickerTxt,pending);
  mNotificationMgr.notify(1,notification);
  sendBroadcast(new Intent(FeedDroidWidget.FORCE_WIDGET_UPDATE));
}

Fixed version (ground truth):
/** 
 * Sends a notification of new RSS posts to the NotificationManager.
 */
private void sendNotification(){
  mNotificationMgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  int icon=R.drawable.rss_status_bar;
  String tickerTxt=getString(R.string.updates_available);
  String titleTxt=getString(R.string.app_name);
  Notification notification=new Notification(icon,tickerTxt,System.currentTimeMillis());
  notification.ledOffMS=0;
  notification.ledOnMS=1;
  notification.flags|=Notification.FLAG_SHOW_LIGHTS;
  notification.flags|=Notification.DEFAULT_SOUND;
  Intent appIntent=new Intent(getApplicationContext(),HomeScreenActivity.class);
  PendingIntent pending=PendingIntent.getActivity(getApplicationContext(),0,appIntent,0);
  notification.setLatestEventInfo(getApplicationContext(),titleTxt,tickerTxt,pending);
  mNotificationMgr.notify(1,notification);
}
Program: 44887
Project: 44887
Buggy source:
private boolean checkForDuplicatePost(String url){
  boolean dup=false;
  String[] projection={FeedDroid.Posts._ID};
  Cursor c=mDb.query("String_Node_Str",projection,"String_Node_Str" + url,null,null,null,null);
  if (c.getCount() > 0)   dup=true;
  c.close();
  return dup;
}

Fixed version (ground truth):
private boolean checkForDuplicatePost(String url){
  boolean dup=false;
  String[] projection={FeedDroid.Posts._ID};
  Cursor c=mDb.query("String_Node_Str",projection,"String_Node_Str" + url + "String_Node_Str",null,null,null,null);
  if (c.getCount() > 0)   dup=true;
  c.close();
  return dup;
}
Program: 44888
Project: 44888
Buggy source:
void doStart(Intent intent,int startId){
  Log.d(TAG,"String_Node_Str");
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  if (c.getCount() == 0) {
    c.close();
    return;
  }
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    FeedDetails feed=new FeedDetails();
    feed.id=id;
    feed.url=url;
    new FeedUpdateTask().execute(feed);
  }
 while (c.moveToNext());
  c.close();
  if (mHasUpdates)   sendNotification();
  stopSelf();
}

Fixed version (ground truth):
void doStart(Intent intent,int startId){
  Log.d(TAG,"String_Node_Str");
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  if (c.getCount() == 0) {
    c.close();
    return;
  }
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    parseChannelRss(id,url);
  }
 while (c.moveToNext());
  c.close();
  if (mHasUpdates)   sendNotification();
  stopSelf();
}
Program: 44889
Project: 44889
Buggy source:
public void updateAllChannels(){
  ArrayList<FeedDetails> feeds=new ArrayList<FeedDetails>();
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    FeedDetails feed=new FeedDetails();
    feed.id=id;
    feed.url=url;
    feeds.add(feed);
  }
 while (c.moveToNext());
  c.close();
  new AllFeedsUpdateTask().execute(feeds);
}

Fixed version (ground truth):
public void updateAllChannels(){
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    parseChannelRss(id,url);
  }
 while (c.moveToNext());
  c.close();
}
Program: 44890
Project: 44890
Buggy source:
public void updateChannel(long id,String url){
  FeedDetails feed=new FeedDetails();
  feed.id=id;
  feed.url=url;
  new FeedUpdateTask().execute(feed);
}

Fixed version (ground truth):
public void updateChannel(long id,String url){
  parseChannelRss(id,url);
}
Program: 44891
Project: 44891
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case REFRESH_ALL_ID:
    refreshAllChannels();
  return true;
case PREFS_ID:
Intent i=new Intent(this,PreferencesActivity.class);
startActivityForResult(i,SHOW_PREFERENCES);
return true;
case SEARCH_ID:
onSearchRequested();
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  Intent i;
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case REFRESH_ALL_ID:
    refreshAllChannels();
  return true;
case PREFS_ID:
i=new Intent(this,PreferencesActivity.class);
startActivityForResult(i,SHOW_PREFERENCES);
return true;
case SEARCH_ID:
Log.d(TAG,"String_Node_Str");
onSearchRequested();
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 44892
Project: 44892
Buggy source:
@Override public Void doInBackground(FeedDetails... params){
  FeedDetails feed=params[0];
  Cursor p=getContentResolver().query(FeedDroid.Posts.CONTENT_URI,new String[]{FeedDroid.Posts._ID},"String_Node_Str" + feed.id,null,null);
  int oldPostCount=p.getCount();
  try {
    new RssParser(getContentResolver()).syncDb(feed.id,feed.url);
  }
 catch (  Exception e) {
    Log.e("String_Node_Str",Log.getStackTraceString(e));
  }
  if (p.requery()) {
    int newPostCount=p.getCount();
    if (newPostCount > oldPostCount) {
      sendNotification();
    }
  }
  p.close();
  return null;
}

Fixed version (ground truth):
@Override public Void doInBackground(ArrayList<FeedDetails>... params){
  ArrayList<FeedDetails> feeds=params[0];
  for (  FeedDetails feed : feeds) {
    Cursor p=getContentResolver().query(FeedDroid.Posts.CONTENT_URI,new String[]{FeedDroid.Posts._ID},"String_Node_Str" + feed.id,null,null);
    int oldPostCount=p.getCount();
    try {
      new RssParser(getContentResolver()).syncDb(feed.id,feed.url);
    }
 catch (    Exception e) {
      Log.e("String_Node_Str",Log.getStackTraceString(e));
    }
    if (p.requery()) {
      int newPostCount=p.getCount();
      if (newPostCount > oldPostCount) {
        sendNotification();
      }
    }
    p.close();
  }
  return null;
}
Program: 44893
Project: 44893
Buggy source:
public void updateAllChannels(){
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    FeedDetails feed=new FeedDetails();
    feed.id=id;
    feed.url=url;
    new FeedUpdateTask().execute(feed);
  }
 while (c.moveToNext());
  c.close();
}

Fixed version (ground truth):
public void updateAllChannels(){
  ArrayList<FeedDetails> feeds=new ArrayList<FeedDetails>();
  Cursor c=getContentResolver().query(FeedDroid.Channels.CONTENT_URI,new String[]{FeedDroid.Channels._ID,FeedDroid.Channels.URL},null,null,null);
  c.moveToFirst();
  do {
    long id=c.getLong(c.getColumnIndex(FeedDroid.Channels._ID));
    String url=c.getString(c.getColumnIndex(FeedDroid.Channels.URL));
    FeedDetails feed=new FeedDetails();
    feed.id=id;
    feed.url=url;
    feeds.add(feed);
  }
 while (c.moveToNext());
  c.close();
  new AllFeedsUpdateTask().execute(feeds);
}
Program: 44894
Project: 44894
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case SHOW_PREFERENCES:
    Log.d(TAG,"String_Node_Str");
  Log.d(TAG,"String_Node_Str" + getIntent().getData());
Log.d(TAG,"String_Node_Str" + getIntent().getAction());
mCursor=managedQuery(data.getData(),PROJECTION,null,null,null);
ListAdapter adapter=new ChannelListAdapter(this,mCursor);
setListAdapter(adapter);
boolean refreshAll=data.getBooleanExtra("String_Node_Str",false);
if (refreshAll) refreshAllChannels();
break;
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (data != null) {
switch (requestCode) {
case SHOW_PREFERENCES:
      Log.d(TAG,"String_Node_Str");
    Log.d(TAG,"String_Node_Str" + getIntent().getData());
  Log.d(TAG,"String_Node_Str" + getIntent().getAction());
mCursor=managedQuery(data.getData(),PROJECTION,null,null,null);
ListAdapter adapter=new ChannelListAdapter(this,mCursor);
setListAdapter(adapter);
boolean refreshAll=data.getBooleanExtra("String_Node_Str",false);
if (refreshAll) refreshAllChannels();
break;
}
}
}
Program: 44895
Project: 44895
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.post_view);
  Uri uri=getIntent().getData();
  mCursor=managedQuery(uri,PROJECTION,null,null,null);
  if (mCursor == null || !mCursor.moveToFirst())   finish();
  mChannelId=mCursor.getLong(mCursor.getColumnIndex(FeedDroid.Posts.CHANNEL_ID));
  mPostId=Long.parseLong(uri.getPathSegments().get(1));
  initWithData();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.post_view);
  Uri uri=getIntent().getData();
  mCursor=managedQuery(uri,PROJECTION,null,null,null);
  if (mCursor == null || !mCursor.moveToFirst())   finish();
  mChannelId=mCursor.getLong(mCursor.getColumnIndex(FeedDroid.Posts.CHANNEL_ID));
  mPostId=Long.parseLong(uri.getPathSegments().get(1));
  mDetector=new GestureFilter(this,this);
  mDetector.setEnabled(true);
  mDetector.setMode(GestureFilter.MODE_DYNAMIC);
  mLibrary=GestureLibraries.fromRawResource(this,R.raw.gestures);
  if (!mLibrary.load()) {
    Log.e(TAG,"String_Node_Str");
    finish();
  }
  initWithData();
}
Program: 44896
Project: 44896
Buggy source:
@Override public void onStart(){
  super.onStart();
  if (mCursor == null || !mCursor.moveToFirst())   return;
  ContentResolver resolver=getContentResolver();
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  if (mCursor == null || !mCursor.moveToFirst())   return;
  ContentResolver resolver=getContentResolver();
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",1);
  resolver.update(FeedDroid.Posts.CONTENT_URI,values,"String_Node_Str",new String[]{Long.toString(mPostId)});
}
Program: 44897
Project: 44897
Buggy source:
public void initWithData(){
  ContentResolver resolver=getContentResolver();
  Cursor cChannel=resolver.query(ContentUris.withAppendedId(FeedDroid.Channels.CONTENT_URI,mChannelId),new String[]{FeedDroid.Channels.ICON,FeedDroid.Channels.LOGO,FeedDroid.Channels.TITLE},null,null,null);
  if (cChannel.getCount() != 1)   return;
  cChannel.moveToFirst();
  ChannelHeader head=(ChannelHeader)findViewById(R.id.postViewHead);
  head.setLogo(cChannel);
  cChannel.close();
  TextView postTitle=(TextView)findViewById(R.id.postTitle);
  postTitle.setText(mCursor.getString(mCursor.getColumnIndex(FeedDroid.Posts.TITLE)));
  WebView postText=(WebView)findViewById(R.id.postText);
  String html="String_Node_Str" + getBody() + "String_Node_Str";
  postText.loadData(html,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void initWithData(){
  Log.d(TAG,"String_Node_Str" + getBody());
  ContentResolver resolver=getContentResolver();
  Cursor cChannel=resolver.query(ContentUris.withAppendedId(FeedDroid.Channels.CONTENT_URI,mChannelId),new String[]{FeedDroid.Channels.ICON,FeedDroid.Channels.LOGO,FeedDroid.Channels.TITLE},null,null,null);
  if (cChannel.getCount() != 1)   return;
  cChannel.moveToFirst();
  ChannelHeader head=(ChannelHeader)findViewById(R.id.postViewHead);
  head.setLogo(cChannel);
  cChannel.close();
  TextView postTitle=(TextView)findViewById(R.id.postTitle);
  postTitle.setText(mCursor.getString(mCursor.getColumnIndex(FeedDroid.Posts.TITLE)));
  WebView postText=(WebView)findViewById(R.id.postText);
  String html="String_Node_Str" + getBody() + "String_Node_Str";
  postText.loadData(html,"String_Node_Str","String_Node_Str");
}
Program: 44898
Project: 44898
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.channel_add);
  mUrl=(EditText)findViewById(R.id.url);
  Button add=(Button)findViewById(R.id.add);
  add.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      addChannel();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.channel_add);
  mUrl=(EditText)findViewById(R.id.url);
  Button add=(Button)findViewById(R.id.add);
  add.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      addChannel();
    }
  }
);
}
Program: 44899
Project: 44899
Buggy source:
@Override public void onClick(View v){
  addChannel();
}

Fixed version (ground truth):
public void onClick(View v){
  addChannel();
}
Program: 44900
Project: 44900
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  dialog.cancel();
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int which){
  dialog.cancel();
}
Program: 44901
Project: 44901
Buggy source:
private void removeChannel(final long channelId){
  Log.d(TAG,"String_Node_Str" + channelId);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setMessage("String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      ContentResolver resolver=getContentResolver();
      resolver.delete(FeedDroid.Posts.CONTENT_URI,"String_Node_Str" + channelId,null);
      resolver.delete(FeedDroid.Channels.CONTENT_URI,"String_Node_Str" + channelId,null);
    }
  }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.cancel();
    }
  }
);
  builder.create().show();
}

Fixed version (ground truth):
private void removeChannel(final long channelId){
  Log.d(TAG,"String_Node_Str" + channelId);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setMessage("String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      ContentResolver resolver=getContentResolver();
      resolver.delete(FeedDroid.Posts.CONTENT_URI,"String_Node_Str" + channelId,null);
      resolver.delete(FeedDroid.Channels.CONTENT_URI,"String_Node_Str" + channelId,null);
    }
  }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.cancel();
    }
  }
);
  builder.create().show();
}
Program: 44902
Project: 44902
Buggy source:
@Override public void onSwipe(int direction){
switch (direction) {
case GestureFilter.SWIPE_RIGHT:
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
  break;
case GestureFilter.SWIPE_LEFT:
Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
break;
}
}

Fixed version (ground truth):
public void onSwipe(int direction){
}
Program: 44903
Project: 44903
Buggy source:
@Override public void onDoubleTap(){
}

Fixed version (ground truth):
public void onDoubleTap(){
}
Program: 44904
Project: 44904
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.post_list);
  Uri uri=getIntent().getData();
  mCursor=managedQuery(uri,PROJECTION,null,null,null);
  startManagingCursor(mCursor);
  mId=Long.parseLong(uri.getPathSegments().get(1));
  ListAdapter adapter=new PostListAdapter(mCursor,this);
  setListAdapter(adapter);
  initWithData();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.post_list);
  Uri uri=getIntent().getData();
  mCursor=managedQuery(uri,PROJECTION,null,null,"String_Node_Str");
  startManagingCursor(mCursor);
  mId=Long.parseLong(uri.getPathSegments().get(1));
  ListAdapter adapter=new PostListAdapter(mCursor,this);
  setListAdapter(adapter);
  initWithData();
}
Program: 44905
Project: 44905
Buggy source:
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
switch (KeyUtils.intrepretDirection(keyCode)) {
case KeyEvent.KEYCODE_DPAD_LEFT:
    getSiblings();
  return prevChannel();
case KeyEvent.KEYCODE_DPAD_RIGHT:
getSiblings();
return nextChannel();
case KeyEvent.KEYCODE_BACK:
finish();
}
return false;
}

Fixed version (ground truth):
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
switch (KeyUtils.intrepretDirection(keyCode)) {
case KeyEvent.KEYCODE_DPAD_LEFT:
    getSiblings();
  return prevChannel();
case KeyEvent.KEYCODE_DPAD_RIGHT:
getSiblings();
return nextChannel();
}
return false;
}
Program: 44906
Project: 44906
Buggy source:
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
  if ((keyCode != KeyEvent.KEYCODE_DPAD_LEFT) && (keyCode != KeyEvent.KEYCODE_DPAD_RIGHT)) {
switch (KeyUtils.intrepretDirection(keyCode)) {
case KeyEvent.KEYCODE_DPAD_LEFT:
      getSiblings();
    return nextPost();
case KeyEvent.KEYCODE_DPAD_RIGHT:
  getSiblings();
return prevPost();
case KeyEvent.KEYCODE_BACK:
finish();
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
switch (KeyUtils.intrepretDirection(keyCode)) {
case KeyEvent.KEYCODE_DPAD_LEFT:
    getSiblings();
  return nextPost();
case KeyEvent.KEYCODE_DPAD_RIGHT:
getSiblings();
return prevPost();
}
return false;
}
Program: 44907
Project: 44907
Buggy source:
private void initRemoteStubs(List<ClientMock> clients){
  List<Integer> unreachableClients=new ArrayList<Integer>();
  int i=0;
  for (  ClientMock client : clients) {
    if (client.getName().equals(this.username)) {
      this.cache.put(i,null);
      continue;
    }
 else {
      try {
        IClient clientStub=this.getStub(client);
        this.cache.put(i,clientStub);
      }
 catch (      Exception e) {
        unreachableClients.add(i);
      }
    }
  }
  while (!unreachableClients.isEmpty()) {
    Iterator<Integer> it=unreachableClients.iterator();
    while (it.hasNext()) {
      try {
        int idx=it.next();
        IClient stub=this.getStub(clients.get(idx));
        if (stub != null) {
          it.remove();
          this.cache.put(idx,stub);
        }
      }
 catch (      Exception e) {
        LOG.debug("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void initRemoteStubs(List<ClientMock> clients){
  List<Integer> unreachableClients=new ArrayList<Integer>();
  int i=0;
  for (  ClientMock client : clients) {
    if (client.getName().equals(this.username)) {
      this.cache.put(i++,null);
      continue;
    }
 else {
      try {
        IClient clientStub=this.getStub(client);
        this.cache.put(i,clientStub);
      }
 catch (      Exception e) {
        unreachableClients.add(i);
      }
    }
    i++;
  }
  while (!unreachableClients.isEmpty()) {
    Iterator<Integer> it=unreachableClients.iterator();
    while (it.hasNext()) {
      try {
        int idx=it.next();
        IClient stub=this.getStub(clients.get(idx));
        if (stub != null) {
          it.remove();
          this.cache.put(idx,stub);
        }
      }
 catch (      Exception e) {
        LOG.debug("String_Node_Str");
      }
    }
  }
}
Program: 44908
Project: 44908
Buggy source:
private void initPrevIndex(int numId){
switch (numId) {
case 0:
    this.setPrevIndex(this.client.getCache().size() - 1);
  break;
case 1:
this.setPrevIndex(0);
break;
case 2:
this.setPrevIndex(1);
break;
case 3:
this.setPrevIndex(2);
break;
}
}

Fixed version (ground truth):
private void initPrevIndex(int numId){
switch (numId) {
case 0:
    this.setPrevIndex(this.client.getClients().size() - 1);
  break;
case 1:
this.setPrevIndex(0);
break;
case 2:
this.setPrevIndex(1);
break;
case 3:
this.setPrevIndex(2);
break;
}
}
Program: 44909
Project: 44909
Buggy source:
private void refreshStub(int idx){
  try {
    this.client.getStub(this.client.getClients().get(idx));
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
private void refreshStub(int idx){
  try {
    IClient stub=this.client.getStub(this.client.getClients().get(idx));
    if (stub != null) {
      this.client.getCache().put(idx,stub);
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
  }
}
Program: 44910
Project: 44910
Buggy source:
public static void main(String[] args){
  if (args.length != 2) {
    System.exit(1);
  }
  try {
    String host=args[0];
    int port=Integer.parseInt(args[1]);
    IServer server=(IServer)Naming.lookup("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str"+ Constants.REMOTE_SERVER_OBJECT_NAME);
    boolean registered=server.register("String_Node_Str","String_Node_Str");
    if (registered) {
      System.out.println("String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  if (args.length != 2) {
    System.exit(1);
  }
  try {
    String host=args[0];
    int port=Integer.parseInt(args[1]);
    IServer server=(IServer)Naming.lookup("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str"+ Constants.REMOTE_SERVER_OBJECT_NAME);
    boolean registered=server.register("String_Node_Str","String_Node_Str");
    if (registered) {
      System.out.println("String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str");
    }
    boolean created=server.createGame("String_Node_Str","String_Node_Str","String_Node_Str");
    System.out.println("String_Node_Str" + created);
    List<Game> games=server.fetchGames();
    System.out.println("String_Node_Str" + games.size());
    if (games.size() > 0) {
      System.out.println(games.get(0).getName());
      System.out.println(games.get(0).getHost());
    }
    boolean cancelGame=server.cancelGame("String_Node_Str","String_Node_Str","String_Node_Str");
    System.out.println("String_Node_Str" + cancelGame);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 44911
Project: 44911
Buggy source:
@Override public boolean cancelGame(String game,String name,String pass) throws RemoteException {
  return false;
}

Fixed version (ground truth):
@Override public boolean cancelGame(String game,String name,String pass) throws RemoteException {
  Game g=new Game(game,name,pass);
  return this.games.remove(g);
}
Program: 44912
Project: 44912
Buggy source:
@Override public List<Game> fetchGames() throws RemoteException {
  return null;
}

Fixed version (ground truth):
@Override public List<Game> fetchGames() throws RemoteException {
  return this.games;
}
Program: 44913
Project: 44913
Buggy source:
@Override public boolean unregister(String name,String pass) throws RemoteException {
  return false;
}

Fixed version (ground truth):
@Override public boolean unregister(String name,String pass) throws RemoteException {
  ClientMock mock=new ClientMock(name,pass);
  return this.clients.remove(mock);
}