nus-yam/ex-repair huggingface dataset:
Program: 26040
Project: 26040
Buggy source:
/** 
 * Reports a result back to any callback implementation.
 * @param ticket The request ticket to pass back to the caller.
 * @param resultListener The callback implementation to call through.
 * @param result The result of the request.
 */
protected void reportResult(final Object ticket,final ResultListener resultListener,final RestResult result){
  if (resultListener != null) {
    callerHandler.post(new Runnable(){
      @Override public void run(){
        if (result == null) {
          resultListener.onFailure(ticket,null);
        }
 else         if (result.isSuccess()) {
          resultListener.onSuccess(ticket,result.item());
        }
 else {
          resultListener.onFailure(ticket,result.message());
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Reports a result back to any callback implementation.
 * @param ticket The request ticket to pass back to the caller.
 * @param resultListener The callback implementation to call through.
 * @param result The result of the request.
 */
protected void reportResult(final Object ticket,final ResultListener resultListener,final RestResult result){
  if (resultListener != null) {
    callerHandler.post(new Runnable(){
      @Override public void run(){
        if (result == null) {
          resultListener.onFailure(ticket,null);
        }
 else {
          if (result.isSuccess()) {
            resultListener.onSuccess(ticket,result.item());
          }
 else {
            resultListener.onFailure(ticket,result.message());
          }
          Session session=result.session();
          if (session != null) {
            resultListener.onSessionChange(ticket,session);
          }
        }
      }
    }
);
  }
}
Program: 26041
Project: 26041
Buggy source:
/** 
 * Constructor. The one and only way to set the state of this object.
 * @param isSuccess Boolean true if this object represents a successfully performed  {@link RestRequest}. Boolean false otherwise.
 * @param message A optional message provided to the caller by the creator of this object.
 * @param item Optional content of this object.
 */
public RestResult(boolean isSuccess,String message,Object item){
  this.isSuccess=isSuccess;
  this.message=message;
  this.item=item;
}

Fixed version (ground truth):
/** 
 * Constructor. The one and only way to set the state of this object.
 * @param isSuccess Boolean true if this object represents a successfully performed  {@link RestRequest}. Boolean false otherwise.
 * @param session The new session variables, if changed. Otherwise null.
 * @param message A optional message provided to the caller by the creator of this object.
 * @param item Optional content of this object.
 */
public RestResult(boolean isSuccess,Session session,String message,Object item){
  this.isSuccess=isSuccess;
  this.session=session;
  this.message=message;
  this.item=item;
}
Program: 26042
Project: 26042
Buggy source:
public AuthRequest(String url,String body,RequestFuture<JSONObject> future){
  super(Method.POST,url,null,future,future);
  setShouldCache(false);
  authBody=body;
}

Fixed version (ground truth):
public AuthRequest(String url,Map<String,String> params,RequestFuture<String> future){
  super(Method.POST,url,future,future);
  setShouldCache(false);
  this.params=params;
}
Program: 26044
Project: 26044
Buggy source:
@Override public RestResult post(Uri uri,Object item,Class<?> classOfItem){
  long id=-1L;
  SQLiteDatabase database=openDatabase(uri);
  if (database != null) {
    String json=itemToJsonParser.parse(item,classOfItem);
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",uri.toString());
    values.put("String_Node_Str",json);
    id=database.insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_IGNORE);
  }
  boolean isSuccess=id != -1L;
  String message=null;
  List<?> items=null;
  RestResult result=new RestResult(isSuccess,message,items);
  return result;
}

Fixed version (ground truth):
@Override public RestResult post(Uri uri,Object item,Class<?> classOfItem){
  long id=-1L;
  SQLiteDatabase database=openDatabase(uri);
  if (database != null) {
    String json=itemToJsonParser.parse(item,classOfItem);
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",uri.toString());
    values.put("String_Node_Str",json);
    id=database.insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
  boolean isSuccess=id != -1L;
  String message=null;
  List<?> items=null;
  RestResult result=new RestResult(isSuccess,message,items);
  return result;
}
Program: 26045
Project: 26045
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  logger.info("String_Node_Str");
  if (outboundChannel != null) {
    closeOnFlush(outboundChannel);
  }
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  if (outboundChannel != null) {
    closeOnFlush(outboundChannel);
  }
}
Program: 26046
Project: 26046
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  outboundChannel=f.channel();
  f.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture channelFuture) throws Exception {
      if (!channelFuture.isSuccess()) {
        close();
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  final ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  outboundChannel=f.channel();
  f.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture channelFuture) throws Exception {
      if (!channelFuture.isSuccess()) {
        log.info("String_Node_Str" + outboundRemoteHost.getRemoteHost() + "String_Node_Str"+ outboundRemoteHost.getRemotePort());
        close();
      }
    }
  }
);
}
Program: 26047
Project: 26047
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  logger.info("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  log.info("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  close();
}
Program: 26048
Project: 26048
Buggy source:
@Override public void operationComplete(final ChannelFuture channelFuture) throws Exception {
  if (!channelFuture.isSuccess()) {
    close();
  }
}

Fixed version (ground truth):
@Override public void operationComplete(final ChannelFuture channelFuture) throws Exception {
  if (!channelFuture.isSuccess()) {
    log.info("String_Node_Str" + outboundRemoteHost.getRemoteHost() + "String_Node_Str"+ outboundRemoteHost.getRemotePort());
    close();
  }
}
Program: 26049
Project: 26049
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  logger.info("String_Node_Str");
  proxyFrondtendHandle.close();
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  proxyFrondtendHandle.close();
}
Program: 26050
Project: 26050
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  logger.info("String_Node_Str");
  proxyFrondtendHandle.outBoundChannelReady();
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  proxyFrondtendHandle.outBoundChannelReady();
}
Program: 26051
Project: 26051
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  logger.info("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  proxyFrondtendHandle.close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  log.info("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  proxyFrondtendHandle.close();
}
Program: 26052
Project: 26052
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  outboundChannel=f.channel();
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  outboundChannel=f.channel();
  f.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture channelFuture) throws Exception {
      if (!channelFuture.isSuccess()) {
        close();
      }
    }
  }
);
}
Program: 26053
Project: 26053
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  proxyFrondtendHandle.close();
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.debug("String_Node_Str");
  proxyFrondtendHandle.close();
}
Program: 26054
Project: 26054
Buggy source:
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
  log.debug("String_Node_Str");
}
Program: 26055
Project: 26055
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  proxyFrondtendHandle.outBoundChannelReady();
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  log.debug("String_Node_Str");
  proxyFrondtendHandle.outBoundChannelReady();
}
Program: 26056
Project: 26056
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.info("String_Node_Str");
  if (outboundChannel != null) {
    closeOnFlush(outboundChannel);
  }
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  log.debug("String_Node_Str");
  close();
}
Program: 26057
Project: 26057
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  final ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  outboundChannel=f.channel();
  f.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture channelFuture) throws Exception {
      if (!channelFuture.isSuccess()) {
        log.info("String_Node_Str" + outboundRemoteHost.getRemoteHost() + "String_Node_Str"+ outboundRemoteHost.getRemotePort());
        close();
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  inboundChannel=ctx.channel();
  InetSocketAddress localAddress=(InetSocketAddress)inboundChannel.localAddress();
  int port=localAddress.getPort();
  final ProxyHost outboundRemoteHost=TcpProxyServer.getProxyHosts().get(port);
  Bootstrap b=new Bootstrap();
  b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass()).handler(new BackendInitializer(this)).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
  ChannelFuture f=b.connect(outboundRemoteHost.getRemoteHost(),outboundRemoteHost.getRemotePort());
  connectStatus=ConnectionStatus.outBoundChnnlConnecting;
  outboundChannel=f.channel();
  f.addListener(new ChannelFutureListener(){
    @Override public void operationComplete(    final ChannelFuture channelFuture) throws Exception {
      if (!channelFuture.isSuccess()) {
        log.info("String_Node_Str" + outboundRemoteHost.getRemoteHost() + "String_Node_Str"+ outboundRemoteHost.getRemotePort());
        close();
      }
    }
  }
);
}
Program: 26058
Project: 26058
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  log.info("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  log.debug("String_Node_Str" + ctx.channel().remoteAddress(),cause);
  close();
}
Program: 26059
Project: 26059
Buggy source:
public void outBoundChannelReady(){
synchronized (buffer) {
    if (outboundChannel.isActive()) {
      for (      Object ojb : buffer) {
        outboundChannel.writeAndFlush(ojb);
      }
      buffer.clear();
    }
    outBoundChnnlReady=true;
  }
}

