nus-yam/ex-repair huggingface dataset:
Program: 153922
Project: 153922
Buggy source:
public void run(){
  try {
    while (!quit) {
      selector.select(connectionReadTimeout);
      for (      SelectionKey key : selector.selectedKeys()) {
        if (key.isValid() && key.isWritable() && upstreamQueue.peek() != null) {
          SocketChannel channel=(SocketChannel)key.channel();
          channel.write(upstreamQueue.poll());
        }
 else         if (key.isValid() && key.isReadable()) {
          read(socket,downstreamBuffer);
switch (state) {
case HANDSHAKE:
            pipeline.sendHandshakeDownstream(WebSocketBase.this,downstreamBuffer);
          if (getHandshake().isDone()) {
            if (downstreamBuffer.hasRemaining()) {
              processBuffer(downstreamBuffer);
            }
          }
        break;
case WAIT:
      processBuffer(downstreamBuffer);
    break;
case CLOSED:
  break;
}
}
}
}
}
 catch (WebSocketException we) {
handler.onError(WebSocketBase.this,we);
}
catch (Exception e) {
handler.onError(WebSocketBase.this,new WebSocketException(3000,e));
}
 finally {
try {
socket.close();
}
 catch (IOException e) {
;
}
try {
selector.close();
}
 catch (IOException e) {
;
}
}
}

Fixed version (ground truth):
public void run(){
  try {
    while (!quit) {
      selector.select(connectionReadTimeout);
      for (      SelectionKey key : selector.selectedKeys()) {
        if (key.isValid() && key.isWritable() && upstreamQueue.peek() != null) {
          SocketChannel channel=(SocketChannel)key.channel();
          channel.write(upstreamQueue.poll());
        }
 else         if (key.isValid() && key.isReadable()) {
          read(socket,downstreamBuffer);
switch (state) {
case HANDSHAKE:
            pipeline.sendHandshakeDownstream(WebSocketBase.this,downstreamBuffer);
          if (getHandshake().isDone()) {
            if (downstreamBuffer.hasRemaining()) {
              processBuffer(downstreamBuffer);
            }
          }
        break;
case WAIT:
      processBuffer(downstreamBuffer);
    break;
case CLOSED:
  break;
}
}
}
}
}
 catch (WebSocketException we) {
handler.onError(WebSocketBase.this,we);
}
catch (Exception e) {
handler.onError(WebSocketBase.this,new WebSocketException(3043,e));
}
 finally {
try {
socket.close();
}
 catch (IOException e) {
;
}
try {
selector.close();
}
 catch (IOException e) {
;
}
}
}
Program: 153923
Project: 153923
Buggy source:
public void nextHandshakeUpstreamHandler(WebSocket ws,ByteBuffer buffer,StreamHandlerChain chain) throws WebSocketException {
  try {
    upstreamQueue.put(buffer);
  }
 catch (  InterruptedException e) {
    throw new WebSocketException(3012,e);
  }
}

Fixed version (ground truth):
public void nextHandshakeUpstreamHandler(WebSocket ws,ByteBuffer buffer,StreamHandlerChain chain) throws WebSocketException {
  if (!upstreamQueue.offer(buffer)) {
    throw new WebSocketException(3031,"String_Node_Str");
  }
}
Program: 153925
Project: 153925
Buggy source:
public void nextUpstreamHandler(WebSocket ws,ByteBuffer buffer,Frame frame,StreamHandlerChain chain) throws WebSocketException {
  try {
    upstreamQueue.put(buffer);
    selector.wakeup();
  }
 catch (  InterruptedException e) {
    throw new WebSocketException(3011,e);
  }
}

