nus-yam/ex-repair huggingface dataset:
Program: 81945
Project: 81945
Buggy source:
public void start(){
  if (running) {
    throw new IllegalStateException("String_Node_Str");
  }
  running=true;
  server.getLogger().info("String_Node_Str",Info.SOFTWARE_NAME,Info.VERSION_STRING());
  startTime=System.currentTimeMillis();
  while (running) {
    lastTickMilli=System.currentTimeMillis();
    tick++;
    tick();
    long now=System.currentTimeMillis();
    long diff=now - lastTickMilli;
    loadMeasure=diff * 100D / sleep;
    if (loadMeasure > 80D) {
      AntiSpam.act(new Runnable(){
        @Override public void run(){
          server.getLogger().warning("String_Node_Str",loadMeasure);
        }
      }
,ANTISPAM_LOAD_MEASURE_TOO_HIGH,5000);
      continue;
    }
    long need=sleep - diff;
    try {
      Thread.sleep(need);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  for (  RegisteredTask task : tasks) {
    task.getTask().onFinalize();
  }
  lastTickDone=true;
}

Fixed version (ground truth):
public void start(){
  if (running) {
    throw new IllegalStateException("String_Node_Str");
  }
  running=true;
  server.getLogger().info("String_Node_Str",Info.SOFTWARE_NAME,Info.VERSION_STRING());
  startTime=System.currentTimeMillis();
  while (running) {
    lastTickMilli=System.currentTimeMillis();
    tick++;
    tick();
    long now=System.currentTimeMillis();
    long diff=now - lastTickMilli;
    loadMeasure=diff * 100D / sleep;
    if (loadMeasure > 80D) {
      AntiSpam.act(new Runnable(){
        @Override public void run(){
          server.getLogger().warning("String_Node_Str",loadMeasure);
        }
      }
,ANTISPAM_LOAD_MEASURE_TOO_HIGH,5000);
      continue;
    }
    long need=sleep - diff;
    try {
      Thread.sleep(need);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
synchronized (tasks) {
    for (    RegisteredTask task : tasks) {
      task.getTask().onFinalize();
    }
  }
  lastTickDone=true;
}
Program: 81946
Project: 81946
Buggy source:
private void tick(){
  for (  RegisteredTask task : tasks) {
    task.check(tick);
  }
}

Fixed version (ground truth):
private void tick(){
  RegisteredTask[] taskArray;
synchronized (tasks) {
    taskArray=new RegisteredTask[tasks.size()];
    tasks.toArray(taskArray);
  }
  for (  RegisteredTask task : taskArray) {
    task.check(tick);
  }
}
Program: 81947
Project: 81947
Buggy source:
public Callable(Object object,String method,Class<?>... types) throws NoSuchMethodException {
  this.object=object;
  this.method=object.getClass().getMethod(method,types);
  if (this.method.getExceptionTypes().length > 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
public Callable(Object object,String method) throws NoSuchMethodException {
  this.object=object;
  this.method=object.getClass().getMethod(method);
  for (  Class<?> exType : this.method.getExceptionTypes()) {
    try {
      exType.asSubclass(RuntimeException.class);
    }
 catch (    ClassCastException e) {
      try {
        exType.asSubclass(Error.class);
      }
 catch (      ClassCastException e2) {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
  }
}
Program: 81948
Project: 81948
Buggy source:
public Server build(){
  validate(port != -1,"String_Node_Str");
  validate(serverName != null,"String_Node_Str");
  validate(out != null,"String_Node_Str");
  validate(includePath != null,"String_Node_Str");
  validate(playerDb != null,"String_Node_Str");
  return new Server(address,port,serverName,out,playerDb);
}

Fixed version (ground truth):
public Server build(){
  validate(port != -1,"String_Node_Str");
  validate(serverName != null,"String_Node_Str");
  validate(out != null,"String_Node_Str");
  validate(includePath != null,"String_Node_Str");
  return new Server(address,port,serverName,out,playerDb);
}
Program: 81949
Project: 81949
Buggy source:
private void replyToRequest2(ByteBuffer bb){
  RaknetOpenConnectionRequest2 req2=new RaknetOpenConnectionRequest2(bb);
  clientId=req2.clientId;
  mtu=req2.mtu;
  RaknetOpenConnectionReply2 rep2=new RaknetOpenConnectionReply2(req2.magic,req2.serverPort,mtu);
  sendPacket(rep2.getBuffer());
}

Fixed version (ground truth):
private void replyToRequest2(ByteBuffer bb){
  getServer().getLogger().debug("String_Node_Str");
  RaknetOpenConnectionRequest2 req2=new RaknetOpenConnectionRequest2(bb);
  clientId=req2.clientId;
  mtu=req2.mtu;
  RaknetOpenConnectionReply2 rep2=new RaknetOpenConnectionReply2(req2.magic,req2.serverPort,mtu);
  sendPacket(rep2.getBuffer());
  getServer().getLogger().buffer("String_Node_Str",rep2.getBuffer(),"String_Node_Str");
}
Program: 81950
Project: 81950
Buggy source:
@Override public void handlePacket(WrappedPacket pk){
  ByteBuffer bb=pk.bb();
  byte pid=bb.get();
  if (RAKNET_CUSTOM_PACKET_MIN <= pid && pid <= RAKNET_CUSTOM_PACKET_MAX) {
    handleCustomPacket(bb);
  }
 else {
switch (pid) {
case RAKNET_BROADCAST_PING_1:
case RAKNET_BROADCAST_PING_2:
      replyToBroadcastPing(bb);
    break;
case RAKNET_OPEN_CONNECTION_REQUEST_1:
  replyToRequest1(bb);
break;
case RAKNET_OPEN_CONNECTION_REQUEST_2:
replyToRequest2(bb);
break;
}
}
}

Fixed version (ground truth):
@Override public void handlePacket(WrappedPacket pk){
  ByteBuffer bb=pk.bb();
  byte pid=bb.get();
  getServer().getLogger().debug("String_Node_Str" + pid + "String_Node_Str"+ addr.toString());
  if (RAKNET_CUSTOM_PACKET_MIN <= pid && pid <= RAKNET_CUSTOM_PACKET_MAX) {
    handleCustomPacket(bb);
  }
 else {
switch (pid) {
case RAKNET_BROADCAST_PING_1:
case RAKNET_BROADCAST_PING_2:
      replyToBroadcastPing(bb);
    break;
case RAKNET_OPEN_CONNECTION_REQUEST_1:
  replyToRequest1(bb);
break;
case RAKNET_OPEN_CONNECTION_REQUEST_2:
replyToRequest2(bb);
break;
}
}
}
Program: 81951
Project: 81951
Buggy source:
public RaknetOpenConnectionReply2(byte[] magic,short port,short mtu){
  bb=ByteBuffer.allocate(30);
  bb.put(magic);
  bb.putLong(SERVER_ID);
  bb.putShort(port);
  bb.putShort(mtu);
  bb.put((byte)0);
}

Fixed version (ground truth):
public RaknetOpenConnectionReply2(byte[] magic,short port,short mtu){
  bb=ByteBuffer.allocate(30);
  bb.put(RAKNET_OPEN_CONNECTION_REPLY_2);
  bb.put(magic);
  bb.putLong(SERVER_ID);
  bb.putShort(port);
  bb.putShort(mtu);
  bb.put((byte)0);
}
Program: 81952
Project: 81952
Buggy source:
public ReceivedEncapsulatedPacket(ByteBuffer bb){
  byte flag=bb.get();
  reliability=(byte)(flag >> 5);
  hasSplit=(flag & 0x10) == 0x10;
  int length=((bb.getShort() + 7) >> 3);
  if (Utils.inArray(reliability,RAKNET_HAS_MESSAGE_RELIABILITIES)) {
    messageIndex=Utils.readLTriad(bb);
  }
  if (Utils.inArray(reliability,RAKNET_HAS_ORDER_RELIABILITIES)) {
    orderIndex=Utils.readLTriad(bb);
    orderChannel=bb.get();
  }
  if (hasSplit) {
    splitCount=bb.getInt();
    splitId=bb.getShort();
    splitIndex=bb.getInt();
  }
  buffer=new byte[length];
  bb.get(buffer);
}

Fixed version (ground truth):
public ReceivedEncapsulatedPacket(ByteBuffer bb){
  byte flag=bb.get();
  reliability=(byte)(flag >> 5);
  hasSplit=(flag & 0x10) == 0x10;
  int length=bb.getShort() * 8;
  if (Utils.inArray(reliability,RAKNET_HAS_MESSAGE_RELIABILITIES)) {
    messageIndex=Utils.readLTriad(bb);
  }
  if (Utils.inArray(reliability,RAKNET_HAS_ORDER_RELIABILITIES)) {
    orderIndex=Utils.readLTriad(bb);
    orderChannel=bb.get();
  }
  if (hasSplit) {
    splitCount=bb.getInt();
    splitId=bb.getShort();
    splitIndex=bb.getInt();
  }
  buffer=new byte[length];
  bb.get(buffer);
}
Program: 81953
Project: 81953
Buggy source:
@Override public void run(){
  setName("String_Node_Str");
  udp.getServer().getLogger().info("String_Node_Str",addr.toString());
  try {
    socket=new DatagramSocket(null);
    socket.setBroadcast(true);
    socket.setSendBufferSize(1024 * 1024 * 8);
    socket.setReceiveBufferSize(1024 * 1024);
    try {
      socket.bind(addr);
    }
 catch (    BindException e) {
      getServer().getLogger().fatal("String_Node_Str",addr.toString());
      throw new RuntimeException(e);
    }
    socket.setSoTimeout(0);
    getServer().registerShutdownFunction(new Callable(this,"String_Node_Str",boolean.class));
    while (running) {
      DatagramPacket pk=new DatagramPacket(new byte[1024 * 1024],1024 * 1024);
      socket.receive(pk);
synchronized (receivedPacketQueue) {
        receivedPacketQueue.add(pk);
      }
    }
    socket.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void run(){
  setName("String_Node_Str");
  udp.getServer().getLogger().info("String_Node_Str",addr.toString());
  try {
    socket=new DatagramSocket(null);
    socket.setBroadcast(true);
    socket.setSendBufferSize(1024 * 1024 * 8);
    socket.setReceiveBufferSize(1024 * 1024);
    try {
      socket.bind(addr);
    }
 catch (    BindException e) {
      getServer().getLogger().fatal("String_Node_Str",addr.toString());
      throw new RuntimeException(e);
    }
    socket.setSoTimeout(0);
    getServer().registerShutdownFunction(new Callable(this,"String_Node_Str",boolean.class));
    while (running) {
      byte[] buffer=new byte[1024 * 1024];
      DatagramPacket pk=new DatagramPacket(buffer,buffer.length);
      socket.receive(pk);
      pk.setData(Arrays.copyOf(buffer,pk.getLength()));
synchronized (receivedPacketQueue) {
        receivedPacketQueue.add(pk);
      }
    }
    socket.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  NoSuchMethodException e) {
    e.printStackTrace();
  }
}
Program: 81954
Project: 81954
Buggy source:
/** 
 * Package internal constructor used in   {@linkplain ServerBuilder#build()} internally
 * @see ServerBuilder#build()
 * @param address
 * @param port
 * @param out
 */
Server(InetAddress address,int port,String serverName,ConsoleOut out){
  Thread.currentThread().setName("String_Node_Str");
  this.address=address;
  this.port=port;
  this.serverName=serverName;
  logger=new Logger(out);
  ticker=new ServerTicker(this,50);
  bridges=new NetworkBridgeManager(this);
}

Fixed version (ground truth):
/** 
 * Package internal constructor used in   {@linkplain ServerBuilder#build()} internally
 * @see ServerBuilder#build()
 * @param address
 * @param port
 * @param out
 */
Server(InetAddress address,int port,String serverName,ConsoleOut out){
  Thread.currentThread().setName("String_Node_Str");
  this.address=address;
  this.port=port;
  this.serverName=serverName;
  logger=new Logger(out);
  ticker=new ServerTicker(this,50);
  protocols=new ProtocolManager(this);
  protocols.addProtocol(new PocketProtocol(this));
  bridges=new NetworkBridgeManager(this);
}
Program: 81955
Project: 81955
Buggy source:
@Override public WrappedPacket receive(){
  DatagramPacket dp=socket.receive();
  if (dp != null) {
    final byte[] data=dp.getData();
    AntiSpam.act(new Runnable(){
      @Override public void run(){
        mgr.getServer().getLogger().buffer("String_Node_Str",data,"String_Node_Str");
      }
    }
,"String_Node_Str",2000);
    WrappedPacket wp=new WrappedPacket(data,dp.getSocketAddress(),this);
    return wp;
  }
  return null;
}

Fixed version (ground truth):
@Override public WrappedPacket receive(){
  DatagramPacket dp=socket.receive();
  if (dp != null) {
    byte[] data=dp.getData();
    WrappedPacket wp=new WrappedPacket(data,dp.getSocketAddress(),this);
    return wp;
  }
  return null;
}
Program: 81956
Project: 81956
Buggy source:
public boolean send(byte[] buffer,SocketAddress addr){
  mgr.getServer().getLogger().info("String_Node_Str",Arrays.toString(buffer));
  return socket.send(buffer,addr);
}

Fixed version (ground truth):
public boolean send(byte[] buffer,SocketAddress addr){
  mgr.getServer().getLogger().buffer("String_Node_Str",buffer,"String_Node_Str");
  mgr.getServer().getLogger().debug(new String(buffer));
  return socket.send(buffer,addr);
}
Program: 81957
Project: 81957
Buggy source:
public void handlePacket(WrappedPacket pk){
  if (sessions.containsKey(pk.getAddress())) {
    sessions.get(pk.getAddress()).handlePacket(pk);
  }
 else {
    for (    Protocol ptc : protocols) {
      ProtocolSession ps=ptc.openSession(pk);
      if (ps != null) {
        sessions.put(pk.getAddress(),ps);
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void handlePacket(WrappedPacket pk){
  System.out.println("String_Node_Str" + pk.getAddress().toString());
  if (sessions.containsKey(pk.getAddress())) {
    getServer().getLogger().debug("String_Node_Str",pk.getAddress());
    sessions.get(pk.getAddress()).handlePacket(pk);
  }
 else {
    for (    Protocol ptc : protocols) {
      ProtocolSession ps=ptc.openSession(pk);
      if (ps != null) {
        getServer().getLogger().debug("String_Node_Str",pk.getAddress());
        sessions.put(pk.getAddress(),ps);
        break;
      }
    }
  }
}
Program: 81958
Project: 81958
Buggy source:
@Override public ProtocolSession openSession(WrappedPacket pk){
  if (pk.getBridge() instanceof UDPBridge) {
    byte pid=pk.bb().get(0);
    if (pid == RAKNET_BROADCAST_PING_1 || pid == RAKNET_BROADCAST_PING_2) {
      advertize(pk);
      return null;
    }
 else     if (pid == RAKNET_OPEN_CONNECTION_REQUEST_1) {
      PocketProtocolSession session=new PocketProtocolSession(protocols,pk.getBridge(),pk.getAddress());
      session.handlePacket(pk);
      return session;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ProtocolSession openSession(WrappedPacket pk){
  System.out.println("String_Node_Str" + pk.getAddress().toString());
  if (pk.getBridge() instanceof UDPBridge) {
    byte pid=pk.bb().get(0);
    if (pid == RAKNET_BROADCAST_PING_1 || pid == RAKNET_BROADCAST_PING_2) {
      advertize(pk);
      return null;
    }
 else     if (pid == RAKNET_OPEN_CONNECTION_REQUEST_1) {
      PocketProtocolSession session=new PocketProtocolSession(protocols,pk.getBridge(),pk.getAddress());
      session.handlePacket(pk);
      return session;
    }
  }
  return null;
}
Program: 81959
Project: 81959
Buggy source:
private void advertize(WrappedPacket pk){
}

Fixed version (ground truth):
private void advertize(WrappedPacket pk){
  System.out.println("String_Node_Str" + pk.getAddress().toString());
  RaknetUnconnectedPing ping=new RaknetUnconnectedPing(pk.bb());
  RaknetUnconnectedPong pong=new RaknetUnconnectedPong(ping.pingId,SERVER_ID,ping.magic,server.getServerName());
  pk.getBridge().send(pong.getBuffer(),pk.getAddress());
}
Program: 81960
Project: 81960
Buggy source:
public RaknetUnconnectedPong(long ping,long server,byte[] magic,String name){
  name="String_Node_Str" + name;
  bb=ByteBuffer.allocate(30);
  bb.putLong(ping);
  bb.putLong(server);
  bb.put(magic);
  bb.putShort((short)name.length());
  bb.put(name.getBytes());
}

Fixed version (ground truth):
public RaknetUnconnectedPong(long ping,long server,byte[] magic,String name){
  name="String_Node_Str" + name;
  byte[] nameBytes=name.getBytes();
  bb=ByteBuffer.allocate(35 + nameBytes.length);
  bb.put(RAKNET_BROADCAST_PONG_1);
  bb.putLong(ping);
  bb.putLong(server);
  bb.put(magic);
  bb.putShort((short)nameBytes.length);
  bb.put(nameBytes);
}
Program: 81961
Project: 81961
Buggy source:
public int getPort(){
  return port;
}

Fixed version (ground truth):
int getPort(){
  return port;
}
Program: 81962
Project: 81962
Buggy source:
public void testDoctypeEnabled() throws Exception {
  TinyServer server=new TinyServer();
  server.start();
  Thread.sleep(500);
  try {
    StringBuffer xml=new StringBuffer(512);
    xml.append("String_Node_Str");
    xml.append("String_Node_Str" + server.getPort() + "String_Node_Str");
    xml.append("String_Node_Str");
    XMLUtil.stringToDocument(xml.toString(),true,true,false);
    Assert.assertTrue(server.connected);
  }
  finally {
    server.kill();
  }
}

Fixed version (ground truth):
public void testDoctypeEnabled() throws Exception {
  TinyServer server=new TinyServer();
  server.start();
  while (server.port == 0) {
    Thread.sleep(100);
  }
  try {
    String xml="String_Node_Str" + "String_Node_Str" + server.getPort() + "String_Node_Str"+ "String_Node_Str";
    XMLUtil.stringToDocument(xml,true,true,false);
    Assert.assertTrue(server.connected);
  }
  finally {
    server.kill();
  }
}
Program: 81963
Project: 81963
Buggy source:
@Override public void run(){
  try {
    serverSocket=new ServerSocket(0);
    port=serverSocket.getLocalPort();
    clientSocket=serverSocket.accept();
    connected=true;
    BufferedReader reader=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    while (reader.ready()) {
      String line=reader.readLine();
      System.out.println(line);
    }
    OutputStream out=clientSocket.getOutputStream();
    out.write("String_Node_Str".getBytes());
    out.write("String_Node_Str".getBytes());
    out.write("String_Node_Str".getBytes());
    out.write(("String_Node_Str" + "String_Node_Str" + "String_Node_Str").getBytes());
    out.flush();
  }
 catch (  Exception e) {
  }
 finally {
    try {
      clientSocket.getOutputStream().close();
    }
 catch (    Exception e) {
    }
    try {
      clientSocket.getOutputStream().close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    serverSocket=new ServerSocket(0);
    port=serverSocket.getLocalPort();
    clientSocket=serverSocket.accept();
    connected=true;
    BufferedReader reader=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    while (reader.ready()) {
      String line=reader.readLine();
      System.out.println(line);
    }
    OutputStream out=clientSocket.getOutputStream();
    out.write("String_Node_Str".getBytes());
    out.write("String_Node_Str".getBytes());
    out.write("String_Node_Str".getBytes());
    out.write(("String_Node_Str" + "String_Node_Str" + "String_Node_Str").getBytes());
    out.flush();
    Thread.sleep(100);
  }
 catch (  Exception e) {
  }
 finally {
    try {
      clientSocket.getOutputStream().close();
    }
 catch (    Exception e) {
    }
    try {
      clientSocket.getOutputStream().close();
    }
 catch (    Exception e) {
    }
  }
}
Program: 81964
Project: 81964
Buggy source:
public void kill(){
  try {
    serverSocket.close();
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
void kill(){
  try {
    serverSocket.close();
  }
 catch (  IOException e) {
  }
}
Program: 81965
Project: 81965
Buggy source:
public void testDoctypeDisabled() throws Exception {
  TinyServer server=new TinyServer();
  server.start();
  Thread.sleep(500);
  try {
    StringBuffer xml=new StringBuffer(512);
    xml.append("String_Node_Str");
    xml.append("String_Node_Str" + server.getPort() + "String_Node_Str");
    xml.append("String_Node_Str");
    try {
      XMLUtil.stringToDocument(xml.toString(),true,false,false);
      Assert.fail("String_Node_Str");
    }
 catch (    MessageException me) {
      Assert.assertTrue(me.getMessage().contains("String_Node_Str"));
    }
    Assert.assertFalse(server.connected);
  }
  finally {
    server.kill();
  }
}

Fixed version (ground truth):
public void testDoctypeDisabled() throws Exception {
  TinyServer server=new TinyServer();
  server.start();
  while (server.port == 0) {
    Thread.sleep(100);
  }
  try {
    StringBuilder xml=new StringBuilder(512);
    xml.append("String_Node_Str");
    xml.append("String_Node_Str");
    xml.append(server.getPort()).append("String_Node_Str");
    xml.append("String_Node_Str");
    try {
      XMLUtil.stringToDocument(xml.toString(),true,false,false);
      Assert.fail("String_Node_Str");
    }
 catch (    MessageException me) {
      Assert.assertTrue(me.getMessage().contains("String_Node_Str"));
    }
    Assert.assertFalse(server.connected);
  }
  finally {
    server.kill();
  }
}
Program: 81967
Project: 81967
Buggy source:
/** 
 * Uses the current DocumentBuilderFactory to converts a String representation of XML into a Document.
 * @param xml XML serialized as a String
 * @param nameSpaceAware determines whether the constructed Documentis name-space aware
 * @return Document
 */
public static Document stringToDocument(String xml,boolean nameSpaceAware){
  ClassUtil.validateCreation(Document.class);
  Document document=null;
  try {
    if (xml != null) {
      StringReader reader=new StringReader(xml);
      InputSource input=new InputSource(reader);
      DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
      factory.setNamespaceAware(nameSpaceAware);
      factory.setValidating(false);
      DocumentBuilder builder=factory.newDocumentBuilder();
      document=builder.parse(input);
    }
  }
 catch (  Exception ex) {
    throw new MessageException("String_Node_Str" + ex.getMessage());
  }
  return document;
}

Fixed version (ground truth):
/** 
 * Uses the current DocumentBuilderFactory to converts a String representation of XML into a Document.
 * @param xml XML serialized as a String
 * @param nameSpaceAware determines whether the constructed Documentis name-space aware
 * @return Document
 */
public static Document stringToDocument(String xml,boolean nameSpaceAware){
  ClassUtil.validateCreation(Document.class);
  Document document=null;
  try {
    if (xml != null) {
      StringReader reader=new StringReader(xml);
      InputSource input=new InputSource(reader);
      DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
      factory.setFeature("String_Node_Str",false);
      factory.setFeature("String_Node_Str",false);
      factory.setXIncludeAware(false);
      factory.setExpandEntityReferences(false);
      factory.setNamespaceAware(nameSpaceAware);
      factory.setValidating(false);
      DocumentBuilder builder=factory.newDocumentBuilder();
      document=builder.parse(input);
    }
  }
 catch (  Exception ex) {
    throw new MessageException("String_Node_Str" + ex.getMessage());
  }
  return document;
}
Program: 81968
Project: 81968
Buggy source:
@Test public void testIsRecognizedForKnownCommandWithInvalidArguments(){
  boolean recognized=interpreter.isRecognized("String_Node_Str","String_Node_Str","String_Node_Str");
  assertThat(recognized).isTrue();
}

Fixed version (ground truth):
@Test public void testIsRecognizedForKnownCommandWithInvalidArguments(){
  GitCommandInterpreter interpreter=createInterpreter();
  boolean recognized=interpreter.isRecognized("String_Node_Str","String_Node_Str","String_Node_Str");
  assertThat(recognized).isTrue();
}
Program: 81969
Project: 81969
Buggy source:
@Test @RunInThread public void testExecuteFromBackgroundThread(){
  String executionResult=interpreter.execute("String_Node_Str");
  assertThat(executionResult).isNull();
}

Fixed version (ground truth):
@Test @RunInThread public void testExecuteFromBackgroundThread(){
  GitCommandInterpreter interpreter=createInterpreter();
  String executionResult=interpreter.execute("String_Node_Str");
  assertThat(executionResult).isNull();
}
Program: 81970
Project: 81970
Buggy source:
@Test public void testIsRecognizedForUnknownCommand(){
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isFalse();
}

Fixed version (ground truth):
@Test public void testIsRecognizedForUnknownCommand(){
  GitCommandInterpreter interpreter=createInterpreter();
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isFalse();
}
Program: 81971
Project: 81971
Buggy source:
@Test @RunInThread public void testIsRecognizedFromBackgroundThread(){
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isTrue();
}

Fixed version (ground truth):
@Test @RunInThread public void testIsRecognizedFromBackgroundThread(){
  GitCommandInterpreter interpreter=createInterpreter();
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isTrue();
}
Program: 81972
Project: 81972
Buggy source:
@Test public void testExecuteForKnownCommand(){
  String executionResult=interpreter.execute("String_Node_Str");
  assertThat(executionResult).isNull();
}

Fixed version (ground truth):
@Test public void testExecuteForKnownCommand(){
  GitCommandInterpreter interpreter=createInterpreter();
  String executionResult=interpreter.execute("String_Node_Str");
  assertThat(executionResult).isNull();
}
Program: 81973
Project: 81973
Buggy source:
@Test public void testIsRecognizedForKnownCommand(){
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isTrue();
}

Fixed version (ground truth):
@Test public void testIsRecognizedForKnownCommand(){
  GitCommandInterpreter interpreter=createInterpreter();
  boolean recognized=interpreter.isRecognized("String_Node_Str");
  assertThat(recognized).isTrue();
}
Program: 81974
Project: 81974
Buggy source:
@Before public void setUp(){
  File gitDirectory=configurer.createRepositories("String_Node_Str")[0];
  CompositeRepositoryProvider repositoryProvider=createWithSingleChildProvider(gitDirectory);
  interpreter=new GitCommandInterpreter(mock(ConsoleOutput.class),repositoryProvider);
}

Fixed version (ground truth):
@Before public void setUp(){
  File gitDirectory=configurer.createRepositories("String_Node_Str")[0];
  repositoryProvider=createWithSingleChildProvider(gitDirectory);
}
Program: 81975
Project: 81975
Buggy source:
@Test public void testExecuteForKnownCommandWithInvalidArguments(){
  String executionResult=interpreter.execute("String_Node_Str","String_Node_Str","String_Node_Str");
  assertThat(executionResult).isNull();
}

Fixed version (ground truth):
@Test public void testExecuteForKnownCommandWithInvalidArguments(){
  GitCommandInterpreter interpreter=createInterpreter();
  String executionResult=interpreter.execute("String_Node_Str","String_Node_Str","String_Node_Str");
  assertThat(executionResult).isNull();
}
Program: 81976
Project: 81976
Buggy source:
private String[] resolveAlias(String[] commandLine){
  String[] result=commandLine.clone();
  if (result.length >= 1) {
    AliasConfig aliasConfig=new AliasConfig(commandExecutor.getRepositoryLocation());
    String command=aliasConfig.getCommand(commandLine[0]);
    if (command != null) {
      result[0]=command;
    }
  }
  return result;
}

Fixed version (ground truth):
private String[] resolveAlias(String[] commandLine){
  String[] result=commandLine.clone();
  if (result.length >= 1 && commandExecutor.getRepositoryLocation() != null) {
    AliasConfig aliasConfig=new AliasConfig(commandExecutor.getRepositoryLocation());
    String command=aliasConfig.getCommand(commandLine[0]);
    if (command != null) {
      result[0]=command;
    }
  }
  return result;
}
Program: 81977
Project: 81977
Buggy source:
public InputObserver(ConsoleIoProvider consoleIoProvider,ConsoleComponentFactory consoleComponentFactory){
  this.consoleComponentFactory=consoleComponentFactory;
  this.consolePromptOutput=createConsoleOutput(consoleIoProvider.getPromptStream(),consoleIoProvider);
  this.consoleStandardOutput=createConsoleOutput(consoleIoProvider.getOutputStream(),consoleIoProvider);
  this.consoleErrorOutput=createConsoleOutput(consoleIoProvider.getErrorStream(),consoleIoProvider);
  this.consoleInput=new Input(consoleIoProvider);
  this.executorService=Executors.newSingleThreadExecutor();
}

Fixed version (ground truth):
public InputObserver(ConsoleIoProvider consoleIoProvider,ConsoleComponentFactory consoleComponentFactory){
  this.consoleComponentFactory=consoleComponentFactory;
  this.consolePromptOutput=Output.create(consoleIoProvider.getPromptStream(),consoleIoProvider);
  this.consoleStandardOutput=Output.create(consoleIoProvider.getOutputStream(),consoleIoProvider);
  this.consoleErrorOutput=Output.create(consoleIoProvider.getErrorStream(),consoleIoProvider);
  this.consoleInput=new Input(consoleIoProvider);
  this.executorService=Executors.newSingleThreadExecutor();
}
Program: 81978
Project: 81978
Buggy source:
public Output(OutputStream outputStream,Charset encoding,String lineDelimiter){
  this.outputStream=outputStream;
  this.encoding=encoding;
  this.lineDelimiter=lineDelimiter;
}

Fixed version (ground truth):
Output(OutputStream outputStream,Charset encoding,String lineDelimiter){
  this.outputStream=outputStream;
  this.encoding=encoding;
  this.lineDelimiter=lineDelimiter;
}
Program: 81979
Project: 81979
Buggy source:
private static File createRepository(File file) throws GitAPIException {
  Git git=Git.init().setDirectory(file).call();
  File result=git.getRepository().getDirectory();
  git.getRepository().close();
  return result;
}

Fixed version (ground truth):
private static File createRepository(File file) throws GitAPIException, IOException {
  Git git=Git.init().setDirectory(file).call();
  File result=git.getRepository().getDirectory();
  git.getRepository().close();
  return result.getCanonicalFile();
}
Program: 81980
Project: 81980
Buggy source:
@Test public void testGetRepositoryLocations() throws GitAPIException {
  File repositoryDir=createRepository(tempFolder.getRoot());
  repositoryUtil.addConfiguredRepository(repositoryDir);
  File[] repositoryLocations=new EGitRepositoryProvider().getRepositoryLocations();
  assertThat(repositoryLocations).contains(repositoryDir);
}

Fixed version (ground truth):
@Test public void testGetRepositoryLocations() throws Exception {
  File repositoryDir=createRepository(tempFolder.getRoot());
  repositoryUtil.addConfiguredRepository(repositoryDir);
  File[] repositoryLocations=new EGitRepositoryProvider().getRepositoryLocations();
  assertThat(repositoryLocations).contains(repositoryDir);
}
Program: 81981
Project: 81981
Buggy source:
/** 
 * Make the <tt>JireconRecorderImpl</tt> ready to start recording media streams.
 * @throws Exception if some operation failed and thepreparation is aborted.
 */
private void prepareRecorders() throws Exception {
  logger.debug("String_Node_Str");
  for (  Entry<MediaType,RTPTranslator> e : rtpTranslators.entrySet()) {
    Recorder recorder=mediaService.createRecorder(e.getValue());
    recorders.put(e.getKey(),recorder);
  }
}

Fixed version (ground truth):
/** 
 * Make the <tt>JireconRecorderImpl</tt> ready to start recording media streams.
 * @throws Exception if some operation failed and thepreparation is aborted.
 */
private void prepareRecorders() throws Exception {
  logger.debug("String_Node_Str");
  for (  Entry<MediaType,RTPTranslator> e : rtpTranslators.entrySet()) {
    Recorder recorder=mediaService.createRecorder(e.getValue());
    recorders.put(e.getKey(),recorder);
  }
  updateSynchronizers();
}
Program: 81982
Project: 81982
Buggy source:
/** 
 * {@inheritDoc}
 */
public void setEndpoints(List<EndpointInfo> newEndpoints){
synchronized (endpoints) {
    endpoints=newEndpoints;
    for (    EndpointInfo endpoint : endpoints) {
      final String endpointId=endpoint.getId();
      for (      Entry<MediaType,Long> ssrc : endpoint.getSsrcs().entrySet()) {
        Recorder recorder=recorders.get(ssrc.getKey());
        Synchronizer synchronizer=recorder.getSynchronizer();
        synchronizer.setEndpoint(ssrc.getValue(),endpointId);
        logger.info("String_Node_Str" + endpointId + "String_Node_Str"+ ssrc.getKey()+ "String_Node_Str"+ ssrc.getValue());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void setEndpoints(List<EndpointInfo> newEndpoints){
synchronized (endpoints) {
    endpoints=newEndpoints;
    updateSynchronizers();
  }
}
Program: 81983
Project: 81983
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  MediaExtension result=new MediaExtension();
  boolean done=false;
  while (!done) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
{
        String name=parser.getName();
        if (MediaExtension.ELEMENT_NAME.equals(name)) {
          done=true;
        }
        break;
      }
case XmlPullParser.START_TAG:
{
      int count=parser.getAttributeCount();
      if (count > 0) {
        String type=parser.getAttributeValue(0);
        String ssrc=parser.getAttributeValue(1);
        String direction=parser.getAttributeValue(2);
        if (type.equalsIgnoreCase("String_Node_Str") || type.equalsIgnoreCase("String_Node_Str")) {
          result.setSsrc(type,ssrc);
          result.setDirection(type,direction);
        }
      }
      break;
    }
case XmlPullParser.TEXT:
  break;
}
}
return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  MediaExtension result=new MediaExtension();
  boolean done=false;
  while (!done) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
{
        String name=parser.getName();
        if (MediaExtension.ELEMENT_NAME.equals(name)) {
          done=true;
        }
        break;
      }
case XmlPullParser.START_TAG:
{
      int count=parser.getAttributeCount();
      if (count > 0) {
        String type=parser.getAttributeValue("String_Node_Str","String_Node_Str");
        String ssrc=parser.getAttributeValue("String_Node_Str","String_Node_Str");
        String direction=parser.getAttributeValue("String_Node_Str","String_Node_Str");
        if (type.equalsIgnoreCase("String_Node_Str") || type.equalsIgnoreCase("String_Node_Str")) {
          result.setSsrc(type,ssrc);
          result.setDirection(type,direction);
        }
      }
      break;
    }
case XmlPullParser.TEXT:
  break;
}
}
return result;
}
Program: 81984
Project: 81984
Buggy source:
/** 
 * Find the specified <tt>MediaType<tt> ssrc which belongs to some endpont. <strong>Warning:</strong> An endpoint means a media stream source, each media stream source generally contains two ssrc, one for audio stream and one for video stream.
 * @param endpointId indicates an endpoint
 * @param mediaType is the <tt>MediaType</tt> which indicates which ssrc youwant to get.
 * @return ssrc or -1 if not found
 */
private long getEndpointSsrc(String endpointId,MediaType mediaType){
synchronized (endpoints) {
    for (    EndpointInfo endpoint : endpoints) {
      if (0 == endpoint.getId().compareTo(endpointId) || 0 == endpoint.getBareId().compareTo(endpointId)) {
        return endpoint.getSsrc(mediaType);
      }
    }
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * Find the specified <tt>MediaType<tt> ssrc which belongs to some endpont. <strong>Warning:</strong> An endpoint means a media stream source, each media stream source generally contains two ssrc, one for audio stream and one for video stream.
 * @param endpointId indicates an endpoint
 * @param mediaType is the <tt>MediaType</tt> which indicates which ssrc youwant to get.
 * @return ssrc or -1 if not found
 */
private long getEndpointSsrc(String endpointId,MediaType mediaType){
synchronized (endpointsSyncRoot) {
    for (    EndpointInfo endpoint : endpoints) {
      if (0 == endpoint.getId().compareTo(endpointId) || 0 == endpoint.getBareId().compareTo(endpointId)) {
        return endpoint.getSsrc(mediaType);
      }
    }
    return -1;
  }
}
Program: 81985
Project: 81985
Buggy source:
/** 
 * {@inheritDoc}
 */
public void setEndpoints(List<EndpointInfo> newEndpoints){
synchronized (endpoints) {
    endpoints=newEndpoints;
    updateSynchronizers();
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void setEndpoints(List<EndpointInfo> newEndpoints){
synchronized (endpointsSyncRoot) {
    endpoints=newEndpoints;
    updateSynchronizers();
  }
}
Program: 81986
Project: 81986
Buggy source:
void updateSynchronizers(){
synchronized (endpoints) {
    for (    EndpointInfo endpoint : endpoints) {
      final String endpointId=endpoint.getId();
      for (      Entry<MediaType,Long> ssrc : endpoint.getSsrcs().entrySet()) {
        Recorder recorder=recorders.get(ssrc.getKey());
        if (recorder != null) {
          Synchronizer synchronizer=recorder.getSynchronizer();
          synchronizer.setEndpoint(ssrc.getValue(),endpointId);
        }
        logger.info("String_Node_Str" + endpointId + "String_Node_Str"+ ssrc.getKey()+ "String_Node_Str"+ ssrc.getValue());
      }
    }
  }
}

Fixed version (ground truth):
void updateSynchronizers(){
synchronized (endpointsSyncRoot) {
    for (    EndpointInfo endpoint : endpoints) {
      final String endpointId=endpoint.getId();
      for (      Entry<MediaType,Long> ssrc : endpoint.getSsrcs().entrySet()) {
        Recorder recorder=recorders.get(ssrc.getKey());
        if (recorder != null) {
          Synchronizer synchronizer=recorder.getSynchronizer();
          synchronizer.setEndpoint(ssrc.getValue(),endpointId);
        }
        logger.info("String_Node_Str" + endpointId + "String_Node_Str"+ ssrc.getKey()+ "String_Node_Str"+ ssrc.getValue());
      }
    }
  }
}
Program: 81987
Project: 81987
Buggy source:
/** 
 * Find and get the <tt>MediaType</tt> ssrc which belongs to some endpoint. <strong>Warning:</strong> An endpoint means a media stream source, each media stream source generally contains two ssrc, one for audio stream and one for video stream.
 * @param ssrc indicates an endpoint.
 * @param mediaType is the <tt>MediaType</tt> which indicates which ssrc youwant to get.
 * @return ssrc or -1 if not found
 */
private long getAssociatedSsrc(long ssrc,MediaType mediaType){
synchronized (endpoints) {
    for (    EndpointInfo endpoint : endpoints) {
      Map<MediaType,Long> ssrcs=endpoint.getSsrcs();
      if (ssrcs.size() < 2)       continue;
      if (ssrcs.containsValue(ssrc)) {
        return ssrcs.get(mediaType);
      }
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Find and get the <tt>MediaType</tt> ssrc which belongs to some endpoint. <strong>Warning:</strong> An endpoint means a media stream source, each media stream source generally contains two ssrc, one for audio stream and one for video stream.
 * @param ssrc indicates an endpoint.
 * @param mediaType is the <tt>MediaType</tt> which indicates which ssrc youwant to get.
 * @return ssrc or -1 if not found
 */
private long getAssociatedSsrc(long ssrc,MediaType mediaType){
synchronized (endpointsSyncRoot) {
    for (    EndpointInfo endpoint : endpoints) {
      Map<MediaType,Long> ssrcs=endpoint.getSsrcs();
      if (ssrcs.size() < 2)       continue;
      if (ssrcs.containsValue(ssrc)) {
        return ssrcs.get(mediaType);
      }
    }
  }
  return -1;
}
Program: 81988
Project: 81988
Buggy source:
private void removeEndpoint(String jid){
  logger.debug("String_Node_Str" + jid);
synchronized (endpoints) {
    Iterator<EndpointInfo> iter=endpoints.iterator();
    while (iter.hasNext()) {
      if (0 == iter.next().getId().compareTo(jid)) {
        iter.remove();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove a specified endpoint.
 * @param jid Indicate which endpoint do you want to remove.
 */
private void removeEndpoint(String jid){
  logger.debug("String_Node_Str" + jid);
synchronized (endpoints) {
    Iterator<EndpointInfo> iter=endpoints.iterator();
    while (iter.hasNext()) {
      if (0 == iter.next().getId().compareTo(jid)) {
        iter.remove();
      }
    }
  }
}
Program: 81989
Project: 81989
Buggy source:
/** 
 * Fire a <tt>JireconTaskEvent</tt>, notify listeners we've made new progress which they may interest in.
 * @param event
 */
private void fireEvent(TaskEvent event){
synchronized (listeners) {
    for (    TaskEventListener l : listeners)     l.handleTaskEvent(event);
  }
}

Fixed version (ground truth):
/** 
 * Fire a <tt>TaskEvent</tt>, notify listeners we've made new progress which they may interest in.
 * @param event
 */
private void fireEvent(TaskEvent event){
synchronized (listeners) {
    for (    TaskEventListener l : listeners)     l.handleTaskEvent(event);
  }
}
Program: 81990
Project: 81990
Buggy source:
/** 
 * Remove <tt>JireconTaskEvent</tt> listener.
 * @param listener
 */
public void removeTaskEventListener(TaskEventListener listener){
synchronized (listeners) {
    listeners.remove(listener);
  }
}

Fixed version (ground truth):
public void removeTaskEventListener(TaskEventListener listener){
synchronized (listeners) {
    listeners.remove(listener);
  }
}
Program: 81991
Project: 81991
Buggy source:
public void connect(String mucJid,String nickname) throws Exception {
  joinMUC(mucJid,nickname);
}

Fixed version (ground truth):
/** 
 * Join a Multi-User-Chat of specified MUC jid.
 * @param mucJid The specified MUC jid.
 * @param nickname The name in MUC.
 * @throws Exception if failed to join MUC.
 */
public void connect(String mucJid,String nickname) throws Exception {
  joinMUC(mucJid,nickname);
}
Program: 81992
Project: 81992
Buggy source:
/** 
 * Initialize <tt>JireconSession</tt>. <p> <strong>Warning:</strong> LibJitsi must be started before calling this method.
 * @param connection is used for send/receive XMPP packet.
 */
public void init(XMPPConnection connection){
  this.connection=connection;
  addPacketSendingListener();
  addPacketReceivingListener();
  JireconSessionPacketListener packetListener=new JireconSessionPacketListener(){
    @Override public void handlePacket(    Packet packet){
      if (Presence.class == packet.getClass())       handlePresencePacket((Presence)packet);
    }
  }
;
  addPacketListener(packetListener);
}

Fixed version (ground truth):
/** 
 * Initialize <tt>JireconSession</tt>.
 * @param connection is used for send/receive XMPP packet.
 */
public void init(XMPPConnection connection){
  LibJitsi.start();
  this.connection=connection;
  addPacketSendingListener();
  addPacketReceivingListener();
  JireconSessionPacketListener packetListener=new JireconSessionPacketListener(){
    @Override public void handlePacket(    Packet packet){
      if (Presence.class == packet.getClass())       handlePresencePacket((Presence)packet);
    }
  }
;
  addPacketListener(packetListener);
}
Program: 81993
Project: 81993
Buggy source:
private void addEndpoint(String jid,Map<MediaType,Long> ssrcs){
synchronized (endpoints) {
    EndpointInfo endpoint=new EndpointInfo();
    endpoint.setId(jid);
    for (    MediaType mediaType : new MediaType[]{MediaType.AUDIO,MediaType.VIDEO}) {
      endpoint.setSsrc(mediaType,ssrcs.get(mediaType));
    }
    Iterator<EndpointInfo> iter=endpoints.iterator();
    while (iter.hasNext()) {
      if (0 == iter.next().getId().compareTo(jid)) {
        iter.remove();
      }
    }
    endpoints.remove(jid);
    endpoints.add(endpoint);
  }
}

Fixed version (ground truth):
/** 
 * Record a newly found endpoint. <p> If there is an existed endpoint with same id, then we will override the old enpoint.
 * @param jid The endpoint id.
 * @param ssrcs The endpoint ssrcs.
 */
private void addEndpoint(String jid,Map<MediaType,Long> ssrcs){
synchronized (endpoints) {
    EndpointInfo endpoint=new EndpointInfo();
    endpoint.setId(jid);
    for (    MediaType mediaType : new MediaType[]{MediaType.AUDIO,MediaType.VIDEO}) {
      endpoint.setSsrc(mediaType,ssrcs.get(mediaType));
    }
    Iterator<EndpointInfo> iter=endpoints.iterator();
    while (iter.hasNext()) {
      if (0 == iter.next().getId().compareTo(jid)) {
        iter.remove();
      }
    }
    endpoints.remove(jid);
    endpoints.add(endpoint);
  }
}
Program: 81995
Project: 81995
Buggy source:
/** 
 * Add <tt>JireconTaskEvent</tt> listener.
 * @param listener
 */
public void addTaskEventListener(TaskEventListener listener){
synchronized (listeners) {
    listeners.add(listener);
  }
}

Fixed version (ground truth):
public void addTaskEventListener(TaskEventListener listener){
synchronized (listeners) {
    listeners.add(listener);
  }
}
Program: 81996
Project: 81996
Buggy source:
/** 
 * Send Jingle session-accept packet to the remote peer.
 * @param formatAndPTs
 * @param localSsrcs
 * @param transportPEs
 * @param fingerprintPEs
 */
public void sendAcceptPacket(Map<MediaType,Map<MediaFormat,Byte>> formatAndPTs,Map<MediaType,Long> localSsrcs,Map<MediaType,AbstractPacketExtension> transportPEs,Map<MediaType,AbstractPacketExtension> fingerprintPEs){
  logger.debug("String_Node_Str");
  JingleIQ acceptIq=createAcceptPacket(formatAndPTs,localSsrcs,transportPEs,fingerprintPEs);
  connection.sendPacket(acceptIq);
}

Fixed version (ground truth):
/** 
 * Send Jingle session-accept packet to the remote peer.
 * @param formatAndPTs Map between <tt>MediaFormat</tt> and payload type id.
 * @param localSsrcs Local sscrs of audio and video.
 * @param transportPEs DtlsTransport packet extensions.
 * @param fingerprintPEs Fingerprint packet extensions.
 */
public void sendAcceptPacket(Map<MediaType,Map<MediaFormat,Byte>> formatAndPTs,Map<MediaType,Long> localSsrcs,Map<MediaType,AbstractPacketExtension> transportPEs,Map<MediaType,AbstractPacketExtension> fingerprintPEs){
  logger.debug("String_Node_Str");
  JingleIQ acceptIq=createAcceptPacket(formatAndPTs,localSsrcs,transportPEs,fingerprintPEs);
  connection.sendPacket(acceptIq);
}
Program: 81997
Project: 81997
Buggy source:
/** 
 * Handles control packet.
 * @param data raw packet data that arrived on control PPID.
 * @param sid SCTP stream id on which the data has arrived.
 */
private void onCtrlPacket(byte[] data,int sid) throws IOException {
  System.out.print("String_Node_Str");
  for (  byte b : data) {
    System.out.printf("String_Node_Str",b);
  }
  System.out.println();
  ByteBuffer buffer=ByteBuffer.wrap(data);
  int messageType=0xFF & buffer.get();
  if (messageType == MSG_OPEN_CHANNEL) {
    int channelType=0xFF & buffer.get();
    int priority=0xFFFF & buffer.getShort();
    long reliability=0xFFFFFFFFL & buffer.getInt();
    int labelLength=0xFFFF & buffer.getShort();
    int protocolLength=0xFFFF & buffer.getShort();
    String label;
    String protocol;
    if (labelLength == 0) {
      label="String_Node_Str";
    }
 else {
      byte[] labelBytes=new byte[labelLength];
      buffer.get(labelBytes);
      label=new String(labelBytes,"String_Node_Str");
    }
    if (protocolLength == 0) {
      protocol="String_Node_Str";
    }
 else {
      byte[] protocolBytes=new byte[protocolLength];
      buffer.get(protocolBytes);
      protocol=new String(protocolBytes,"String_Node_Str");
    }
    System.out.println("String_Node_Str" + "String_Node_Str" + sid + "String_Node_Str"+ channelType+ "String_Node_Str"+ priority+ "String_Node_Str"+ reliability+ "String_Node_Str"+ label+ "String_Node_Str"+ protocol);
    sendOpenChannelAck(sid);
  }
}

Fixed version (ground truth):
/** 
 * Handles control packet.
 * @param data raw packet data that arrived on control PPID.
 * @param sid SCTP stream id on which the data has arrived.
 */
private void onCtrlPacket(byte[] data,int sid) throws IOException {
  ByteBuffer buffer=ByteBuffer.wrap(data);
  int messageType=0xFF & buffer.get();
  if (messageType == MSG_OPEN_CHANNEL) {
    int channelType=0xFF & buffer.get();
    int priority=0xFFFF & buffer.getShort();
    long reliability=0xFFFFFFFFL & buffer.getInt();
    int labelLength=0xFFFF & buffer.getShort();
    int protocolLength=0xFFFF & buffer.getShort();
    String label;
    String protocol;
    if (labelLength == 0) {
      label="String_Node_Str";
    }
 else {
      byte[] labelBytes=new byte[labelLength];
      buffer.get(labelBytes);
      label=new String(labelBytes,"String_Node_Str");
    }
    if (protocolLength == 0) {
      protocol="String_Node_Str";
    }
 else {
      byte[] protocolBytes=new byte[protocolLength];
      buffer.get(protocolBytes);
      protocol=new String(protocolBytes,"String_Node_Str");
    }
    System.out.println("String_Node_Str" + "String_Node_Str" + sid + "String_Node_Str"+ channelType+ "String_Node_Str"+ priority+ "String_Node_Str"+ reliability+ "String_Node_Str"+ label+ "String_Node_Str"+ protocol);
    sendOpenChannelAck(sid);
  }
}