Fixed version (ground truth):
public void outBoundChannelReady(){
  inboundChannel.config().setAutoRead(true);
  connectStatus=ConnectionStatus.outBoundChnnlReady;
  for (  Object obj : inboundMsgBuffer) {
    outboundChannel.writeAndFlush(obj);
  }
  inboundMsgBuffer.clear();
}
Program: 26060
Project: 26060
Buggy source:
public void close(){
  closeOnFlush(inboundChannel);
  closeOnFlush(outboundChannel);
}

Fixed version (ground truth):
public void close(){
  connectStatus=ConnectionStatus.closing;
  for (  Object obj : inboundMsgBuffer) {
    release(obj);
  }
  inboundMsgBuffer.clear();
  closeOnFlush(inboundChannel);
  closeOnFlush(outboundChannel);
}
Program: 26061
Project: 26061
Buggy source:
@Override public void channelRead(final ChannelHandlerContext ctx,Object msg) throws Exception {
  if (outBoundChnnlReady) {
    outboundChannel.writeAndFlush(msg);
    return;
  }
synchronized (buffer) {
    if (outBoundChnnlReady) {
      outboundChannel.writeAndFlush(msg);
      return;
    }
    if (outboundChannel.isActive()) {
      for (      Object ojb : buffer) {
        outboundChannel.writeAndFlush(ojb);
      }
      buffer.clear();
      outboundChannel.writeAndFlush(msg);
    }
 else {
      buffer.add(msg);
    }
  }
}