Fixed version (ground truth):
public void nextUpstreamHandler(WebSocket ws,ByteBuffer buffer,Frame frame,StreamHandlerChain chain) throws WebSocketException {
  if (!upstreamQueue.offer(buffer)) {
    throw new WebSocketException(3030,"String_Node_Str");
  }
  selector.wakeup();
}
Program: 153926
Project: 153926
Buggy source:
protected void read(SocketChannel socket,ByteBuffer buffer) throws WebSocketException {
  try {
    buffer.clear();
    if (socket.read(buffer) < 0) {
      throw new WebSocketException(3001,"String_Node_Str");
    }
    buffer.flip();
  }
 catch (  IOException ioe) {
    throw new WebSocketException(3002,"String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
protected void read(SocketChannel socket,ByteBuffer buffer) throws WebSocketException {
  try {
    buffer.clear();
    if (socket.read(buffer) < 0) {
      throw new WebSocketException(3020,"String_Node_Str");
    }
    buffer.flip();
  }
 catch (  IOException ioe) {
    throw new WebSocketException(3021,"String_Node_Str",ioe);
  }
}
Program: 153928
Project: 153928
Buggy source:
private void parseUrl(String urlStr) throws URISyntaxException {
  URI uri=new URI(urlStr);
  if (!(uri.getScheme().equals("String_Node_Str") || uri.getScheme().equals("String_Node_Str"))) {
    throw new IllegalArgumentException("String_Node_Str" + uri.toString());
  }
  path=uri.getPath();
  int port=uri.getPort();
  if (port < 0) {
    if (uri.getScheme().equals("String_Node_Str")) {
      port=80;
    }
 else     if (uri.getScheme().equals("String_Node_Str")) {
      port=443;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + uri.toString());
    }
  }
  endpoint=new InetSocketAddress(uri.getHost(),port);
  location=uri;
}

Fixed version (ground truth):
private void parseUrl(String urlStr) throws WebSocketException {
  try {
    URI uri=new URI(urlStr);
    if (!(uri.getScheme().equals("String_Node_Str") || uri.getScheme().equals("String_Node_Str"))) {
      throw new WebSocketException(3007,"String_Node_Str" + uri.toString());
    }
    path=uri.getPath();
    int port=uri.getPort();
    if (port < 0) {
      if (uri.getScheme().equals("String_Node_Str")) {
        port=80;
      }
 else       if (uri.getScheme().equals("String_Node_Str")) {
        port=443;
      }
 else {
        throw new WebSocketException(3008,"String_Node_Str" + uri.toString());
      }
    }
    endpoint=new InetSocketAddress(uri.getHost(),port);
    location=uri;
  }
 catch (  URISyntaxException e) {
    throw new WebSocketException(3009,e);
  }
}
Program: 153929
Project: 153929
Buggy source:
/** 
 * check handshake response server => client HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat
 * @param buffer
 */
@Override protected boolean parseHandshakeResponseHeader(ByteBuffer buffer) throws WebSocketException {
  if (!super.parseHandshakeResponseHeader(buffer)) {
    return false;
  }
  if (!"String_Node_Str".equalsIgnoreCase(responseHeaderMap.get("String_Node_Str"))) {
    throw new WebSocketException(3101,"String_Node_Str" + responseHeaderMap.get("String_Node_Str"));
  }
  if (!"String_Node_Str".equalsIgnoreCase(responseHeaderMap.get("String_Node_Str"))) {
    throw new WebSocketException(3101,"String_Node_Str" + responseHeaderMap.get("String_Node_Str"));
  }
  if (!responseHeaderMap.containsKey("String_Node_Str")) {
    throw new WebSocketException(3101,"String_Node_Str");
  }
  String protocolStr=responseHeaderMap.get("String_Node_Str");
  if (protocolStr != null) {
    serverProtocols=protocolStr.split("String_Node_Str");
  }
  String extensionsStr=responseHeaderMap.get("String_Node_Str");
  if (extensionsStr != null) {
    serverExtentions=extensionsStr.split("String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
/** 
 * check handshake response <pre> server => client HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat </pre>
 * @param buffer
 */
@Override protected boolean parseHandshakeResponseHeader(ByteBuffer buffer) throws WebSocketException {
  if (!super.parseHandshakeResponseHeader(buffer)) {
    return false;
  }
  if (!"String_Node_Str".equalsIgnoreCase(responseHeaderMap.get("String_Node_Str"))) {
    throw new WebSocketException(3600,"String_Node_Str" + responseHeaderMap.get("String_Node_Str"));
  }
  if (!"String_Node_Str".equalsIgnoreCase(responseHeaderMap.get("String_Node_Str"))) {
    throw new WebSocketException(3601,"String_Node_Str" + responseHeaderMap.get("String_Node_Str"));
  }
  if (!responseHeaderMap.containsKey("String_Node_Str")) {
    throw new WebSocketException(3602,"String_Node_Str");
  }
  String protocolStr=responseHeaderMap.get("String_Node_Str");
  if (protocolStr != null) {
    serverProtocols=protocolStr.split("String_Node_Str");
  }
  String extensionsStr=responseHeaderMap.get("String_Node_Str");
  if (extensionsStr != null) {
    serverExtentions=extensionsStr.split("String_Node_Str");
  }
  return true;
}
Program: 153931
Project: 153931
Buggy source:
/** 
 * Create a handshake requtest Sample (Draft06) client => server GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version:6
 * @param socket
 */
@Override public ByteBuffer createHandshakeRequest() throws WebSocketException {
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + path + "String_Node_Str");
  addHeader(sb,"String_Node_Str",endpoint.getHostName());
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str",generateWebSocketKey());
  if (origin != null) {
    addHeader(sb,"String_Node_Str",origin);
  }
  if (protocols != null && protocols.length > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",protocols));
  }
  if (extensions.size() > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",extensions));
  }
  addHeader(sb,"String_Node_Str",String.valueOf(getWebSocketVersion()));
  sb.append("String_Node_Str");
  return ByteBuffer.wrap(sb.toString().getBytes());
}

Fixed version (ground truth):
/** 
 * Create a handshake requtest <pre> Sample (Draft06) client => server GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version:6 </pre>
 * @param socket
 */
@Override public ByteBuffer createHandshakeRequest() throws WebSocketException {
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + path + "String_Node_Str");
  addHeader(sb,"String_Node_Str",endpoint.getHostName());
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str",generateWebSocketKey());
  if (origin != null) {
    addHeader(sb,"String_Node_Str",origin);
  }
  if (protocols != null && protocols.length > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",protocols));
  }
  if (extensions.size() > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",extensions));
  }
  addHeader(sb,"String_Node_Str",String.valueOf(getWebSocketVersion()));
  sb.append("String_Node_Str");
  return ByteBuffer.wrap(sb.toString().getBytes());
}
Program: 153932
Project: 153932
Buggy source:
public WebSocketDraft06(String url,WebSocketHandler handler,String... protocols) throws URISyntaxException, IOException {
  super(url,handler,protocols);
  this.origin=System.getProperty("String_Node_Str");
}

Fixed version (ground truth):
public WebSocketDraft06(String url,WebSocketHandler handler,String... protocols) throws WebSocketException {
  super(url,handler,protocols);
}
Program: 153934
Project: 153934
Buggy source:
public WebSocketDraft76(String url,WebSocketHandler handler,String... protocols) throws URISyntaxException, IOException {
  super(url,handler,protocols);
  this.origin=System.getProperty("String_Node_Str");
}

Fixed version (ground truth):
public WebSocketDraft76(String url,WebSocketHandler handler,String... protocols) throws WebSocketException {
  super(url,handler,protocols);
}
Program: 153936
Project: 153936
Buggy source:
/** 
 * Create a handshake requtest Sample (Draft76) client => server GET /demo HTTP/1.1 Host: example.com Connection: Upgrade Sec-WebSocket-Key2: 12998 5 Y3 1  .P00 Sec-WebSocket-Protocol: sample Upgrade: WebSocket Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5 Origin: http://example.com ^n:ds[4U
 * @param socket
 */
@Override public ByteBuffer createHandshakeRequest(){
  bodyBuf.clear();
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + path + "String_Node_Str");
  addHeader(sb,"String_Node_Str",endpoint.getHostName());
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str",SecWebSocketKey.generateKey());
  addHeader(sb,"String_Node_Str",SecWebSocketKey.generateKey());
  if (origin != null) {
    addHeader(sb,"String_Node_Str",origin);
  }
  if (protocols != null && protocols.length > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",protocols));
  }
  sb.append("String_Node_Str");
  ByteBuffer buf=ByteBuffer.allocate(512);
  buf.put(sb.toString().getBytes());
  buf.put(SecWebSocketKey.generateKey3());
  buf.put((byte)0xd);
  buf.put((byte)0xa);
  buf.flip();
  return buf;
}

Fixed version (ground truth):
/** 
 * Create a handshake requtest <pre> Sample (Draft76) client => server GET /demo HTTP/1.1 Host: example.com Connection: Upgrade Sec-WebSocket-Key2: 12998 5 Y3 1  .P00 Sec-WebSocket-Protocol: sample Upgrade: WebSocket Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5 Origin: http://example.com ^n:ds[4U </pre>
 * @param socket
 */
@Override public ByteBuffer createHandshakeRequest(){
  bodyBuf.clear();
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + path + "String_Node_Str");
  addHeader(sb,"String_Node_Str",endpoint.getHostName());
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str","String_Node_Str");
  addHeader(sb,"String_Node_Str",SecWebSocketKey.generateKey());
  addHeader(sb,"String_Node_Str",SecWebSocketKey.generateKey());
  if (origin != null) {
    addHeader(sb,"String_Node_Str",origin);
  }
  if (protocols != null && protocols.length > 0) {
    addHeader(sb,"String_Node_Str",join("String_Node_Str",protocols));
  }
  sb.append("String_Node_Str");
  ByteBuffer buf=ByteBuffer.allocate(512);
  buf.put(sb.toString().getBytes());
  buf.put(SecWebSocketKey.generateKey3());
  buf.put((byte)0xd);
  buf.put((byte)0xa);
  buf.flip();
  return buf;
}
Program: 153937
Project: 153937
Buggy source:
protected boolean parseHandshakeResponseHeader(ByteBuffer buffer) throws WebSocketException {
  if (State.METHOD.equals(state)) {
    String line=readLine(buffer);
    if (line == null) {
      return false;
    }
    if (!line.startsWith("String_Node_Str")) {
      throw new WebSocketException(3001,"String_Node_Str" + line);
    }
    responseStatus=Integer.valueOf(line.substring(9,12));
    if (responseStatus != 101) {
      throw new WebSocketException(3001,"String_Node_Str" + line);
    }
    transitionTo(State.HEADER);
  }
  if (State.HEADER.equals(state)) {
    do {
      String line=readLine(buffer);
      if (line == null) {
        return false;
      }
      if (line.indexOf(':') > 0) {
        String[] keyValue=line.split("String_Node_Str",2);
        if (keyValue.length > 1) {
          responseHeaderMap.put(keyValue[0].trim().toLowerCase(),keyValue[1].trim().toLowerCase());
        }
      }
      if ("String_Node_Str".compareTo(line) == 0) {
        return true;
      }
      if (!buffer.hasRemaining()) {
        return false;
      }
    }
 while (true);
  }
  return true;
}

Fixed version (ground truth):
protected boolean parseHandshakeResponseHeader(ByteBuffer buffer) throws WebSocketException {
  if (State.METHOD.equals(state)) {
    String line=readLine(buffer);
    if (line == null) {
      return false;
    }
    if (!line.startsWith("String_Node_Str")) {
      throw new WebSocketException(3101,"String_Node_Str" + line);
    }
    responseStatus=Integer.valueOf(line.substring(9,12));
    if (responseStatus != 101) {
      throw new WebSocketException(3102,"String_Node_Str" + line);
    }
    transitionTo(State.HEADER);
  }
  if (State.HEADER.equals(state)) {
    do {
      String line=readLine(buffer);
      if (line == null) {
        return false;
      }
      if (line.indexOf(':') > 0) {
        String[] keyValue=line.split("String_Node_Str",2);
        if (keyValue.length > 1) {
          responseHeaderMap.put(keyValue[0].trim().toLowerCase(),keyValue[1].trim().toLowerCase());
        }
      }
      if ("String_Node_Str".compareTo(line) == 0) {
        return true;
      }
      if (!buffer.hasRemaining()) {
        return false;
      }
    }
 while (true);
  }
  return true;
}
Program: 153938
Project: 153938
Buggy source:
public void handshake(SocketChannel socket) throws WebSocketException {
  try {
    ByteBuffer request=createHandshakeRequest();
    socket.write(request);
  }
 catch (  IOException ioe) {
    throw new WebSocketException(3000,ioe);
  }
}

Fixed version (ground truth):
public void handshake(SocketChannel socket) throws WebSocketException {
  try {
    ByteBuffer request=createHandshakeRequest();
    socket.write(request);
  }
 catch (  IOException ioe) {
    throw new WebSocketException(3100,ioe);
  }
}
Program: 153939
Project: 153939
Buggy source:
@Override public void onError(WebSocket socket,WebSocketException e){
  log.error("String_Node_Str",e);
}

Fixed version (ground truth):
@Override public void onError(WebSocket socket,WebSocketException e){
  fireException(e);
}
Program: 153940
Project: 153940
Buggy source:
public static void main(String[] args) throws Exception {
  WSCSubscriber sub=new WSCSubscriber();
  sub.setLocation("String_Node_Str");
  sub.start();
  sub.addExceptionListener(new ExceptionListener(){
    public void onException(    ExceptionEvent e){
      e.getException().printStackTrace();
    }
  }
);
  sub.addMessageListener(new MessageListener(){
    public void onMessage(    MessageEvent e){
      Message msg=e.getMessage();
      RateBean dto=(RateBean)msg.getBody();
      System.out.println(dto.getBid());
    }
  }
);
  while (true) {
    Thread.sleep(1000);
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  System.setProperty("String_Node_Str",String.valueOf(PacketDumpStreamHandler.HS_UP | PacketDumpStreamHandler.HS_DOWN | PacketDumpStreamHandler.FR_UP));
  WSCSubscriber sub=new WSCSubscriber();
  sub.setLocation("String_Node_Str");
  sub.setConnectionTimeout(600000);
  sub.start();
  sub.addExceptionListener(new ExceptionListener(){
    public void onException(    ExceptionEvent e){
      e.getException().printStackTrace();
    }
  }
);
  sub.addMessageListener(new MessageListener(){
    public void onMessage(    MessageEvent e){
      Message msg=e.getMessage();
      RateBean dto=(RateBean)msg.getBody();
      System.out.println(dto.getBid());
    }
  }
);
  while (true) {
    Thread.sleep(1000);
    sub.websocket.send(sub.websocket.createFrame("String_Node_Str"));
    System.out.println("String_Node_Str");
  }
}
Program: 153941
Project: 153941
Buggy source:
@Override public void onClose(WebSocket websocket){
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onClose(WebSocket websocket){
  fireDisconnected();
}
Program: 153942
Project: 153942
Buggy source:
@Override public void onOpen(WebSocket socket){
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onOpen(WebSocket socket){
  fireConnected();
}
Program: 153943
Project: 153943
Buggy source:
public void run(){
  try {
    while (!quit) {
      selector.select(connectionReadTimeout);
      for (      SelectionKey key : selector.selectedKeys()) {
        if (key.isValid() && key.isWritable()) {
          SocketChannel channel=(SocketChannel)key.channel();
          channel.write(upstreamQueue.take());
        }
 else         if (key.isValid() && key.isReadable()) {
          read(socket,downstreamBuffer);
switch (state) {
case HANDSHAKE:
            pipeline.sendHandshakeDownstream(WebSocketBase.this,downstreamBuffer);
          if (getHandshake().isDone()) {
            if (downstreamBuffer.hasRemaining()) {
              processBuffer(downstreamBuffer);
            }
          }
        break;
case WAIT:
      processBuffer(downstreamBuffer);
    break;
case CLOSED:
  break;
}
}
}
}
}
 catch (WebSocketException we) {
handler.onError(WebSocketBase.this,we);
}
catch (Exception e) {
handler.onError(WebSocketBase.this,new WebSocketException(3000,e));
}
 finally {
try {
socket.close();
}
 catch (IOException e) {
;
}
try {
selector.close();
}
 catch (IOException e) {
;
}
}
}

Fixed version (ground truth):
public void run(){
  try {
    while (!quit) {
      selector.select(connectionReadTimeout);
      for (      SelectionKey key : selector.selectedKeys()) {
        if (key.isValid() && key.isWritable() && upstreamQueue.peek() != null) {
          SocketChannel channel=(SocketChannel)key.channel();
          channel.write(upstreamQueue.poll());
        }
 else         if (key.isValid() && key.isReadable()) {
          read(socket,downstreamBuffer);
switch (state) {
case HANDSHAKE:
            pipeline.sendHandshakeDownstream(WebSocketBase.this,downstreamBuffer);
          if (getHandshake().isDone()) {
            if (downstreamBuffer.hasRemaining()) {
              processBuffer(downstreamBuffer);
            }
          }
        break;
case WAIT:
      processBuffer(downstreamBuffer);
    break;
case CLOSED:
  break;
}
}
}
}
}
 catch (WebSocketException we) {
handler.onError(WebSocketBase.this,we);
}
catch (Exception e) {
handler.onError(WebSocketBase.this,new WebSocketException(3000,e));
}
 finally {
try {
socket.close();
}
 catch (IOException e) {
;
}
try {
selector.close();
}
 catch (IOException e) {
;
}
}
}
Program: 153945
Project: 153945
Buggy source:
public void nextUpstreamHandler(WebSocket ws,ByteBuffer buffer,Frame frame,StreamHandlerChain chain) throws WebSocketException {
  try {
    upstreamQueue.put(buffer);
    socket.register(selector,OP_READ | OP_WRITE);
  }
 catch (  InterruptedException e) {
    throw new WebSocketException(3011,e);
  }
catch (  ClosedChannelException e) {
    throw new WebSocketException(3010,e);
  }
}

Fixed version (ground truth):
public void nextUpstreamHandler(WebSocket ws,ByteBuffer buffer,Frame frame,StreamHandlerChain chain) throws WebSocketException {
  try {
    upstreamQueue.put(buffer);
    selector.wakeup();
  }
 catch (  InterruptedException e) {
    throw new WebSocketException(3011,e);
  }
}
Program: 153947
Project: 153947
Buggy source:
public ByteBuffer toByteBuffer(){
  ByteBuffer buf=ByteBuffer.allocate(1 + body.length + 1);
  buf.put(header.toByteBuffer());
  buf.put(body);
  buf.put((byte)0xFF);
  return buf;
}

Fixed version (ground truth):
public ByteBuffer toByteBuffer(){
  ByteBuffer buf=ByteBuffer.allocate(1 + body.length + 1);
  buf.put(header.toByteBuffer());
  buf.put(body);
  buf.put((byte)0xFF);
  buf.flip();
  return buf;
}
Program: 153948
Project: 153948
Buggy source:
public Config(WhoAreYou instance){
  this.plugin=instance;
  this.config=plugin.getConfiguration();
  config.load();
  if (config.getKeys("String_Node_Str") == null) {
    World[] worlds=(World[])plugin.getServer().getWorlds().toArray(new World[0]);
    for (    World world : worlds)     config.setProperty("String_Node_Str" + world.getName(),world.getName());
  }
  String[] worlds=(String[])config.getKeys("String_Node_Str").toArray(new String[0]);
  for (  String world : worlds)   aliases.put(world,config.getString("String_Node_Str" + world));
  if (!config.save())   Util.sendMessage("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public Config(WhoAreYou instance){
  this.plugin=instance;
  this.config=plugin.getConfiguration();
  config.load();
  if (config.getKeys("String_Node_Str") == null) {
    World[] worlds=(World[])plugin.getServer().getWorlds().toArray(new World[0]);
    for (    World world : worlds)     config.setProperty("String_Node_Str" + world.getName(),world.getName());
  }
  String[] worlds=(String[])config.getKeys("String_Node_Str").toArray(new String[0]);
  for (  String world : worlds)   aliases.put(world,config.getString("String_Node_Str" + world));
  if (!config.save())   Util.log.severe("String_Node_Str");
}
Program: 153949
Project: 153949
Buggy source:
public String getPrefix(Player player){
switch (handler) {
case PERMISSIONS:
    PermissionHandler handler=((Permissions)permissionPlugin).getHandler();
  String group=handler.getGroup(player.getWorld().getName(),player.getName());
return handler.getGroupPrefix(player.getWorld().getName(),group);
case OP:
if (player.isOp()) return "String_Node_Str";
return "String_Node_Str";
}
return null;
}

Fixed version (ground truth):
public String getPrefix(Player player){
  String prefix="String_Node_Str";
switch (handler) {
case PERMISSIONS:
    prefix=permissionPlugin.getGroupPrefix(player.getWorld().getName(),getGroup(player));
  break;
case OP:
if (player.isOp()) prefix="String_Node_Str";
break;
}
return (prefix == "String_Node_Str" ? "String_Node_Str" : prefix);
}
Program: 153950
Project: 153950
Buggy source:
private boolean hasPermission(Player player,String node){
switch (handler) {
case PERMISSIONS:
    return ((Permissions)permissionPlugin).getHandler().has(player,node);
case OP:
  return player.isOp();
}
return false;
}

Fixed version (ground truth):
private boolean hasPermission(Player player,String node){
switch (handler) {
case PERMISSIONS:
    return permissionPlugin.has(player,node);
case OP:
  return player.isOp();
}
return false;
}
Program: 153951
Project: 153951
Buggy source:
public Permission(WhoAreYou instance){
  plugin=instance;
  Plugin permissions=plugin.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (permissions != null) {
    permissionPlugin=permissions;
    handler=PermissionPlugin.PERMISSIONS;
    Util.sendMessage("String_Node_Str","String_Node_Str");
  }
 else {
    Util.sendMessage("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
public Permission(WhoAreYou instance){
  plugin=instance;
  Plugin permissions=plugin.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (permissions != null) {
    permissionPlugin=((Permissions)permissions).getHandler();
    handler=PermissionPlugin.PERMISSIONS;
    Util.log.info("String_Node_Str");
  }
 else {
    Util.log.info("String_Node_Str");
  }
}
Program: 153952
Project: 153952
Buggy source:
private static String replaceColors(String str){
  str=str.replace("String_Node_Str",ChatColor.RED.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_RED.toString());
  str=str.replace("String_Node_Str",ChatColor.YELLOW.toString());
  str=str.replace("String_Node_Str",ChatColor.GOLD.toString());
  str=str.replace("String_Node_Str",ChatColor.GREEN.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_GREEN.toString());
  str=str.replace("String_Node_Str",ChatColor.AQUA.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_AQUA.toString());
  str=str.replace("String_Node_Str",ChatColor.BLUE.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_BLUE.toString());
  str=str.replace("String_Node_Str",ChatColor.LIGHT_PURPLE.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_PURPLE.toString());
  str=str.replace("String_Node_Str",ChatColor.BLACK.toString());
  str=str.replace("String_Node_Str",ChatColor.DARK_GRAY.toString());
  str=str.replace("String_Node_Str",ChatColor.GRAY.toString());
  str=str.replace("String_Node_Str",ChatColor.WHITE.toString());
  return str;
}

Fixed version (ground truth):
public static String replaceColors(String str){
  for (  CustomColor color : CustomColor.values())   str=str.replace(color.getCustom(),color.getString());
  return str;
}
Program: 153953
Project: 153953
Buggy source:
private static String getLastColor(String str){
  int i=0;
  String lastColor=ChatColor.WHITE.toString();
  while (i < str.length() - 3) {
    for (    ChatColor color : ChatColor.values()) {
      if (str.substring(i,i + 3) == color.toString())       lastColor=color.toString();
    }
    i=i + 3;
  }
  return lastColor;
}

Fixed version (ground truth):
public static CustomColor getLastColor(String str){
  int i=0;
  CustomColor lastColor=CustomColor.WHITE;
  while (i < str.length() - 2) {
    for (    CustomColor color : CustomColor.values()) {
      if (str.substring(i,i + 2).equalsIgnoreCase(color.getCustom()))       lastColor=color;
    }
    i=i + 2;
  }
  return lastColor;
}
Program: 153954
Project: 153954
Buggy source:
public static void sendMessage(String level,String msg){
  msg="String_Node_Str" + WhoAreYou.name + "String_Node_Str"+ msg;
  if (level == "String_Node_Str")   log.info(msg);
 else   log.severe(msg);
}

Fixed version (ground truth):
public static void sendMessage(Player player,String msg){
  int i;
  String part;
  CustomColor lastColor=CustomColor.WHITE;
  for (  String line : msg.split("String_Node_Str")) {
    i=0;
    while (i < line.length()) {
      part=getMaxString(line.substring(i));
      if (i + part.length() < line.length() && part.contains("String_Node_Str"))       part=part.substring(0,part.lastIndexOf("String_Node_Str"));
      part=lastColor.getCustom() + part;
      player.sendMessage(replaceColors(part));
      lastColor=getLastColor(part);
      i=i + part.length() - 1;
    }
  }
}
Program: 153956
Project: 153956
Buggy source:
public void onEnable(){
  name=this.getDescription().getName();
  version=this.getDescription().getVersion();
  config=new Config(this);
  permissions=new Permission(this);
  Util.sendMessage("String_Node_Str","String_Node_Str" + version + "String_Node_Str");
}

Fixed version (ground truth):
public void onEnable(){
  name=this.getDescription().getName();
  version=this.getDescription().getVersion();
  config=new Config(this);
  permissions=new Permission(this);
  Util.log.info("String_Node_Str" + version + "String_Node_Str");
}
Program: 153957
Project: 153957
Buggy source:
public void onDisable(){
  Util.sendMessage("String_Node_Str","String_Node_Str" + version + "String_Node_Str");
}

Fixed version (ground truth):
public void onDisable(){
  Util.log.info("String_Node_Str" + version + "String_Node_Str");
}
Program: 153959
Project: 153959
Buggy source:
private void loadConfiguration(){
}

Fixed version (ground truth):
private void loadConfiguration(){
  getDataFolder().mkdirs();
  configLL=new Configuration(new File(this.getDataFolder(),LIGHT_LEVEL_CONFIG));
  configLL.load();
  if ((configLL.getProperty(WAND_ENABLE_KEY) == null) || !(configLL.getProperty(WAND_ENABLE_KEY) instanceof Boolean)) {
    configLL.setProperty(WAND_ENABLE_KEY,true);
    configLL.save();
  }
  if ((configLL.getProperty(WAND_KEY) == null) || !(configLL.getProperty(WAND_KEY) instanceof Integer)) {
    configLL.setProperty(WAND_KEY,TORCH_ITEM);
    configLL.save();
  }
  if ((configLL.getProperty(WAND_ENABLE_DEFAULT_KEY) == null) || !(configLL.getProperty(WAND_ENABLE_DEFAULT_KEY) instanceof Boolean)) {
    configLL.setProperty(WAND_ENABLE_DEFAULT_KEY,true);
    configLL.save();
  }
}
Program: 153960
Project: 153960
Buggy source:
protected void getLightLevel(Player p){
  if (hasPermission((Player)p,"String_Node_Str")) {
    ArrayList<Block> target=(ArrayList<Block>)p.getLastTwoTargetBlocks(null,50);
    if (!target.get(1).getType().equals(Material.matchMaterial("String_Node_Str")) && target.size() >= 2) {
      String numbercolor=getColorFromLightLevel(target.get(0).getLightLevel()).toString();
      p.sendMessage(target.get(1).getType().name().toUpperCase() + "String_Node_Str" + numbercolor+ target.get(0).getLightLevel());
    }
 else {
      p.sendMessage(ChatColor.RED + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
protected void getLightLevel(Player p){
  if (hasPermission((Player)p,"String_Node_Str")) {
    ArrayList<Block> target=(ArrayList<Block>)p.getLastTwoTargetBlocks(null,50);
    if (target.size() >= 2 && !target.get(1).getType().equals(Material.matchMaterial("String_Node_Str"))) {
      String numbercolor=getColorFromLightLevel(target.get(0).getLightLevel()).toString();
      p.sendMessage(target.get(1).getType().name().toUpperCase() + "String_Node_Str" + numbercolor+ target.get(0).getLightLevel());
    }
 else {
      p.sendMessage(ChatColor.RED + "String_Node_Str");
    }
  }
}
Program: 153961
Project: 153961
Buggy source:
protected boolean playerHasWandEnabled(Player p){
  if (this.configLL.getBoolean(WAND_ENABLE_KEY,true))   return wandEnabled.contains(p);
}

Fixed version (ground truth):
protected boolean playerHasWandEnabled(Player p){
  if (this.configLL.getBoolean(WAND_ENABLE_DEFAULT_KEY,true)) {
    return !wandEnabled.contains(p);
  }
  return wandEnabled.contains(p);
}
Program: 153962
Project: 153962
Buggy source:
/** 
 * Toggle whether or not a player wants to use the wand
 * @param p
 */
protected void togglePlayerWand(Player p){
  if (wandEnabled.contains(p)) {
    wandEnabled.remove(p);
  }
 else {
    wandEnabled.add(p);
  }
}

Fixed version (ground truth):
/** 
 * Toggle whether or not a player wants to use the wand
 * @param p
 */
protected void togglePlayerWand(Player p){
  if (wandEnabled.contains(p)) {
    wandEnabled.remove(p);
  }
 else {
    wandEnabled.add(p);
  }
  if (playerHasWandEnabled(p)) {
    p.sendMessage(ChatColor.GREEN + "String_Node_Str");
  }
 else {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
  }
}
Program: 153963
Project: 153963
Buggy source:
/** 
 * All of the users who declined their invitation to this event <p/>  {@sample.xml ../../../doc/mule-module-facebook.xml.sample facebook:getEventDeclined}
 * @param eventId Represents the ID of the event object.
 * @param since A unix timestamp or any date accepted by strtotime
 * @param until A unix timestamp or any date accepted by strtotime
 * @param limit Limit the number of items returned.
 * @param offset An offset to the response. Useful for paging.
 * @return A list of events
 */
@Processor @OAuthProtected public List<Event> getEventDeclined(String eventId,@Optional @Default("String_Node_Str") String since,@Optional @Default("String_Node_Str") String until,@Optional @Default("String_Node_Str") String limit,@Optional @Default("String_Node_Str") String offset){
  URI uri=UriBuilder.fromPath(FACEBOOK_URI).path("String_Node_Str").build(eventId);
  WebResource resource=this.newWebResource(uri,accessToken);
  return mapper.toJavaList(resource.queryParam("String_Node_Str",since).queryParam("String_Node_Str",until).queryParam("String_Node_Str",limit).queryParam("String_Node_Str",offset).get(String.class),Event.class);
}

Fixed version (ground truth):
/** 
 * All of the users who declined their invitation to this event <p/>  {@sample.xml ../../../doc/mule-module-facebook.xml.sample facebook:getEventDeclined}
 * @param eventId Represents the ID of the event object.
 * @param since A unix timestamp or any date accepted by strtotime
 * @param until A unix timestamp or any date accepted by strtotime
 * @param limit Limit the number of items returned.
 * @param offset An offset to the response. Useful for paging.
 * @return A list of events
 */
@Processor @OAuthProtected public List<User> getEventDeclined(String eventId,@Optional @Default("String_Node_Str") String since,@Optional @Default("String_Node_Str") String until,@Optional @Default("String_Node_Str") String limit,@Optional @Default("String_Node_Str") String offset){
  URI uri=UriBuilder.fromPath(FACEBOOK_URI).path("String_Node_Str").build(eventId);
  WebResource resource=this.newWebResource(uri,accessToken);
  return mapper.toJavaList(resource.queryParam("String_Node_Str",since).queryParam("String_Node_Str",until).queryParam("String_Node_Str",limit).queryParam("String_Node_Str",offset).get(String.class),User.class);
}
Program: 153964
Project: 153964
Buggy source:
protected List<String> getExpectedLikes() throws IOException {
  List<String> music=getExpectedMovies();
  List<String> television=getExpectedTelevision();
  List<String> books=getExpectedBooks();
  List<String> movies=getExpectedMovies();
  List<String> finalList=new ArrayList<String>();
  finalList.addAll(music);
  finalList.addAll(television);
  finalList.addAll(books);
  finalList.addAll(movies);
  return finalList;
}

Fixed version (ground truth):
protected List<String> getExpectedLikes() throws IOException {
  List<String> music=getExpectedMusic();
  List<String> television=getExpectedTelevision();
  List<String> books=getExpectedBooks();
  List<String> movies=getExpectedMovies();
  List<String> finalList=new ArrayList<String>();
  finalList.addAll(music);
  finalList.addAll(television);
  finalList.addAll(books);
  finalList.addAll(movies);
  return finalList;
}
Program: 153965
Project: 153965
Buggy source:
public TSource next(){
  if (onCheckedMatch) {
    onCheckedMatch=false;
    return currentItem;
  }
 else   if (sourceIterator.hasNext()) {
    currentItem=sourceIterator.next();
    if (predicate.check(currentItem,index++)) {
      onCheckedMatch=false;
      return currentItem;
    }
  }
  throw new NoSuchElementException();
}

Fixed version (ground truth):
public TSource next(){
  if (onCheckedMatch) {
    onCheckedMatch=false;
    return currentItem;
  }
 else   if (sourceIterator.hasNext()) {
    currentItem=sourceIterator.next();
    if (predicate.check(currentItem,index++)) {
      return currentItem;
    }
  }
  throw new NoSuchElementException();
}
Program: 153966
Project: 153966
Buggy source:
public boolean hasNext(){
  if (onCheckedMatch) {
    return true;
  }
  if (sourceIterator.hasNext()) {
    if (!onCheckedMatch) {
      currentItem=sourceIterator.next();
    }
    if (predicate.check(currentItem,index++)) {
      onCheckedMatch=true;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasNext(){
  if (onCheckedMatch) {
    return true;
  }
 else {
    if (sourceIterator.hasNext()) {
      if (!onCheckedMatch) {
        currentItem=sourceIterator.next();
      }
      if (predicate.check(currentItem,index++)) {
        onCheckedMatch=true;
        return true;
      }
    }
  }
  return false;
}
Program: 153967
Project: 153967
Buggy source:
public TSource next(){
  while (onCheckedMatch || sourceIterator.hasNext()) {
    if (!onCheckedMatch) {
      currentItem=sourceIterator.next();
    }
    if (predicate.check(currentItem,index++)) {
      onCheckedMatch=false;
      return currentItem;
    }
  }
  throw new NoSuchElementException();
}

Fixed version (ground truth):
public TSource next(){
  if (onCheckedMatch) {
    onCheckedMatch=false;
    return currentItem;
  }
 else {
    while (sourceIterator.hasNext()) {
      currentItem=sourceIterator.next();
      if (predicate.check(currentItem,index++)) {
        return currentItem;
      }
    }
  }
  throw new NoSuchElementException();
}
Program: 153968
Project: 153968
Buggy source:
public boolean hasNext(){
  while (sourceIterator.hasNext()) {
    if (!onCheckedMatch) {
      currentItem=sourceIterator.next();
    }
    if (predicate.check(currentItem,index++)) {
      onCheckedMatch=true;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasNext(){
  if (onCheckedMatch) {
    return true;
  }
 else {
    while (sourceIterator.hasNext()) {
      currentItem=sourceIterator.next();
      if (predicate.check(currentItem,index++)) {
        onCheckedMatch=true;
        return true;
      }
    }
  }
  return false;
}
Program: 153969
Project: 153969
Buggy source:
@Action(value="String_Node_Str",results={@Result(name=SUCCESS,type="String_Node_Str",location="String_Node_Str"),@Result(name=INPUT,type="String_Node_Str",location="String_Node_Str"),@Result(name=ERROR,location="String_Node_Str")}) @Validations(requiredStrings={@RequiredStringValidator(fieldName="String_Node_Str",message="String_Node_Str",trim=true),@RequiredStringValidator(fieldName="String_Node_Str",message="String_Node_Str",trim=true)}) public String execute(){
  ProductDAO dao=new ProductDAO();
  if (!dao.update(getProduct()))   return ERROR;
  return SUCCESS;
}

Fixed version (ground truth):
@Action(value="String_Node_Str",results={@Result(name=SUCCESS,type="String_Node_Str",location="String_Node_Str"),@Result(name=INPUT,location="String_Node_Str"),@Result(name=ERROR,location="String_Node_Str")}) @Validations(requiredStrings={@RequiredStringValidator(fieldName="String_Node_Str",message="String_Node_Str",trim=true),@RequiredStringValidator(fieldName="String_Node_Str",message="String_Node_Str",trim=true)}) public String execute(){
  ProductDAO dao=new ProductDAO();
  if (!dao.update(getProduct()))   return ERROR;
  return SUCCESS;
}
Program: 153970
Project: 153970
Buggy source:
public static void main(String[] args) throws IOException {
  if (args.length != 1) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(countWords(gatherWords(FileUtils.readFileToString(new File(args[0])))));
  System.out.println(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0]))))));
  System.out.println(histogram(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0])))))));
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  if (args.length != 1) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(gatherWords(FileUtils.readFileToString(new File(args[0]))));
  System.out.println(countWords(gatherWords(FileUtils.readFileToString(new File(args[0])))));
  System.out.println(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0]))))));
  System.out.println(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0]))))));
  System.out.println(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0]))))));
  System.out.println(histogram(sortCountedWords(countWords(gatherWords(FileUtils.readFileToString(new File(args[0])))))));
}
Program: 153971
Project: 153971
Buggy source:
@Test public void foldWithTimesShouldMultiplyInitialValueWithAllNumbers(){
  Function2<Integer,Integer,Integer> times=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum * next;
    }
  }
