nus-yam/ex-repair huggingface dataset:
Program: 6802
Project: 6802
Buggy source:
/** 
 * We have no pages in flight, and we just got given an empty set of pages to ask for, which means they have no pages that are useful to us... Start a timeout to shut us down if they don't offer any useful data within 2 mins
 */
private void startUsefulDataTimeout(){
  if (usefulDataTimeout == null) {
    log.debug(this + "String_Node_Str" + mina.getConfig().getUsefulDataSourceTimeout()+ "String_Node_Str");
    usefulDataTimeout=mina.getExecutor().schedule(new CatchingRunnable(){
      public void doRun() throws Exception {
        log.info(LCPair.this + "String_Node_Str");
        mina.getSourceMgr().cacheSourceUntilDataAvailable(cc.getNode(),sid);
        die();
      }
    }
,mina.getConfig().getUsefulDataSourceTimeout(),TimeUnit.SECONDS);
  }
}

Fixed version (ground truth):
/** 
 * We have no pages in flight, and we just got given an empty set of pages to ask for, which means they have no pages that are useful to us... Start a timeout to shut us down if they don't offer any useful data within 2 mins 
 */
private void startUsefulDataTimeout(){
  if (usefulDataTimeout == null) {
    log.debug(this + "String_Node_Str" + mina.getConfig().getUsefulDataSourceTimeout()+ "String_Node_Str");
    usefulDataTimeout=mina.getExecutor().schedule(new CatchingRunnable(){
      public void doRun() throws Exception {
        log.info(LCPair.this + "String_Node_Str");
        mina.getSourceMgr().cacheSourceUntilDataAvailable(cc.getNode(),sid);
        die();
      }
    }
,mina.getConfig().getUsefulDataSourceTimeout(),TimeUnit.SECONDS);
  }
}
Program: 6803
Project: 6803
Buggy source:
/** 
 * @syncpriority 200
 */