Fixed version (ground truth):
@Override public void channelRead(final ChannelHandlerContext ctx,Object msg) throws Exception {
switch (connectStatus) {
case outBoundChnnlReady:
    outboundChannel.writeAndFlush(msg);
  break;
case closing:
release(msg);
break;
case init:
log.error("String_Node_Str");
close();
break;
case outBoundChnnlConnecting:
default :
inboundMsgBuffer.add(msg);
}
}
Program: 26062
Project: 26062
Buggy source:
private void run() throws Exception {
  EventLoopGroup bossGroup=new NioEventLoopGroup();
  EventLoopGroup workerGroup=new NioEventLoopGroup(TcpProxyServer.getConfig().getInt("String_Node_Str"));
  try {
    ServerBootstrap b=new ServerBootstrap();
    b.group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).childHandler(new FrontendInitializer()).option(ChannelOption.SO_BACKLOG,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true);
    ArrayList<Channel> allchannels=new ArrayList<Channel>();
    ArrayList<ProxyHost> hostList=getProxyHostList();
    log.info("String_Node_Str");
    for (    ProxyHost host : hostList) {
      proxyHosts.put(host.localPort,host);
      log.info("String_Node_Str" + host.localPort + "String_Node_Str"+ host.remoteHost+ "String_Node_Str"+ host.remotePort);
      Channel ch=b.bind(host.localPort).sync().channel();
      allchannels.add(ch);
    }
    log.info("String_Node_Str");
    for (    Channel ch : allchannels) {
      ch.closeFuture().sync();
    }
  }
  finally {
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
  }
}

Fixed version (ground truth):
private void run() throws Exception {
  EventLoopGroup bossGroup=new NioEventLoopGroup();
  EventLoopGroup workerGroup=new NioEventLoopGroup(TcpProxyServer.getConfig().getInt("String_Node_Str"));
  try {
    ServerBootstrap b=new ServerBootstrap();
    b.group(bossGroup,workerGroup).channel(NioServerSocketChannel.class).childHandler(new FrontendInitializer()).option(ChannelOption.SO_BACKLOG,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_REUSEADDR,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,TcpProxyServer.getConfig().getInt("String_Node_Str")).option(ChannelOption.SO_KEEPALIVE,true).option(ChannelOption.ALLOCATOR,PooledByteBufAllocator.DEFAULT).childOption(ChannelOption.ALLOCATOR,PooledByteBufAllocator.DEFAULT).childOption(ChannelOption.AUTO_READ,false);
    ArrayList<Channel> allchannels=new ArrayList<Channel>();
    ArrayList<ProxyHost> hostList=getProxyHostList();
    log.info("String_Node_Str");
    for (    ProxyHost host : hostList) {
      proxyHosts.put(host.localPort,host);
      log.info("String_Node_Str" + host.localPort + "String_Node_Str"+ host.remoteHost+ "String_Node_Str"+ host.remotePort);
      Channel ch=b.bind(host.localPort).sync().channel();
      allchannels.add(ch);
    }
    log.info("String_Node_Str");
    for (    Channel ch : allchannels) {
      ch.closeFuture().sync();
    }
  }
  finally {
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
  }
}
Program: 26063
Project: 26063
Buggy source:
/** 
 * Registers an instance as being a listener, any packets received from linked Connection will be passed to applicable methods <p/> Methods must have the   {@link com.ikeirnez.communicationsframework.api.packets.PacketHandler} annotationMethods have an optional first parameter  {@link com.ikeirnez.communicationsframework.api.connection.Connection} and a required second parameter implementing {@link com.ikeirnez.communicationsframework.api.packets.Packet}
 * @param packetListener The instance we should register and pass packets to
 */
public void registerListener(PacketListener packetListener);

Fixed version (ground truth):
/** 
 * Registers an instance as being a listener, any packets received from linked Connection will be passed to applicable methods Methods must have the   {@link com.ikeirnez.communicationsframework.api.packets.PacketHandler} annotationMethods have an optional first parameter  {@link com.ikeirnez.communicationsframework.api.connection.Connection} and a required second parameter implementing {@link com.ikeirnez.communicationsframework.api.packets.Packet}
 * @param packetListener The instance we should register and pass packets to
 */
public void registerListener(PacketListener packetListener);
Program: 26064
Project: 26064
Buggy source:
public ChannelFuture send(Packet packet){
  ChannelFuture channelFuture=ctx.writeAndFlush(packet);
  channelFuture.addListener(new GenericFutureListener<ChannelFuture>(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (!future.isSuccess()) {
        throw new Exception("String_Node_Str",future.cause());
      }
    }
  }
);
  return channelFuture;
}