;
  assertThat(fold(Arrays.asList(1,2,3,4),2,times),is(48));
}

Fixed version (ground truth):
@Test public void foldWithTimesShouldMultiplyInitialValueWithAllNumbers(){
  Function2<Integer,Integer,Integer> times=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum * next;
    }
  }
;
  assertThat(Collections3.fold(Arrays.asList(1,2,3,4),2,times),is(48));
}
Program: 153972
Project: 153972
Buggy source:
@Test public void reduceWithPlusShouldAddAllNumbers(){
  Function2<Integer,Integer,Integer> plus=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum + next;
    }
  }
;
  assertThat(reduce(Arrays.asList(1,2,3,4),plus),is(10));
}

Fixed version (ground truth):
@Test public void reduceWithPlusShouldAddAllNumbers(){
  Function2<Integer,Integer,Integer> plus=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum + next;
    }
  }
;
  assertThat(Collections3.reduce(Arrays.asList(1,2,3,4),plus),is(10));
}
Program: 153973
Project: 153973
Buggy source:
@Test public void reduceWithEmptyCollectionThrowsException(){
  try {
    reduce(Collections.emptyList(),null);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException expected) {
  }
}

Fixed version (ground truth):
@Test public void reduceWithEmptyCollectionThrowsException(){
  try {
    Collections3.reduce(Collections.emptyList(),null);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException expected) {
  }
}
Program: 153974
Project: 153974
Buggy source:
@Test public void foldWithAddFirstShouldReverseListIntoEmptyList(){
  Function2<Deque<Integer>,Integer,Deque<Integer>> reverse=new Function2<Deque<Integer>,Integer,Deque<Integer>>(){
    public Deque<Integer> apply(    Deque<Integer> accum,    Integer next){
      accum.addFirst(next);
      return accum;
    }
  }
;
  Deque<Integer> expected=new LinkedList<Integer>(Arrays.asList(3,2,1));
  assertThat(fold(Arrays.asList(1,2,3),new LinkedList<Integer>(),reverse),is(expected));
}