public void notifySourceStatus(SourceStatus sourceStat){
  setLastSourceStat(sourceStat);
  for (  StreamStatus streamStat : sourceStat.getSsList()) {
    if (streamStat.getStreamId().equals(sid)) {
      notifyStreamStatus(streamStat);
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * @syncpriority 200 
 */
public void notifySourceStatus(SourceStatus sourceStat){
  setLastSourceStat(sourceStat);
  for (  StreamStatus streamStat : sourceStat.getSsList()) {
    if (streamStat.getStreamId().equals(sid)) {
      notifyStreamStatus(streamStat);
      break;
    }
  }
}
Program: 6804
Project: 6804
Buggy source:
/** 
 * @syncpriority 130
 */
public synchronized void abort(){
  if (lc != null)   lc.close();
}

Fixed version (ground truth):
/** 
 * @syncpriority 130 
 */
public synchronized void abort(){
  if (lc != null)   lc.close();
}
Program: 6805
Project: 6805
Buggy source:
/** 
 * @syncpriority 170
 */
public LCPair(MinaInstance m,String streamId,ControlConnection ccon,SourceStatus ss){
  super(m,streamId,ccon);
  rto=MIN_PAGE_TIMEOUT;
  try {
    lc=ccon.getSCF().getListenConnection(ccon);
  }
 catch (  MinaConnectionException e) {
    log.error("String_Node_Str" + ccon.getNodeId(),e);
    die(false);
  }
  lc.setLCPair(this);
  setLastSourceStat(ss);
  ccon.addLCPair(this);
  final String nodeId=ccon.getNodeId();
  if (mina.getConfig().isAgoric() && mina.getBuyMgr().getAgreedBidTo(nodeId) > 0)   startListening();
 else {
    startAttempt=new Attempt(mina.getExecutor(),8 * mina.getConfig().getMessageTimeout() * 1000,"String_Node_Str" + sid + "String_Node_Str"+ nodeId){
      protected void onTimeout(){
        log.error("String_Node_Str" + nodeId + "String_Node_Str"+ sid);
        mina.getSourceMgr().cachePossiblyDeadSource(cc.getNode(),sid);
        die(false);
      }
    }
;
    startAttempt.start();
    mina.getBuyMgr().setupAccount(ss);
  }
}

Fixed version (ground truth):
/** 
 * @syncpriority 170 
 */
public LCPair(MinaInstance m,String streamId,ControlConnection ccon,SourceStatus ss){
  super(m,streamId,ccon);
  rto=MIN_PAGE_TIMEOUT;
  try {
    lc=ccon.getSCF().getListenConnection(ccon);
  }
 catch (  MinaConnectionException e) {
    log.error("String_Node_Str" + ccon.getNodeId(),e);
    die(false);
  }
  lc.setLCPair(this);
  setLastSourceStat(ss);
  ccon.addLCPair(this);
  final String nodeId=ccon.getNodeId();
  if (mina.getConfig().isAgoric() && mina.getBuyMgr().getAgreedBidTo(nodeId) > 0)   startListening();
 else {
    startAttempt=new Attempt(mina.getExecutor(),8 * mina.getConfig().getMessageTimeout() * 1000,"String_Node_Str" + sid + "String_Node_Str"+ nodeId){
      protected void onTimeout(){
        log.error("String_Node_Str" + nodeId + "String_Node_Str"+ sid);
        mina.getSourceMgr().cachePossiblyDeadSource(cc.getNode(),sid);
        die(false);
      }
    }
;
    startAttempt.start();
    mina.getBuyMgr().setupAccount(ss);
  }
}
Program: 6806
Project: 6806
Buggy source:
/** 
 * @syncpriority 170
 */
public void gotAgreedBid(){
  if (setupFinished)   return;
  startListening();
}

Fixed version (ground truth):
/** 
 * @syncpriority 170 
 */
public void gotAgreedBid(){
  if (setupFinished)   return;
  startListening();
}
Program: 6807
Project: 6807
Buggy source:
@Override public void startup() throws Exception {
  String baseUrl=rbnb.getConfig().getMidasUrl();
  Matcher m=URL_PATTERN.matcher(baseUrl);
  if (!m.matches())   throw new Errot("String_Node_Str" + baseUrl + "String_Node_Str");
  cfg=new MidasClientConfig(baseUrl);
  String midasHost=m.group(1);
  String portStr=m.group(2);
  int midasPort;
  if (isEmpty(portStr) || portStr.equals("String_Node_Str"))   midasPort=-1;
 else   midasPort=Integer.parseInt(portStr);
  log.debug("String_Node_Str" + midasHost + "String_Node_Str"+ midasPort);
  midasAuthScope=new AuthScope(midasHost,midasPort);
  numThreads=rbnb.getConfig().getMidasThreadPoolSize();
  executor=Executors.newFixedThreadPool(numThreads);
  http=rbnb.getHttpService().getClient();
  fetchOrder=RequestFetchOrder.Serial;
}

Fixed version (ground truth):
@Override public void startup() throws Exception {
  String baseUrl=rbnb.getConfig().getMidasUrl();
  Matcher m=URL_PATTERN.matcher(baseUrl);
  if (!m.matches())   throw new Errot("String_Node_Str" + baseUrl + "String_Node_Str");
  cfg=new MidasClientConfig(baseUrl);
  String midasHost=m.group(1);
  String portStr=m.group(2);
  int midasPort;
  if (isEmpty(portStr) || portStr.equals("String_Node_Str"))   midasPort=-1;
 else   midasPort=Integer.parseInt(portStr);
  midasAuthScope=new AuthScope(midasHost,midasPort);
  numThreads=rbnb.getConfig().getMidasThreadPoolSize();
  executor=Executors.newFixedThreadPool(numThreads);
  http=rbnb.getHttpService().getClient();
  fetchOrder=RequestFetchOrder.Serial;
}
Program: 6808
Project: 6808
Buggy source:
private synchronized void addRequest(Request r){
  requests.addFirst(r);
  int numToStart=min(r.remaining(),(numThreads - runningTasks));
  runningTasks+=numToStart;
  log.debug("String_Node_Str" + r.remaining() + "String_Node_Str"+ numToStart+ "String_Node_Str");
  for (int i=0; i < numToStart; i++) {
    executor.execute(new FetchTask());
  }
}

Fixed version (ground truth):
private synchronized void addRequest(Request r){
  requests.addFirst(r);
  int numToStart=min(r.remaining(),(numThreads - runningTasks));
  runningTasks+=numToStart;
  for (int i=0; i < numToStart; i++) {
    executor.execute(new FetchTask());
  }
}
Program: 6809
Project: 6809
Buggy source:
@Override public void doRun() throws Exception {
  log.debug(this + "String_Node_Str");
  while (true) {
    if (refreshContext) {
      log.debug(this + "String_Node_Str");
      context=http.newPreemptiveContext(new HttpHost(midasAuthScope.getHost(),midasAuthScope.getPort()));
      refreshContext=false;
    }
    Request r;
    Params p;
synchronized (MidasClientService.this) {
      if (requests.size() == 0) {
        runningTasks--;
        log.debug(this + "String_Node_Str");
        fetchTasks.remove(taskId);
        return;
      }
      r=requests.removeFirst();
      p=r.getNextParams();
      if (p == null)       continue;
      if (r.remaining() > 0) {
        if (fetchOrder == RequestFetchOrder.Serial)         requests.addFirst(r);
 else         requests.addLast(r);
      }
    }
    log.debug(this + "String_Node_Str" + p.op+ "String_Node_Str"+ p.url);
    try {
switch (p.op) {
case Get:
        HttpContext c=context;
      if (p.username != null)       c=http.newPreemptiveContext(new HttpHost(midasAuthScope.getHost(),midasAuthScope.getPort()));
    getFromUrl(c,p.resultBldr,p.url,p.username,p.password);
  break;
case Put:
putToUrl(context,p.sendMsg,p.url,p.resultBldr);
break;
case Delete:
deleteAtUrl(context,p.url);
break;
}
log.debug(this + "String_Node_Str" + p.op+ "String_Node_Str"+ p.url);
if (p.resultBldr == null) r.success(null);
 else r.success(p.resultBldr.build());
}
 catch (Exception e) {
if (stopped) return;
log.debug(this + "String_Node_Str" + shortClassName(e.getClass())+ "String_Node_Str"+ p.op+ "String_Node_Str"+ p.url+ "String_Node_Str"+ e.getMessage());
r.error(p,e);
}
}
}

Fixed version (ground truth):
@Override public void doRun() throws Exception {
  while (true) {
    if (refreshContext) {
      context=http.newPreemptiveContext(new HttpHost(midasAuthScope.getHost(),midasAuthScope.getPort()));
      refreshContext=false;
    }
    Request r;
    Params p;
synchronized (MidasClientService.this) {
      if (requests.size() == 0) {
        runningTasks--;
        fetchTasks.remove(taskId);
        return;
      }
      r=requests.removeFirst();
      p=r.getNextParams();
      if (p == null)       continue;
      if (r.remaining() > 0) {
        if (fetchOrder == RequestFetchOrder.Serial)         requests.addFirst(r);
 else         requests.addLast(r);
      }
    }
    try {
switch (p.op) {
case Get:
        HttpContext c=context;
      if (p.username != null)       c=http.newPreemptiveContext(new HttpHost(midasAuthScope.getHost(),midasAuthScope.getPort()));
    getFromUrl(c,p.resultBldr,p.url,p.username,p.password);
  break;
case Put:
putToUrl(context,p.sendMsg,p.url,p.resultBldr);
break;
case Delete:
deleteAtUrl(context,p.url);
break;
}
if (p.resultBldr == null) r.success(null);
 else r.success(p.resultBldr.build());
}
 catch (Exception e) {
if (stopped) return;
r.error(p,e);
}
}
}
Program: 6810
Project: 6810
Buggy source:
/** 
 * Returns all the files within the parent directory (including sub-dirs) that have the supplied extension. If extension is null, will return all files. Will not return the sub-dirs themselves. If the path is a file, it will be returned in the list it matches, or else an empty list will be returned
 */
public static List<File> getFilesWithinPath(File path,String fileExtension){
  List<File> result=new ArrayList<File>();
  if (!path.isDirectory()) {
    if (fileExtension == null || fileExtension.equalsIgnoreCase(getFileExtension(path)))     result.add(path);
    return result;
  }
  addChildFilesToList(path,result,fileExtension);
  return result;
}

Fixed version (ground truth):
/** 
 * Returns all the files within the parent directory (including sub-dirs) that have the supplied extension. If extension is null, will return all files. Will not return the sub-dirs themselves. If the path is a file, it will be returned in the list it matches, or else an empty list will be returned 
 */
public static List<File> getFilesWithinPath(File path,String fileExtension){
  List<File> result=new ArrayList<File>();
  if (!path.isDirectory()) {
    if (fileExtension == null || fileExtension.equalsIgnoreCase(getFileExtension(path)))     result.add(path);
    return result;
  }
  addChildFilesToList(path,result,fileExtension);
  return result;
}
Program: 6811
Project: 6811
Buggy source:
/** 
 * Returns the file extension, without the initial period. If there is no period in the file name, returns an empty string.
 */
public static String getFileExtension(File f){
  String fileName=f.getName();
  if (fileName.contains("String_Node_Str"))   return fileName.substring(fileName.lastIndexOf("String_Node_Str") + 1);
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Returns the file extension, without the initial period. If there is no period in the file name, returns an empty string. 
 */
public static String getFileExtension(File f){
  String fileName=f.getName();
  if (fileName.contains("String_Node_Str"))   return fileName.substring(fileName.lastIndexOf("String_Node_Str") + 1);
 else   return "String_Node_Str";
}
Program: 6812
Project: 6812
Buggy source:
private static void addChildFilesToList(File directory,List<File> list,String fileExtension){
  for (  File f : directory.listFiles()) {
    if (f.isDirectory())     addChildFilesToList(f,list,fileExtension);
 else     if (fileExtension == null || fileExtension.equalsIgnoreCase(getFileExtension(f)))     list.add(f);
  }
}

Fixed version (ground truth):
private static void addChildFilesToList(File directory,List<File> list,String fileExtension){
  File[] filesInThisDir=directory.listFiles();
  if (filesInThisDir == null)   return;
  for (  File f : filesInThisDir) {
    if (f.isDirectory())     addChildFilesToList(f,list,fileExtension);
 else     if (fileExtension == null || fileExtension.equalsIgnoreCase(getFileExtension(f)))     list.add(f);
  }
}
Program: 6813
Project: 6813
Buggy source:
void startAllShares() throws IOException, RobonoboException {
  log.debug("String_Node_Str");
  String[] arr;
synchronized (this) {
    arr=new String[shareStreamIds.size()];
    shareStreamIds.toArray(arr);
  }
  Set<String> shareSids=new HashSet<String>();
  for (  String sid : arr) {
    FilePageBuffer pb=storage.getPageBuf(sid);
    if (pb == null) {
      log.error("String_Node_Str" + sid + "String_Node_Str");
      db.deleteShare(sid);
      continue;
    }
    File file=pb.getFile();
    if (!file.exists() || !file.canRead()) {
      log.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ sid+ "String_Node_Str");
synchronized (this) {
        shareStreamIds.remove(sid);
      }
      continue;
    }
    shareSids.add(sid);
  }
  getRobonobo().getMina().startBroadcasts(shareSids);
  log.debug("String_Node_Str" + shareSids.size() + "String_Node_Str");
}

Fixed version (ground truth):
void startAllShares() throws IOException, RobonoboException {
  log.debug("String_Node_Str");
  String[] arr;
synchronized (this) {
    arr=new String[shareStreamIds.size()];
    shareStreamIds.toArray(arr);
  }
  Set<String> shareSids=new HashSet<String>();
  for (  String sid : arr) {
    FilePageBuffer pb=storage.getPageBuf(sid,false);
    if (pb == null) {
      log.error("String_Node_Str" + sid + "String_Node_Str");
      db.deleteShare(sid);
      continue;
    }
    File file=pb.getFile();
    if (!file.exists() || !file.canRead()) {
      log.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ sid+ "String_Node_Str");
synchronized (this) {
        shareStreamIds.remove(sid);
      }
      continue;
    }
    shareSids.add(sid);
  }
  if (shareSids.size() > 0)   rbnb.getMina().startBroadcasts(shareSids);
  log.debug("String_Node_Str" + shareSids.size() + "String_Node_Str");
}
Program: 6814
Project: 6814
Buggy source:
/** 
 * NB The stream referenced by stream id must already have been put into streamservice
 * @param streamId
 * @param dataFile
 * @throws RobonoboException
 */
public void addShare(Stream s,File dataFile) throws RobonoboException {
  String streamId=s.getStreamId();
  log.info("String_Node_Str" + streamId + "String_Node_Str"+ dataFile.getAbsolutePath());
  SharedTrack sh=db.getShare(streamId);
  if (sh != null) {
    log.info("String_Node_Str" + streamId + "String_Node_Str");
    return;
  }
  sh=new SharedTrack(s,dataFile,ShareStatus.Sharing);
  try {
    PageBuffer pb=storage.createPageBufForShare(sh.getStream(),sh.getFile(),true);
    FormatSupportProvider fsp=rbnb.getFormatService().getFormatSupportProvider(s.getMimeType());
    if (fsp == null)     throw new IOException("String_Node_Str" + s.getMimeType());
    log.debug("String_Node_Str" + dataFile.getAbsolutePath());
    fsp.paginate(dataFile,pb);
  }
 catch (  IOException e) {
    throw new RobonoboException(e);
  }
  sh.setDateAdded(now());
  db.putShare(sh);
synchronized (this) {
    shareStreamIds.add(s.getStreamId());
  }
  startShare(streamId);
  rbnb.getLibraryService().addToLibrary(streamId);
  event.fireTrackUpdated(s.getStreamId());
  event.fireMyLibraryUpdated();
  rbnb.getPlaylistService().checkPlaylistsForNewShare(sh);
}

Fixed version (ground truth):
/** 
 * NB The stream referenced by stream id must already have been put into streamservice
 * @param streamId
 * @param dataFile
 * @throws RobonoboException 
 */
public void addShare(Stream s,File dataFile) throws RobonoboException {
  String streamId=s.getStreamId();
  log.info("String_Node_Str" + streamId + "String_Node_Str"+ dataFile.getAbsolutePath());
  SharedTrack sh=db.getShare(streamId);
  if (sh != null) {
    log.info("String_Node_Str" + streamId + "String_Node_Str");
    return;
  }
  sh=new SharedTrack(s,dataFile,ShareStatus.Sharing);
  try {
    PageBuffer pb=storage.createPageBufForShare(sh.getStream(),sh.getFile(),true);
    FormatSupportProvider fsp=rbnb.getFormatService().getFormatSupportProvider(s.getMimeType());
    if (fsp == null)     throw new IOException("String_Node_Str" + s.getMimeType());
    log.debug("String_Node_Str" + dataFile.getAbsolutePath());
    fsp.paginate(dataFile,pb);
  }
 catch (  IOException e) {
    throw new RobonoboException(e);
  }
  sh.setDateAdded(now());
  db.putShare(sh);
synchronized (this) {
    shareStreamIds.add(s.getStreamId());
  }
  startShare(streamId);
  rbnb.getLibraryService().addToLibrary(streamId);
  event.fireTrackUpdated(s.getStreamId());
  event.fireMyLibraryUpdated();
  rbnb.getPlaylistService().checkPlaylistsForNewShare(sh);
}
Program: 6815
Project: 6815
Buggy source:
private void setupUpfrontAccount(final String nodeId){
  log.info("String_Node_Str" + nodeId);
  ControlConnection cc=mina.getCCM().getCCWithId(nodeId);
  if (cc == null) {
    log.error("String_Node_Str" + nodeId);
    return;
  }
  double cashToSend=mina.getCurrencyClient().getOpeningBalance();
  byte[] token;
  try {
    token=mina.getCurrencyClient().withdrawToken(cashToSend,"String_Node_Str" + nodeId);
  }
 catch (  CurrencyException e) {
    log.error("String_Node_Str" + cashToSend + "String_Node_Str"+ nodeId);
    return;
  }
synchronized (this) {
    Account a=new Account();
    a.addRecentAs(asMap.get(nodeId));
    accounts.put(nodeId,a);
  }
  try {
    TopUp tu=TopUp.newBuilder().setCurrencyToken(ByteString.copyFrom(token)).build();
    cc.sendMessageOrThrow("String_Node_Str",tu);
  }
 catch (  Exception e) {
    final byte[] tok=token;
    mina.getExecutor().execute(new CatchingRunnable(){
      public void doRun() throws Exception {
        log.error("String_Node_Str");
        mina.getCurrencyClient().depositToken(tok,"String_Node_Str" + nodeId);
      }
    }
);
  }
synchronized (this) {
    accounts.get(nodeId).balance+=cashToSend;
  }
  accountSetupSucceeded(nodeId);
}

Fixed version (ground truth):
private void setupUpfrontAccount(final String nodeId){
  log.info("String_Node_Str" + nodeId);
  ControlConnection cc=mina.getCCM().getCCWithId(nodeId);
  if (cc == null) {
    log.error("String_Node_Str" + nodeId);
    return;
  }
  double cashToSend=mina.getCurrencyClient().getOpeningBalance();
  byte[] token;
  try {
    token=mina.getCurrencyClient().withdrawToken(cashToSend,"String_Node_Str" + nodeId);
  }
 catch (  CurrencyException e) {
    log.error("String_Node_Str" + cashToSend + "String_Node_Str"+ nodeId);
    return;
  }
synchronized (this) {
    Account a=new Account();
    a.addRecentAs(asMap.get(nodeId));
    accounts.put(nodeId,a);
  }
  try {
    TopUp tu=TopUp.newBuilder().setCurrencyToken(ByteString.copyFrom(token)).build();
    cc.sendMessageOrThrow("String_Node_Str",tu);
  }
 catch (  IOException e) {
    final byte[] tok=token;
    mina.getExecutor().execute(new CatchingRunnable(){
      public void doRun() throws Exception {
        log.error("String_Node_Str");
        mina.getCurrencyClient().depositToken(tok,"String_Node_Str" + nodeId);
      }
    }
);
  }
synchronized (this) {
    accounts.get(nodeId).balance+=cashToSend;
  }
  accountSetupSucceeded(nodeId);
}
Program: 6816
Project: 6816
Buggy source:
public GetCCAttempt(String sid,SourceStatus ss){
  super(mina.getExecutor(),mina.getConfig().getMessageTimeout() * 1000,"String_Node_Str");
  this.sourceStat=ss;
  this.sid=sid;
  this.nodeId=ss.getFromNode().getId();
}

Fixed version (ground truth):
public GetCCAttempt(String sid,SourceStatus ss){
  super(mina.getExecutor(),mina.getConfig().getMessageTimeout() * 1000,"String_Node_Str");
  this.sourceStat=ss;
  this.sid=sid;
  this.nid=ss.getFromNode().getId();
}
Program: 6817
Project: 6817
Buggy source:
/** 
 * @syncpriority 200
 */
protected void onFail(){
  log.info("String_Node_Str" + nodeId + "String_Node_Str"+ sid+ "String_Node_Str");
synchronized (StreamConnsMgr.this) {
    pendingCons.remove(nodeId);
  }
  mina.getSourceMgr().cachePossiblyDeadSource(sourceStat.getFromNode(),sid);
  mina.getStreamMgr().requestCachedSources(sid);
}

Fixed version (ground truth):
/** 
 * @syncpriority 200
 */
protected void onFail(){
  log.info("String_Node_Str" + nid + "String_Node_Str"+ sid+ "String_Node_Str");
synchronized (StreamConnsMgr.this) {
    removePendingConn(sid,nid);
  }
  mina.getSourceMgr().cachePossiblyDeadSource(sourceStat.getFromNode(),sid);
  mina.getStreamMgr().requestCachedSources(sid);
}
Program: 6818
Project: 6818
Buggy source:
/** 
 * @syncpriority 200
 */
protected void onSuccess(){
synchronized (StreamConnsMgr.this) {
    pendingCons.remove(nodeId);
  }
  ControlConnection cc=mina.getCCM().getCCWithId(nodeId);
  if (cc == null) {
    onFail();
    return;
  }
  log.info("String_Node_Str" + cc.getNodeId() + "String_Node_Str"+ sid);
  startListeningTo(cc,sid,sourceStat);
}

Fixed version (ground truth):
/** 
 * @syncpriority 200
 */
protected void onSuccess(){
synchronized (StreamConnsMgr.this) {
    removePendingConn(sid,nid);
  }
  ControlConnection cc=mina.getCCM().getCCWithId(nid);
  if (cc == null) {
    onFail();
    return;
  }
  log.info("String_Node_Str" + cc.getNodeId() + "String_Node_Str"+ sid);
  startListeningTo(cc,sid,sourceStat);
}
Program: 6819
Project: 6819
Buggy source:
/** 
 * @syncpriority 60
 */
public synchronized void close(String reason){
  if (closing)   return;
  closing=true;
  if (reason != null) {
    try {
      Bye bye=Bye.newBuilder().setReason(reason).build();
      sendMessage("String_Node_Str",bye,false);
    }
 catch (    Exception ignore) {
    }
  }
  log.info("String_Node_Str" + nodeId + "String_Node_Str");
  mina.getExecutor().execute(new KillCPairsRunner());
  if (pingTask != null)   pingTask.cancel(true);
  if (helloAttempt != null)   helloAttempt.cancel();
  if (pingAttempt != null)   pingAttempt.cancel();
  if (closeAttempt != null)   closeAttempt.cancel();
  dataChan.close();
  closed=true;
}

Fixed version (ground truth):
/** 
 * @syncpriority 60
 */
public synchronized void close(String reason){
  if (closing)   return;
  closing=true;
  if (reason != null) {
    try {
      Bye bye=Bye.newBuilder().setReason(reason).build();
      sendMessage("String_Node_Str",bye,false);
    }
 catch (    Exception ignore) {
    }
  }
  log.info("String_Node_Str" + nodeId + "String_Node_Str");
  mina.getExecutor().execute(new DoCloseRunner());
  if (pingTask != null)   pingTask.cancel(true);
  if (helloAttempt != null)   helloAttempt.cancel();
  if (pingAttempt != null)   pingAttempt.cancel();
  if (closeAttempt != null)   closeAttempt.cancel();
  dataChan.close();
  closed=true;
}
Program: 6820
Project: 6820
Buggy source:
public void sendMessageOrThrow(String msgName,GeneratedMessage msg) throws Exception {
  try {
    sendMessage(msgName,msg,true);
  }
 catch (  Exception e) {
    log.error(this + "String_Node_Str",e);
    close();
    throw e;
  }
}

Fixed version (ground truth):
public void sendMessageOrThrow(String msgName,GeneratedMessage msg) throws IOException {
  try {
    sendMessage(msgName,msg,true);
  }
 catch (  IOException e) {
    log.error(this + "String_Node_Str",e);
    close();
    throw e;
  }
}
Program: 6821
Project: 6821
Buggy source:
/** 
 * @syncpriority 60
 */
private synchronized void sendMessage(String msgName,GeneratedMessage msg,boolean checkReady) throws Exception {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  baos.write(msgName.getBytes());
  baos.write(0);
  baos.write(Dlugosz.encode(msg.getSerializedSize()).array());
  msg.writeTo(baos);
  if (checkReady) {
    while (!handshakeComplete)     wait();
  }
  byte[] sendData=baos.toByteArray();
  log.debug("String_Node_Str" + msgName + "String_Node_Str"+ msg+ "String_Node_Str"+ nodeId.toString()+ "String_Node_Str"+ sendData.length+ "String_Node_Str");
  try {
    dataChan.receiveData(ByteBuffer.wrap(sendData),null);
  }
 catch (  IOException e) {
    if (!closing) {
      if (CodeUtil.javaMajorVersion() >= 6)       throw new IOException(e);
      throw new IOException("String_Node_Str" + e.getClass().getSimpleName() + "String_Node_Str"+ e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * @syncpriority 60
 */
private synchronized void sendMessage(String msgName,GeneratedMessage msg,boolean checkReady) throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  baos.write(msgName.getBytes());
  baos.write(0);
  baos.write(Dlugosz.encode(msg.getSerializedSize()).array());
  msg.writeTo(baos);
  if (checkReady) {
    while (!handshakeComplete) {
      try {
        wait();
      }
 catch (      InterruptedException e) {
        if (CodeUtil.javaMajorVersion() >= 6)         throw new IOException(e);
 else         throw new IOException("String_Node_Str");
      }
    }
  }
  byte[] sendData=baos.toByteArray();
  log.debug("String_Node_Str" + msgName + "String_Node_Str"+ msg+ "String_Node_Str"+ nodeId.toString()+ "String_Node_Str"+ sendData.length+ "String_Node_Str");
  try {
    dataChan.receiveData(ByteBuffer.wrap(sendData),null);
  }
 catch (  IOException e) {
    if (!closing) {
      if (CodeUtil.javaMajorVersion() >= 6)       throw new IOException(e);
      throw new IOException("String_Node_Str" + e.getClass().getSimpleName() + "String_Node_Str"+ e.getMessage());
    }
  }
}
Program: 6822
Project: 6822
Buggy source:
private void sendMessageImmediate(String msgName,GeneratedMessage msg){
  try {
    sendMessage(msgName,msg,false);
  }
 catch (  Exception e) {
    log.error(this + "String_Node_Str",e);
    close();
  }
}

Fixed version (ground truth):
private void sendMessageImmediate(String msgName,GeneratedMessage msg) throws IOException {
  try {
    sendMessage(msgName,msg,false);
  }
 catch (  IOException e) {
    log.error(this + "String_Node_Str",e);
    close();
    throw e;
  }
}
Program: 6823
Project: 6823
Buggy source:
public void completeHandshake(){
  handshakeComplete=true;
  Hello hel=Hello.newBuilder().setNode(mina.getNetMgr().getDescriptorForTalkingTo(nodeDesc,isLocal())).build();
  sendMessageImmediate("String_Node_Str",hel);
  lastDataRecvd=new Date();
  startPinging();
  mina.getCCM().notifySuccessfulConnection(this);
  dataChan.setDataReceiver(this);
}

Fixed version (ground truth):
public void completeHandshake(){
  handshakeComplete=true;
  Hello hel=Hello.newBuilder().setNode(mina.getNetMgr().getDescriptorForTalkingTo(nodeDesc,isLocal())).build();
  try {
    sendMessageImmediate("String_Node_Str",hel);
  }
 catch (  IOException e) {
    return;
  }
  lastDataRecvd=new Date();
  startPinging();
  mina.getCCM().notifySuccessfulConnection(this);
  dataChan.setDataReceiver(this);
}
Program: 6824
Project: 6824
Buggy source:
/** 
 * @syncpriority 130
 */
public void die(boolean sendStopSource){
  log.debug(this + "String_Node_Str");
synchronized (this) {
    if (closing)     return;
    closing=true;
    if (lc != null)     lc.close();
  }
  for (  PageAttempt rpa : reqdPages.values()) {
    rpa.failed();
  }
  if (usefulDataTimeout != null)   usefulDataTimeout.cancel(false);
  if (sendStopSource)   sendMessage("String_Node_Str",StopSource.newBuilder().setStreamId(sid).build());
  cc.removeLCPair(this);
  super.die();
}

Fixed version (ground truth):
/** 
 * @syncpriority 130
 */
public void die(boolean sendStopSource){
  log.debug(this + "String_Node_Str");
synchronized (this) {
    if (closing)     return;
    closing=true;
    if (lc != null)     lc.close();
  }
  for (  PageAttempt rpa : reqdPages.values()) {
    rpa.failed();
  }
  if (usefulDataTimeout != null)   usefulDataTimeout.cancel(false);
  if (startAttempt != null)   startAttempt.cancel();
  if (sendStopSource)   sendMessage("String_Node_Str",StopSource.newBuilder().setStreamId(sid).build());
  cc.removeLCPair(this);
  super.die();
}
Program: 6826
Project: 6826
Buggy source:
/** 
 * Gives stream ids that have been on recently-updated playlists, one per line (text/plain response type)
 */
@RequestMapping("String_Node_Str") public void showStreamIdsOnRecentPlaylists(@RequestParam(value="String_Node_Str",required=false) Long maxAgeMs,HttpServletRequest req,HttpServletResponse resp) throws IOException {
  long tenMinsInMs=(long)(10 * 60 * 1000);
  if (maxAgeMs == null || maxAgeMs > tenMinsInMs)   maxAgeMs=tenMinsInMs;
  List<MidasPlaylist> playlists=midas.getRecentPlaylists(maxAgeMs);
  Set<String> streamIds=new HashSet<String>();
  for (  MidasPlaylist pl : playlists) {
    streamIds.addAll(pl.getStreamIds());
  }
  resp.setStatus(HttpServletResponse.SC_OK);
  resp.setContentType("String_Node_Str");
  PrintWriter out=new PrintWriter(resp.getOutputStream());
  for (  String sid : streamIds) {
    out.println(sid);
  }
  out.close();
}

Fixed version (ground truth):
/** 
 * Gives stream ids that have been on recently-updated playlists, one per line (text/plain response type)
 */
@RequestMapping("String_Node_Str") public void showStreamIdsOnRecentPlaylists(@RequestParam(value="String_Node_Str",required=false) Long maxAgeMs,HttpServletRequest req,HttpServletResponse resp) throws IOException {
  long tenMinsInMs=(long)(10 * 60 * 1000);
  if (maxAgeMs == null || maxAgeMs > tenMinsInMs)   maxAgeMs=tenMinsInMs;
  List<MidasPlaylist> playlists=midas.getRecentPlaylists(maxAgeMs);
  Set<String> streamIds=new HashSet<String>();
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(playlists.size()).append("String_Node_Str");
  sb.append(req.getRemoteAddr());
  boolean first=true;
  for (  MidasPlaylist pl : playlists) {
    if (first) {
      sb.append("String_Node_Str");
      first=false;
    }
 else     sb.append("String_Node_Str");
    sb.append(pl.getTitle()).append("String_Node_Str").append(pl.getPlaylistId()).append("String_Node_Str");
    streamIds.addAll(pl.getStreamIds());
  }
  log.info(sb);
  resp.setStatus(HttpServletResponse.SC_OK);
  resp.setContentType("String_Node_Str");
  PrintWriter out=new PrintWriter(resp.getOutputStream());
  for (  String sid : streamIds) {
    out.println(sid);
  }
  out.close();
}
Program: 6827
Project: 6827
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public List<MidasPlaylist> getRecentPlaylists(long maxAgeMs){
  Date maxAge=timeInPast(maxAgeMs);
  String hql="String_Node_Str";
  Query q=getSession().createQuery(hql);
  q.setParameter("String_Node_Str",maxAge,Hibernate.DATE);
  return q.list();
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public List<MidasPlaylist> getRecentPlaylists(long maxAgeMs){
  Date maxAge=timeInPast(maxAgeMs);
  String hql="String_Node_Str";
  Query q=getSession().createQuery(hql);
  q.setParameter("String_Node_Str",maxAge,Hibernate.TIMESTAMP);
  return q.list();
}
Program: 6828
Project: 6828
Buggy source:
public void deletePlaylist(Playlist p){
  final long plId=p.getPlaylistId();
  log.debug("String_Node_Str" + plId);
  User me=rbnb.getUserService().getMyUser();
  me.getPlaylistIds().remove(plId);
  boolean firePlaylistUpdate=false;
synchronized (this) {
    p=playlists.get(plId);
    if (p == null)     throw new Errot();
    playlists.get(plId).getOwnerIds().remove(me.getUserId());
    if (p.getOwnerIds().size() > 0)     firePlaylistUpdate=true;
 else     playlists.remove(plId);
  }
  rbnb.getUserService().playlistDeleted(p);
  if (firePlaylistUpdate)   events.firePlaylistChanged(p);
  metadata.deletePlaylist(p,new PlaylistCallback(){
    public void success(    Playlist p){
      log.debug("String_Node_Str" + plId);
    }
    public void error(    long playlistId,    Exception ex){
      log.error("String_Node_Str" + playlistId,ex);
    }
  }
);
}

Fixed version (ground truth):
public void deletePlaylist(Playlist p){
  final long plId=p.getPlaylistId();
  log.debug("String_Node_Str" + plId);
  User me=rbnb.getUserService().getMyUser();
  boolean firePlaylistUpdate=false;
synchronized (this) {
    p=playlists.get(plId);
    if (p == null)     throw new Errot();
    playlists.get(plId).getOwnerIds().remove(me.getUserId());
    if (p.getOwnerIds().size() > 0)     firePlaylistUpdate=true;
 else     playlists.remove(plId);
  }
  rbnb.getUserService().playlistDeleted(p);
  if (firePlaylistUpdate)   events.firePlaylistChanged(p);
  metadata.deletePlaylist(p,new PlaylistCallback(){
    public void success(    Playlist p){
      log.debug("String_Node_Str" + plId);
    }
    public void error(    long playlistId,    Exception ex){
      log.error("String_Node_Str" + playlistId,ex);
    }
  }
);
}
Program: 6829
Project: 6829
Buggy source:
public User getMyUser(){
  if (me == null)   return null;
  return getUser(me.getEmail());
}

Fixed version (ground truth):
public User getMyUser(){
  return me;
}
Program: 6830
Project: 6830
Buggy source:
@Override public void playlistChanged(final Playlist p){
  Long plId=p.getPlaylistId();
  if (frame.getController().getMyUser().getPlaylistIds().contains(plId)) {
    invokeLater(new CatchingRunnable(){
      public void doRun() throws Exception {
        Playlist selP=(getSelectedIndex() < 0) ? null : getModel().getPlaylistAt(getSelectedIndex());
        boolean needReselect=p.equals(selP);
        getModel().remove(p);
        getModel().insertSorted(p);
        if (needReselect) {
          int idx=getModel().getPlaylistIndex(p);
          setSelectedIndex(idx);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void playlistChanged(final Playlist p){
  User me=frame.getController().getMyUser();
  if (p.getOwnerIds().contains(me.getUserId())) {
    Long plId=p.getPlaylistId();
    Set<Long> myPlIds=frame.getController().getMyUser().getPlaylistIds();
    if (!myPlIds.contains(plId))     log.error("String_Node_Str");
    invokeLater(new CatchingRunnable(){
      public void doRun() throws Exception {
        Playlist selP=(getSelectedIndex() < 0) ? null : getModel().getPlaylistAt(getSelectedIndex());
        boolean needReselect=p.equals(selP);
        getModel().remove(p);
        getModel().insertSorted(p);
        if (needReselect) {
          int idx=getModel().getPlaylistIndex(p);
          setSelectedIndex(idx);
        }
      }
    }
);
  }
}
Program: 6831
Project: 6831
Buggy source:
public void deleteDownload(String streamId) throws RobonoboException {
  log.info("String_Node_Str" + streamId);
  playback.stopIfCurrentlyPlaying(streamId);
  mina.stopReception(streamId);
  db.deleteDownload(streamId);
  if (db.getShare(streamId) == null)   storage.nukePageBuf(streamId);
synchronized (dPriority) {
    dPriority.remove(streamId);
  }
  updatePriorities();
synchronized (this) {
    downloadStreamIds.remove(streamId);
  }
  event.fireTrackUpdated(streamId);
  startMoreDownloads();
}

Fixed version (ground truth):
public void deleteDownload(String streamId) throws RobonoboException {
  log.info("String_Node_Str" + streamId);
  playback.stopIfCurrentlyPlaying(streamId);
  mina.stopReception(streamId);
  db.deleteDownload(streamId);
  if (db.getShare(streamId) == null)   storage.nukePageBuf(streamId);
synchronized (dPriority) {
    dPriority.remove(streamId);
  }
  updatePriorities();
synchronized (this) {
    downloadStreamIds.remove(streamId);
  }
  event.fireTrackUpdated(streamId);
  event.fireMyLibraryUpdated();
  startMoreDownloads();
}
Program: 6832
Project: 6832
Buggy source:
/** 
 * Delete in a batch to avoid starting downloads you're about to delete
 */
public void deleteDownloads(List<String> sids) throws RobonoboException {
  for (  String sid : sids) {
    log.info("String_Node_Str" + sid);
    playback.stopIfCurrentlyPlaying(sid);
    mina.stopReception(sid);
    db.deleteDownload(sid);
    if (db.getShare(sid) == null)     storage.nukePageBuf(sid);
synchronized (dPriority) {
      dPriority.remove(sid);
    }
synchronized (this) {
      downloadStreamIds.remove(sid);
    }
    event.fireTrackUpdated(sid);
  }
  updatePriorities();
  startMoreDownloads();
}

Fixed version (ground truth):
/** 
 * Delete in a batch to avoid starting downloads you're about to delete
 */
public void deleteDownloads(List<String> sids) throws RobonoboException {
  for (  String sid : sids) {
    log.info("String_Node_Str" + sid);
    playback.stopIfCurrentlyPlaying(sid);
    mina.stopReception(sid);
    db.deleteDownload(sid);
    if (db.getShare(sid) == null)     storage.nukePageBuf(sid);
synchronized (dPriority) {
      dPriority.remove(sid);
    }
synchronized (this) {
      downloadStreamIds.remove(sid);
    }
    event.fireTrackUpdated(sid);
  }
  updatePriorities();
  event.fireMyLibraryUpdated();
  startMoreDownloads();
}
Program: 6833
Project: 6833
Buggy source:
public void deleteShare(String streamId){
  log.info("String_Node_Str" + streamId);
  playback.stopIfCurrentlyPlaying(streamId);
  SharedTrack share=db.getShare(streamId);
  if (share == null)   return;
  stopShare(streamId);
  db.deleteShare(streamId);
  storage.nukePageBuf(streamId);
synchronized (this) {
    shareStreamIds.remove(streamId);
  }
  rbnb.getLibraryService().delFromLibrary(streamId);
  event.fireTrackUpdated(streamId);
}

Fixed version (ground truth):
public void deleteShare(String streamId){
  log.info("String_Node_Str" + streamId);
  playback.stopIfCurrentlyPlaying(streamId);
  SharedTrack share=db.getShare(streamId);
  if (share == null)   return;
  stopShare(streamId);
  db.deleteShare(streamId);
  storage.nukePageBuf(streamId);
synchronized (this) {
    shareStreamIds.remove(streamId);
  }
  rbnb.getLibraryService().delFromLibrary(streamId);
  event.fireTrackUpdated(streamId);
  event.fireMyLibraryUpdated();
}
Program: 6834
Project: 6834
Buggy source:
public static FriendLibraryTableModel create(RobonoboFrame frame,Library lib,Document searchTextDoc){
  List<Track> trax=new ArrayList<Track>();
  for (  Entry<String,Date> e : lib.getTracks().entrySet()) {
    String sid=e.getKey();
    Date added=e.getValue();
    Track t=frame.control.getTrack(sid);
    t.setDateAdded(added);
    trax.add(t);
  }
  EventList<Track> el=GlazedLists.eventList(trax);
  SortedList<Track> sl=new SortedList<Track>(el,new TrackComparator());
  TextComponentMatcherEditor<Track> matchEdit=new TextComponentMatcherEditor<Track>(searchTextDoc,new TrackFilterator());
  matchEdit.setLive(true);
  FilterList<Track> fl=new FilterList<Track>(sl,matchEdit);
  return new FriendLibraryTableModel(frame,lib,el,sl,fl);
}

Fixed version (ground truth):
public static FriendLibraryTableModel create(RobonoboFrame frame,Library lib,Document searchTextDoc){
  Map<String,Date> tMap=new HashMap<String,Date>(lib.getTracks());
  List<Track> trax=new ArrayList<Track>();
  for (  Entry<String,Date> e : tMap.entrySet()) {
    String sid=e.getKey();
    Date added=e.getValue();
    Track t=frame.control.getTrack(sid);
    t.setDateAdded(added);
    trax.add(t);
  }
  EventList<Track> el=GlazedLists.eventList(trax);
  SortedList<Track> sl=new SortedList<Track>(el,new TrackComparator());
  TextComponentMatcherEditor<Track> matchEdit=new TextComponentMatcherEditor<Track>(searchTextDoc,new TrackFilterator());
  matchEdit.setLive(true);
  FilterList<Track> fl=new FilterList<Track>(sl,matchEdit);
  return new FriendLibraryTableModel(frame,lib,el,sl,fl);
}
Program: 6835
Project: 6835
Buggy source:
public void getOrFetchPlaylist(long playlistId,PlaylistHandler handler){
  inst.getPlaylistService().getOrFetchPlaylist(playlistId,handler);
}

Fixed version (ground truth):
public void getOrFetchPlaylist(long playlistId,PlaylistCallback handler){
  inst.getPlaylistService().getOrFetchPlaylist(playlistId,handler);
}
Program: 6836
Project: 6836
Buggy source:
public void fetchMyUserConfig(UserConfigHandler handler){
  inst.getUserService().refreshMyUserConfig(handler);
}

Fixed version (ground truth):
public void fetchMyUserConfig(UserConfigCallback handler){
  inst.getUserService().refreshMyUserConfig(handler);
}
Program: 6837
Project: 6837
Buggy source:
public void createPlaylist(Playlist p,PlaylistHandler handler){
  inst.getPlaylistService().createPlaylist(p,handler);
}

Fixed version (ground truth):
public void createPlaylist(Playlist p,PlaylistCallback handler){
  inst.getPlaylistService().createPlaylist(p,handler);
}
Program: 6838
Project: 6838
Buggy source:
public abstract void fetchUsers(Collection<Long> userIds,UserHandler handler);

Fixed version (ground truth):
public abstract void fetchUsers(Collection<Long> userIds,UserCallback handler);
Program: 6839
Project: 6839
Buggy source:
/** 
 * @param handler on error, the user id will not be meaningful
 */
public abstract void fetchUserForLogin(String email,String password,UserHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on error, the user id will not be meaningful
 */
public abstract void fetchUserForLogin(String email,String password,UserCallback handler);
Program: 6840
Project: 6840
Buggy source:
/** 
 * @param handler on success, the passed stream may be null
 */
public abstract void putStream(Stream s,StreamHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on success, the passed stream may be null
 */
public abstract void putStream(Stream s,StreamCallback handler);
Program: 6841
Project: 6841
Buggy source:
public abstract void fetchPlaylist(long playlistId,PlaylistHandler handler);

Fixed version (ground truth):
public abstract void fetchPlaylist(long playlistId,PlaylistCallback handler);
Program: 6842
Project: 6842
Buggy source:
public abstract void fetchUserConfig(long userId,UserConfigHandler handler);

Fixed version (ground truth):
public abstract void fetchUserConfig(long userId,UserConfigCallback handler);
Program: 6843
Project: 6843
Buggy source:
public abstract void fetchStreams(Collection<String> sids,StreamHandler handler);

Fixed version (ground truth):
public abstract void fetchStreams(Collection<String> sids,StreamCallback handler);
Program: 6844
Project: 6844
Buggy source:
public abstract void sharePlaylist(Playlist p,Collection<Long> shareFriendIds,Collection<String> friendEmails,PlaylistHandler handler);

Fixed version (ground truth):
public abstract void sharePlaylist(Playlist p,Collection<Long> shareFriendIds,Collection<String> friendEmails,PlaylistCallback handler);
Program: 6845
Project: 6845
Buggy source:
/** 
 * @param handler on success, the passed library may be null
 */
public abstract void addToLibrary(long userId,Library addedLib,LibraryHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on success, the passed library may be null
 */
public abstract void addToLibrary(long userId,Library addedLib,LibraryCallback handler);
Program: 6846
Project: 6846
Buggy source:
public abstract void search(String query,int firstResult,SearchHandler handler);

Fixed version (ground truth):
public abstract void search(String query,int firstResult,SearchCallback handler);
Program: 6847
Project: 6847
Buggy source:
/** 
 * Will remove the logged-in user from the list of playlist owners, or delete the playlist if they are the only owner
 * @param handler on success, the passed playlist will be null
 */
public abstract void deletePlaylist(Playlist p,PlaylistHandler handler);

Fixed version (ground truth):
/** 
 * Will remove the logged-in user from the list of playlist owners, or delete the playlist if they are the only owner
 * @param handler on success, the passed playlist will be null
 */
public abstract void deletePlaylist(Playlist p,PlaylistCallback handler);
Program: 6848
Project: 6848
Buggy source:
public abstract void fetchPlaylists(Collection<Long> playlistIds,PlaylistHandler handler);

Fixed version (ground truth):
public abstract void fetchPlaylists(Collection<Long> playlistIds,PlaylistCallback handler);
Program: 6849
Project: 6849
Buggy source:
public abstract void fetchUser(long userId,UserHandler handler);

Fixed version (ground truth):
public abstract void fetchUser(long userId,UserCallback handler);
Program: 6850
Project: 6850
Buggy source:
/** 
 * @param handler on success, the passed userconfig may be null
 */
public abstract void updateUserConfig(UserConfig uc,UserConfigHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on success, the passed userconfig may be null
 */
public abstract void updateUserConfig(UserConfig uc,UserConfigCallback handler);
Program: 6851
Project: 6851
Buggy source:
public abstract void fetchLibrary(long userId,Date lastUpdated,LibraryHandler handler);

Fixed version (ground truth):
public abstract void fetchLibrary(long userId,Date lastUpdated,LibraryCallback handler);
Program: 6852
Project: 6852
Buggy source:
/** 
 * @param handler on success, the passed playlist may be null
 */
public abstract void postPlaylistUpdateToService(String service,long playlistId,String msg,PlaylistHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on success, the passed playlist may be null
 */
public abstract void postPlaylistUpdateToService(String service,long playlistId,String msg,PlaylistCallback handler);
Program: 6853
Project: 6853
Buggy source:
/** 
 * @param handler on success, the passed library may be null
 */
public abstract void deleteFromLibrary(long userId,Library delLib,LibraryHandler handler);

Fixed version (ground truth):
/** 
 * @param handler on success, the passed library may be null
 */
public abstract void deleteFromLibrary(long userId,Library delLib,LibraryCallback handler);
Program: 6854
Project: 6854
Buggy source:
public abstract void updatePlaylist(Playlist p,PlaylistHandler handler);

Fixed version (ground truth):
public abstract void updatePlaylist(Playlist p,PlaylistCallback handler);
Program: 6855
Project: 6855
Buggy source:
@Override protected void runBatch(Collection<String> streamIds) throws Exception {
  if (streamIds.size() == 0)   return;
  Library lib=new Library();
  for (  String sid : streamIds) {
    lib.getTracks().put(sid,null);
  }
  User me=rbnb.getUserService().getMyUser();
  metadata.deleteFromLibrary(me.getUserId(),lib,new LibraryHandler(){
    public void success(    Library l){
      log.debug("String_Node_Str");
    }
    public void error(    long userId,    Exception e){
      log.error("String_Node_Str",e);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void runBatch(Collection<String> streamIds) throws Exception {
  if (streamIds.size() == 0)   return;
  Library lib=new Library();
  for (  String sid : streamIds) {
    lib.getTracks().put(sid,null);
  }
  User me=rbnb.getUserService().getMyUser();
  metadata.deleteFromLibrary(me.getUserId(),lib,new LibraryCallback(){
    public void success(    Library l){
      log.debug("String_Node_Str");
    }
    public void error(    long userId,    Exception e){
      log.error("String_Node_Str",e);
    }
  }
);
}
Program: 6856
Project: 6856
Buggy source:
public void sharePlaylist(final Playlist p,final Set<Long> friendIds,Set<String> emails) throws IOException, RobonoboException {
  metadata.sharePlaylist(p,friendIds,emails,new PlaylistHandler(){
    public void success(    Playlist newP){
      log.debug("String_Node_Str" + p.getPlaylistId());
synchronized (PlaylistService.this) {
        playlists.put(newP.getPlaylistId(),newP);
      }
      rbnb.getUserService().playlistShared(p,friendIds);
    }
    public void error(    long playlistId,    Exception ex){
      log.error("String_Node_Str" + playlistId,ex);
    }
  }
);
}

Fixed version (ground truth):
public void sharePlaylist(final Playlist p,final Set<Long> friendIds,Set<String> emails) throws IOException, RobonoboException {
  metadata.sharePlaylist(p,friendIds,emails,new PlaylistCallback(){
    public void success(    Playlist newP){
      log.debug("String_Node_Str" + p.getPlaylistId());
synchronized (PlaylistService.this) {
        playlists.put(newP.getPlaylistId(),newP);
      }
      rbnb.getUserService().playlistShared(p,friendIds);
    }
    public void error(    long playlistId,    Exception ex){
      log.error("String_Node_Str" + playlistId,ex);
    }
  }
);
}