Fixed version (ground truth):
public ChannelFuture send(Packet packet){
  ChannelFuture channelFuture=ctx.writeAndFlush(packet);
  channelFuture.addListener(new GenericFutureListener<ChannelFuture>(){
    @Override public void operationComplete(    ChannelFuture future) throws Exception {
      if (!future.isSuccess() && !connection.closing.get()) {
        throw new Exception("String_Node_Str",future.cause());
      }
    }
  }
);
  return channelFuture;
}
Program: 26065
Project: 26065
Buggy source:
@Override public void close() throws IOException {
  if (ctx != null) {
    connection.closing.set(true);
    send(new PacketDisconnect()).syncUninterruptibly();
    ctx.channel().disconnect().syncUninterruptibly();
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  if (ctx != null) {
    connection.closing.set(true);
    if (connection.isConnected()) {
      send(new PacketDisconnect()).syncUninterruptibly();
    }
    ctx.channel().disconnect().syncUninterruptibly();
  }
}
Program: 26066
Project: 26066
Buggy source:
@Override public void operationComplete(ChannelFuture future) throws Exception {
  if (!future.isSuccess()) {
    throw new Exception("String_Node_Str",future.cause());
  }
}

Fixed version (ground truth):
@Override public void operationComplete(ChannelFuture future) throws Exception {
  if (!future.isSuccess() && !connection.closing.get()) {
    throw new Exception("String_Node_Str",future.cause());
  }
}
Program: 26067
Project: 26067
Buggy source:
private boolean isMethodApplicable(Method method){
  Class<?>[] parameters=method.getParameterTypes();
  return method.isAnnotationPresent(PacketHandler.class) && ((parameters.length == 1 && Packet.class.isAssignableFrom(parameters[0])) || (parameters.length == 2 && Connection.class.equals(parameters[0].getClass()) && Packet.class.isAssignableFrom(parameters[1])));
}

Fixed version (ground truth):
private boolean isMethodApplicable(Method method){
  Class<?>[] parameters=method.getParameterTypes();
  return method.isAnnotationPresent(PacketHandler.class) && ((parameters.length == 1 && Packet.class.isAssignableFrom(parameters[0])) || (parameters.length == 2 && parameters[0].equals(Connection.class) && Packet.class.isAssignableFrom(parameters[1])));
}
Program: 26068
Project: 26068
Buggy source:
protected static void logEdgeScore(Edge e,double score){
  if (LOGGER.isDebugEnabled())   LOGGER.debug(String.format("String_Node_Str",Graphs.edgeToString(e),score));
}

Fixed version (ground truth):
protected void logEdgeScore(Edge e,double score){
  if (LOGGER.isDebugEnabled())   LOGGER.debug(String.format("String_Node_Str",type(),Graphs.edgeToString(e),score));
}
Program: 26069
Project: 26069
Buggy source:
@Override public Double transform(Edge e){
  String pred=getPred(e);
  String obj=getObj(e);
  double score=ic(pred) + ic(pred + obj) / ic(pred);
  logEdgeScore(e,score);
  return score;
}

Fixed version (ground truth):
@Override public Double transform(Edge e){
  String pred=getPred(e);
  String obj=getObj(e);
  double icObjGivenPred=-1 * Math.log(p(pred + obj) / p(pred));
  double score=ic(pred) + icObjGivenPred;
  logEdgeScore(e,score);
  return score;
}
Program: 26070
Project: 26070
Buggy source:
@Override public Double getVertexScore(Vertex v){
  double score=betweenness.getVertexScore(v);
  double normalizedScore=score / ((verticesCount - 1) * (verticesCount - 2));
  return normalizedScore;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  double score=betweenness.getVertexScore(v);
  if (graphType == GraphType.UNDIRECTED_GRAPH)   score/=2;
  double normalizedScore=score / ((verticesCount - 1) * (verticesCount - 2));
  return normalizedScore;
}
Program: 26071
Project: 26071
Buggy source:
@Override protected VertexScorer<Vertex,Double> getVertexScorer(Graph subgraph,Map<Vertex,Double> vertexPriors){
  GraphJung<Graph> graphJung=Graphs.asGraphJung(graphType,subgraph);
  PageRankWithPriors<Vertex,Edge> pageRank=new PageRank<Vertex,Edge>(graphJung,edgeWeights,alpha);
  return new PRVertexScorer(pageRank,subgraph,iterations);
}

Fixed version (ground truth):
@Override protected VertexScorer<Vertex,Double> getVertexScorer(Graph subgraph,Map<Vertex,Double> vertexPriors){
  GraphJung<Graph> graphJung=new GraphJung<Graph>(subgraph);
  PageRankWithPriors<Vertex,Edge> pageRank=new PageRank<Vertex,Edge>(graphJung,edgeWeights,alpha);
  return new PRVertexScorer(pageRank,subgraph,iterations);
}
Program: 26072
Project: 26072
Buggy source:
@Override public Double getVertexScore(Vertex v){
  return pageRank.getVertexScore(v) / scoreSum;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  if (scoreSum == 0)   return 0.0;
  return pageRank.getVertexScore(v) / scoreSum;
}
Program: 26073
Project: 26073
Buggy source:
@Override public List<SurfaceFormSenseScore<T,U>> disambiguate(Map<T,List<U>> surfaceFormsSenses,Graph subgraph){
  Map<T,List<SurfaceFormSenseScore<T,U>>> allScores=allSurfaceFormSensesScores(surfaceFormsSenses,subgraph);
  List<SurfaceFormSenseScore<T,U>> highestScores=new ArrayList<>();
  for (  T surfaceForm : allScores.keySet()) {
    List<SurfaceFormSenseScore<T,U>> sFSScores=allScores.get(surfaceForm);
    if (sFSScores.isEmpty()) {
      logger.warn("String_Node_Str",surfaceForm);
      continue;
    }
    SurfaceFormSenseScore<T,U> highestScoreSense=Collections.max(sFSScores,SurfaceFormSenseScore.DESCENDING_SCORE_COMPARATOR);
    highestScores.add(highestScoreSense);
  }
  return highestScores;
}

Fixed version (ground truth):
@Override public List<SurfaceFormSenseScore<T,U>> disambiguate(Map<T,List<U>> surfaceFormsSenses,Graph subgraph){
  Map<T,List<SurfaceFormSenseScore<T,U>>> allScores=allSurfaceFormSensesScores(surfaceFormsSenses,subgraph);
  List<SurfaceFormSenseScore<T,U>> highestScores=new ArrayList<>();
  for (  T surfaceForm : allScores.keySet()) {
    List<SurfaceFormSenseScore<T,U>> sFSScores=allScores.get(surfaceForm);
    if (sFSScores.isEmpty()) {
      logger.warn("String_Node_Str",surfaceForm);
      continue;
    }
    SurfaceFormSenseScore<T,U> highestScoreSense=Collections.max(sFSScores,SurfaceFormSenseScore.SCORE_COMPARATOR);
    highestScores.add(highestScoreSense);
  }
  return highestScores;
}
Program: 26074
Project: 26074
Buggy source:
/** 
 * Main method.
 * @param args each arg can be a directory containing RDF files or a RDF file itself.
 * @throws FileNotFoundException
 */
public static void main(String[] args) throws ConfigurationException, FileNotFoundException {
  Configuration config=GraphConfig.config();
  DBpediaGraphLoader.loadFromFiles(FileUtils.extractFilesFromArgs(args),config);
  if (EdgeWeightsType.fromConfig(config) != EdgeWeightsType.DUMMY)   PredObjOccsCounter.countAndPersistDBpediaGraphOccs();
}

Fixed version (ground truth):
/** 
 * Main method.
 * @param args each arg can be a directory containing RDF files or a RDF file itself.
 * @throws FileNotFoundException
 */
public static void main(String[] args) throws ConfigurationException, FileNotFoundException {
  Configuration config=GraphConfig.config();
  DBpediaGraphLoader.loadFromFiles(FileUtils.extractFilesFromArgs(args),config);
  if (EdgeWeightsType.fromConfig(config) != EdgeWeightsType.DUMMY)   PredObjOccsCounter.countAndPersistDBpediaGraphOccs(GraphFactory.getDBpediaGraph());
}
Program: 26075
Project: 26075
Buggy source:
/** 
 * @return prior probability (number of occurrences) of the short URI.
 */
protected double p(String shortUri){
  int shortUriCount=checkNotNull(occCounts.get(shortUri),"String_Node_Str",shortUri);
  return shortUriCount / totalEdges;
}

Fixed version (ground truth):
/** 
 * @return prior probability (number of occurrences) of the short URI.
 */
protected double p(String shortUri){
  int shortUriCount=checkNotNull(occCounts.get(shortUri),"String_Node_Str",shortUri);
  double p=(double)shortUriCount / totalEdges;
  if (LOGGER.isTraceEnabled())   LOGGER.trace(String.format("String_Node_Str",shortUri,shortUriCount,totalEdges,p));
  return p;
}
Program: 26076
Project: 26076
Buggy source:
/** 
 * @return the information content of the short URI.
 */
protected double ic(String shortUri){
  return -1 * Math.log(p(shortUri));
}

Fixed version (ground truth):
/** 
 * @return the information content of the short URI.
 */
protected double ic(String shortUri){
  double ic=-1 * Math.log(p(shortUri));
  if (LOGGER.isTraceEnabled())   LOGGER.trace(String.format("String_Node_Str",shortUri,ic));
  return ic;
}
Program: 26077
Project: 26077
Buggy source:
public static void main(String[] args){
  Map<String,Integer> map=loadOccCountsMap(GraphConfig.config());
  queryContent(map);
}

Fixed version (ground truth):
public static void main(String[] args){
  Map<String,Integer> map=loadOccCountsMap(GraphConfig.config(),false);
  queryContent(map);
}
Program: 26078
Project: 26078
Buggy source:
public static Map<String,Integer> loadOccCountsMap(Configuration config){
  logger.info("String_Node_Str");
  Stopwatch stopwatch=Stopwatch.createStarted();
  String fileName=config.getString(CONFIG_EDGE_COUNTS_FILE);
  Kryo kryo=KryoMap.getDefault();
  Input input;
  try {
    input=new Input(new FileInputStream(fileName));
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
  @SuppressWarnings("String_Node_Str") Map<String,Integer> map=kryo.readObject(input,HashMap.class);
  input.close();
  logger.info("String_Node_Str",stopwatch);
  return map;
}

Fixed version (ground truth):
public static Map<String,Integer> loadOccCountsMap(Configuration config,boolean createIfNonExisting){
  String fileName=config.getString(CONFIG_EDGE_COUNTS_FILE);
  File file=new File(fileName);
  if (createIfNonExisting && !file.exists()) {
    try {
      PredObjOccsCounter.countAndPersistDBpediaGraphOccs(GraphFactory.getDBpediaGraph());
    }
 catch (    FileNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
  logger.info("String_Node_Str");
  Stopwatch stopwatch=Stopwatch.createStarted();
  Kryo kryo=KryoMap.getDefault();
  Input input;
  try {
    input=new Input(new FileInputStream(file));
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
  @SuppressWarnings("String_Node_Str") Map<String,Integer> map=kryo.readObject(input,HashMap.class);
  input.close();
  logger.info("String_Node_Str",stopwatch);
  return map;
}
Program: 26079
Project: 26079
Buggy source:
public static void countAndPersistDBpediaGraphOccs() throws FileNotFoundException {
  logger.info("String_Node_Str");
  Graph graph=GraphFactory.getDBpediaGraph();
  Map<String,Integer> map=countGraphOccs(graph);
  graph.shutdown();
  KryoMap.serializeMap(map,GraphConfig.config());
}

Fixed version (ground truth):
public static void countAndPersistDBpediaGraphOccs(Graph graph) throws FileNotFoundException {
  logger.info("String_Node_Str");
  Map<String,Integer> map=countGraphOccs(graph);
  KryoMap.serializeMap(map,GraphConfig.config());
}
Program: 26080
Project: 26080
Buggy source:
public static void main(String[] args) throws FileNotFoundException {
  countAndPersistDBpediaGraphOccs();
}

Fixed version (ground truth):
public static void main(String[] args) throws FileNotFoundException {
  Graph graph=GraphFactory.getDBpediaGraph();
  countAndPersistDBpediaGraphOccs(graph);
  graph.shutdown();
}
Program: 26081
Project: 26081
Buggy source:
/** 
 * Returns the batch graph instance that can be used for bulk inserting nodes and vertices into the dbpedia graph. If a persisted dbpedia graph exists already it is returned, otherwise a new graph is created.
 * @param bufferSize the buffer size used for the batch inserts.
 * @return
 */
public static BatchGraph<? extends TransactionalGraph> getBatchGraph(long bufferSize){
  TransactionalGraph graph=openGraph(false);
  BatchGraph<TransactionalGraph> bgraph=new BatchGraph<>(graph,VertexIDType.STRING,bufferSize);
  long verticesCount=Graphs.verticesCount(graph);
  if (verticesCount != 0) {
    bgraph.setLoadingFromScratch(false);
    logger.info("String_Node_Str",verticesCount);
  }
  return bgraph;
}

Fixed version (ground truth):
/** 
 * Returns the batch graph instance that can be used for bulk inserting nodes and vertices into the dbpedia graph. If a persisted dbpedia graph exists already it is returned, otherwise a new graph is created.
 * @param bufferSize the buffer size used for the batch inserts.
 * @return
 */
public static BatchGraph<? extends TransactionalGraph> getBatchGraph(long bufferSize){
  TransactionalGraph graph=openGraph(false);
  BatchGraph<TransactionalGraph> bgraph=new BatchGraph<>(graph,VertexIDType.STRING,bufferSize);
  long verticesCount=Graphs.verticesCount(graph);
  if (verticesCount != 0) {
    bgraph.setVertexIdKey(GraphConfig.URI_PROPERTY);
    bgraph.setLoadingFromScratch(false);
    logger.info("String_Node_Str",verticesCount);
  }
  return bgraph;
}
Program: 26082
Project: 26082
Buggy source:
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  logger.info("String_Node_Str",this);
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sfss=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByFullUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sfss.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    if (usePriorFallback && Collections.max(sfss,SurfaceFormSenseScore.ASCENDING_SCORE_COMPARATOR).getScore() == 0.0)     assignPriors(surfaceForm,sfss);
    Collections.sort(sfss,SurfaceFormSenseScore.DESCENDING_SCORE_COMPARATOR);
    int toIndex=k > sfss.size() ? sfss.size() : k;
    senseScores.put(surfaceForm,sfss.subList(0,toIndex));
  }
  return senseScores;
}

Fixed version (ground truth):
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  logger.info("String_Node_Str",this);
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sfss=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByFullUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sfss.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    if (usePriorFallback && !sfss.isEmpty() && Collections.max(sfss,SurfaceFormSenseScore.ASCENDING_SCORE_COMPARATOR).getScore() == 0.0)     assignPriors(surfaceForm,sfss);
    Collections.sort(sfss,SurfaceFormSenseScore.DESCENDING_SCORE_COMPARATOR);
    int toIndex=k > sfss.size() ? sfss.size() : k;
    senseScores.put(surfaceForm,sfss.subList(0,toIndex));
  }
  return senseScores;
}
Program: 26083
Project: 26083
Buggy source:
public static void persistGraph(Graph graph,boolean normalize,String fileName){
  checkState(checkNotNull(fileName).length() > 0);
  long nanoStartTime=System.nanoTime();
  GraphMLWriter writer=new GraphMLWriter(graph);
  writer.setNormalize(normalize);
  try {
    Files.createParentDirs(new File(fileName));
    writer.outputGraph(fileName);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  logger.info("String_Node_Str",Counter.elapsedSecs(nanoStartTime));
}

Fixed version (ground truth):
public static void persistGraph(Graph graph,boolean normalize,String fileName){
  checkState(checkNotNull(fileName).length() > 0);
  long nanoStartTime=System.nanoTime();
  GraphMLWriter writer=new GraphMLWriter(graph);
  writer.setNormalize(normalize);
  try {
    Files.createParentDirs(new File(fileName));
    writer.outputGraph(fileName);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  logger.info(String.format("String_Node_Str",Counter.elapsedSecs(nanoStartTime)));
}
Program: 26084
Project: 26084
Buggy source:
public static void persistGraphInDirectory(Graph graph,boolean normalize,String dirName){
  String fileName=dirName + File.separator + "String_Node_Str"+ DATE_FORMATTER.format(new Date() + "String_Node_Str");
  persistGraph(graph,normalize,fileName);
}

Fixed version (ground truth):
public static void persistGraphInDirectory(Graph graph,boolean normalize,String dirName){
  String fileName=dirName + File.separator + "String_Node_Str"+ DATE_FORMATTER.format(new Date())+ "String_Node_Str";
  persistGraph(graph,normalize,fileName);
}
Program: 26085
Project: 26085
Buggy source:
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  logger.info("String_Node_Str",this);
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sfss=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByFullUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sfss.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    Collections.sort(sfss,SurfaceFormSenseScore.DESCENDING_SCORE_COMPARATOR);
    int toIndex=k > sfss.size() ? sfss.size() : k;
    senseScores.put(surfaceForm,sfss.subList(0,toIndex));
  }
  if (usePriorFallback)   handleSingletons(senseScores);
  return senseScores;
}

Fixed version (ground truth):
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  logger.info("String_Node_Str",this);
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sfss=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByFullUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sfss.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    if (usePriorFallback && Collections.max(sfss,SurfaceFormSenseScore.ASCENDING_SCORE_COMPARATOR).getScore() == 0.0)     assignPriors(surfaceForm,sfss);
    Collections.sort(sfss,SurfaceFormSenseScore.DESCENDING_SCORE_COMPARATOR);
    int toIndex=k > sfss.size() ? sfss.size() : k;
    senseScores.put(surfaceForm,sfss.subList(0,toIndex));
  }
  return senseScores;
}
Program: 26086
Project: 26086
Buggy source:
@Override public String toString(){
  return getClass().getSimpleName() + "String_Node_Str" + graphType.getDirection()+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return getClass().getSimpleName() + "String_Node_Str" + graphType.getTraversalDirection()+ "String_Node_Str";
}
Program: 26087
Project: 26087
Buggy source:
@Override public Double getVertexScore(Vertex v){
  double degree=Graphs.vertexDegreeWeighted(v,graphType.getDirection(),edgeWeights);
  double centrality=degree / (verticesCount - 1);
  return centrality;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  double degree=Graphs.vertexDegreeWeighted(v,Direction.BOTH,edgeWeights);
  double centrality=degree / (verticesCount - 1);
  return centrality;
}
Program: 26088
Project: 26088
Buggy source:
@Override public Double getVertexScore(Vertex v){
  Scores scores=hits.getVertexScore(v);
  double authority=Iterables.size(v.getEdges(graphType.getDirection())) != 0 ? scores.authority : 0;
  return authority;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  Scores scores=hits.getVertexScore(v);
  double authority=Graphs.vertexHasNoNeighbours(v) ? 0 : scores.authority;
  return authority;
}
Program: 26089
Project: 26089
Buggy source:
public static boolean hasNoEdges(Graph graph){
  return !graph.getEdges().iterator().hasNext();
}