Fixed version (ground truth):
@Test public void foldWithAddFirstShouldReverseListIntoEmptyList(){
  Function2<Deque<Integer>,Integer,Deque<Integer>> reverse=new Function2<Deque<Integer>,Integer,Deque<Integer>>(){
    public Deque<Integer> apply(    Deque<Integer> accum,    Integer next){
      accum.addFirst(next);
      return accum;
    }
  }
;
  Deque<Integer> expected=new LinkedList<Integer>(Arrays.asList(3,2,1));
  assertThat(Collections3.fold(Arrays.asList(1,2,3),new LinkedList<Integer>(),reverse),is(expected));
}
Program: 153975
Project: 153975
Buggy source:
@Test public void reduceWithOneElementReturnsThatElement(){
  String result=reduce(Collections.singletonList("String_Node_Str"),null);
  assertThat(result,is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void reduceWithOneElementReturnsThatElement(){
  String result=Collections3.reduce(Collections.singletonList("String_Node_Str"),null);
  assertThat(result,is("String_Node_Str"));
}
Program: 153976
Project: 153976
Buggy source:
@Test public void foldWithEmptyCollectionsReturnsInitialValue(){
  assertThat(fold(Collections.emptyList(),"String_Node_Str",null),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void foldWithEmptyCollectionsReturnsInitialValue(){
  assertThat(Collections3.fold(Collections.emptyList(),"String_Node_Str",null),is("String_Node_Str"));
}
Program: 153977
Project: 153977
Buggy source:
@Test public void reduceWithTimesShouldMultiplyAllNumbers(){
  Function2<Integer,Integer,Integer> times=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum * next;
    }
  }
;
  assertThat(reduce(Arrays.asList(1,2,3,4),times),is(24));
}

Fixed version (ground truth):
@Test public void reduceWithTimesShouldMultiplyAllNumbers(){
  Function2<Integer,Integer,Integer> times=new Function2<Integer,Integer,Integer>(){
    public Integer apply(    Integer accum,    Integer next){
      return accum * next;
    }
  }
;
  assertThat(Collections3.reduce(Arrays.asList(1,2,3,4),times),is(24));
}
Program: 153978
Project: 153978
Buggy source:
/** 
 * Creates and add to panel used components
 */
protected void initComponent(){
  paramFields=new ArrayList<JTextField>();
  jlbParameters=new JLabel("String_Node_Str");
  jtfExpectedValue=new JTextField(10);
  jlbExpectedValue=new JLabel("String_Node_Str");
  jlbExpectedValueError=new JLabel("String_Node_Str");
  jlbExpectedValueError.setForeground(Color.red);
  jlbMethodDescription=new JLabel();
  topPanel=new JPanel(new FlowLayout());
  bottomPanel=new JPanel(new FlowLayout());
  List<Method> methodsList=model.getMethods().getList();
  jcbMethods=new JComboBox(createComboBoxArray(methodsList));
  jcbMethods.addActionListener(this);
  topPanel.add(jcbMethods);
  topPanel.add(jlbExpectedValue);
  topPanel.add(jlbExpectedValueError);
  topPanel.add(jtfExpectedValue);
  topPanel.add(jlbParameters);
  add(topPanel);
  add(bottomPanel);
}

Fixed version (ground truth):
/** 
 * Creates and add to panel used components
 */
protected void initComponent(){
  paramFields=new ArrayList<JTextField>(10);
  jlbParameters=new JLabel("String_Node_Str");
  jtfExpectedValue=new JTextField(10);
  jlbExpectedValue=new JLabel("String_Node_Str");
  jlbExpectedValueError=new JLabel("String_Node_Str");
  jlbExpectedValueError.setForeground(Color.red);
  jlbMethodDescription=new JLabel();
  topPanel=new JPanel(new FlowLayout());
  bottomPanel=new JPanel(new FlowLayout());
  List<Method> methodsList=model.getMethods().getList();
  jcbMethods=new JComboBox(createComboBoxArray(methodsList));
  jcbMethods.addActionListener(this);
  topPanel.add(jcbMethods);
  topPanel.add(jlbExpectedValue);
  topPanel.add(jlbExpectedValueError);
  topPanel.add(jtfExpectedValue);
  topPanel.add(jlbParameters);
  add(topPanel);
  add(bottomPanel);
}