Fixed version (ground truth):
public static boolean hasNoEdges(Graph graph){
  return Iterables.isEmpty(graph.getEdges());
}
Program: 26090
Project: 26090
Buggy source:
public static boolean hasNoVertices(Graph graph){
  return !graph.getVertices().iterator().hasNext();
}

Fixed version (ground truth):
public static boolean hasNoVertices(Graph graph){
  return Iterables.isEmpty(graph.getVertices());
}
Program: 26091
Project: 26091
Buggy source:
@Override protected void dfs(Path path,Set<Vertex> targets,Graph subgraph,Set<Vertex> stopVertices){
  Deque<Path> stack=new ArrayDeque<>();
  stack.push(path);
  while (!stack.isEmpty()) {
    traversedNodes++;
    path=stack.pop();
    Vertex current=path.getLast();
    if (path.getEdges().size() > settings.maxDistance)     continue;
    if (targets.contains(current))     SubgraphConstructions.addPathToSubGraph(current,path,subgraph,settings.graphType);
    for (    Edge edge : current.getEdges(settings.graphType.getDirection())) {
      Vertex child=Graphs.oppositeVertexUnsafe(edge,current);
      if (settings.graphType.equals(GraphType.UNDIRECTED_GRAPH) && !settings.explorationThreshold.isBelowThreshold(child,edge))       continue;
      if (!path.getVertices().contains(child) && !stopVertices.contains(child)) {
        Path newPath=Path.newHop(path,edge,child);
        stack.push(newPath);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void dfs(Path path,Set<Vertex> targets,Graph subgraph,Set<Vertex> stopVertices){
  Deque<Path> stack=new ArrayDeque<>();
  stack.push(path);
  while (!stack.isEmpty()) {
    traversedNodes++;
    path=stack.pop();
    Vertex current=path.getLast();
    if (path.getEdges().size() > settings.maxDistance)     continue;
    if (targets.contains(current))     SubgraphConstructions.addPathToSubGraph(current,path,subgraph,settings.graphType);
    for (    Edge edge : current.getEdges(settings.graphType.getTraversalDirection())) {
      Vertex child=Graphs.oppositeVertexUnsafe(edge,current);
      if (settings.graphType.equals(GraphType.UNDIRECTED_GRAPH) && !settings.explorationThreshold.isBelowThreshold(child,edge))       continue;
      if (!path.getVertices().contains(child) && !stopVertices.contains(child)) {
        Path newPath=Path.newHop(path,edge,child);
        stack.push(newPath);
      }
    }
  }
}
Program: 26092
Project: 26092
Buggy source:
public static void main(String[] args) throws IOException, URISyntaxException {
  Graph graph=GraphFactory.getDBpediaGraph();
  for (  String fullUri : fullUris) {
    Vertex v=Graphs.vertexByUri(graph,URLDecoder.decode(fullUri,"String_Node_Str"));
    String id=(v == null) ? "String_Node_Str" : v.getId().toString();
    System.out.println(fullUri + "String_Node_Str" + id);
  }
  graph.shutdown();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, URISyntaxException {
  Graph graph=GraphFactory.getDBpediaGraph();
  for (  String fullUri : fullUris) {
    Vertex v=Graphs.vertexByFullUri(graph,URLDecoder.decode(fullUri,"String_Node_Str"));
    String id=(v == null) ? "String_Node_Str" : v.getId().toString();
    System.out.println(fullUri + "String_Node_Str" + id);
  }
  graph.shutdown();
}
Program: 26093
Project: 26093
Buggy source:
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sFSS=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sFSS.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    Collections.sort(sFSS,descendingScoreComparator);
    int toIndex=k > sFSS.size() ? sFSS.size() : k;
    senseScores.put(surfaceForm,sFSS.subList(0,toIndex));
  }
  return senseScores;
}

Fixed version (ground truth):
@Override public Map<T,List<SurfaceFormSenseScore<T,U>>> bestK(Map<T,List<U>> surfaceFormsSenses,Graph subgraph,int k){
  VertexScorer<Vertex,Double> vertexScorer=getVertexScorer(subgraph);
  Map<T,List<SurfaceFormSenseScore<T,U>>> senseScores=new HashMap<>();
  for (  T surfaceForm : surfaceFormsSenses.keySet()) {
    List<U> sFSenses=surfaceFormsSenses.get(surfaceForm);
    List<SurfaceFormSenseScore<T,U>> sFSS=new ArrayList<>();
    for (    U sense : sFSenses) {
      Vertex v=Graphs.vertexByFullUri(subgraph,sense.fullUri());
      double score=(v == null) ? -1 : vertexScorer.getVertexScore(v);
      sFSS.add(new SurfaceFormSenseScore<T,U>(surfaceForm,sense,score));
    }
    Collections.sort(sFSS,descendingScoreComparator);
    int toIndex=k > sFSS.size() ? sFSS.size() : k;
    senseScores.put(surfaceForm,sFSS.subList(0,toIndex));
  }
  return senseScores;
}
Program: 26094
Project: 26094
Buggy source:
@Override public Double getVertexScore(Vertex v){
  Scores scores=hits.getVertexScore(v);
  double authority=Iterables.size(Graphs.connectedEdges(v,graphType)) != 0 ? scores.authority : 0;
  return authority;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  Scores scores=hits.getVertexScore(v);
  double authority=Iterables.size(v.getEdges(graphType.getDirection())) != 0 ? scores.authority : 0;
  return authority;
}
Program: 26095
Project: 26095
Buggy source:
@Override public Double getVertexScore(Vertex v){
  HitsScores scores=hitsScores.get(v);
  double authority=Iterables.size(Graphs.connectedEdges(v,graphType)) != 0 ? scores.authority : 0;
  return authority;
}

Fixed version (ground truth):
@Override public Double getVertexScore(Vertex v){
  HitsScores scores=hitsScores.get(v);
  double authority=Iterables.size(v.getEdges(graphType.getDirection())) != 0 ? scores.authority : 0;
  return authority;
}