nus-yam/ex-repair huggingface dataset:
Program: 35283
Project: 35283
Buggy source:
/** 
 * Create a MULTI_CHANNEL_CAPABILITY_GET command.
 * @param nodeId the target node ID
 * @param endPoint the endpoint ID
 * @return a DataFrame instance
 */
public DataFrame createMultiChannelCapabilityGet(byte nodeId,byte endPoint){
  if (getVersion() < 2) {
    throw new RuntimeException("String_Node_Str");
  }
  return createSendDataFrame("String_Node_Str",nodeId,new byte[]{MultiInstanceCommandClass.ID,MULTI_CHANNEL_CAPABILITY_GET,endPoint},true);
}

Fixed version (ground truth):
/** 
 * Create a MULTI_CHANNEL_CAPABILITY_GET command.
 * @param nodeId the target node ID
 * @param endPoint the endpoint ID
 * @return a DataFrame instance
 */
public DataFrame createMultiChannelCapabilityGet(byte nodeId,byte endPoint){
  if (getVersion() < 2) {
    throw new ZWaveRuntimeException("String_Node_Str");
  }
  return createSendDataFrame("String_Node_Str",nodeId,new byte[]{MultiInstanceCommandClass.ID,MULTI_CHANNEL_CAPABILITY_GET,endPoint},true);
}
Program: 35284
Project: 35284
Buggy source:
/** 
 * Create a MULTI_CHANNEL_END_POINT_GET command.
 * @param nodeId the target node ID
 * @return a DataFrame instance
 */
public DataFrame createMultiChannelEndPointGet(byte nodeId){
  if (getVersion() < 2) {
    throw new RuntimeException("String_Node_Str");
  }
  return createSendDataFrame("String_Node_Str",nodeId,new byte[]{MultiInstanceCommandClass.ID,MULTI_CHANNEL_END_POINT_GET},true);
}

Fixed version (ground truth):
/** 
 * Create a MULTI_CHANNEL_END_POINT_GET command.
 * @param nodeId the target node ID
 * @return a DataFrame instance
 */
public DataFrame createMultiChannelEndPointGet(byte nodeId){
  if (getVersion() < 2) {
    throw new ZWaveRuntimeException("String_Node_Str");
  }
  return createSendDataFrame("String_Node_Str",nodeId,new byte[]{MultiInstanceCommandClass.ID,MULTI_CHANNEL_END_POINT_GET},true);
}
Program: 35285
Project: 35285
Buggy source:
public DataFrame createMultiChannelCommandEncapsulation(byte sourceEndpoint,byte destEndpoint,DataFrame command,boolean responseExpected){
  if (getVersion() < 2) {
    throw new RuntimeException("String_Node_Str");
  }
  if (command instanceof SendData) {
    SendData sd=(SendData)command;
    byte[] data=sd.getSendData();
    byte[] newData=new byte[data.length + 4];
    newData[0]=MultiInstanceCommandClass.ID;
    newData[1]=MULTI_CHANNEL_CMD_ENCAP;
    newData[2]=sourceEndpoint;
    newData[3]=destEndpoint;
    System.arraycopy(data,0,newData,4,data.length);
    return createSendDataFrame("String_Node_Str",sd.getNodeId(),newData,responseExpected);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public DataFrame createMultiChannelCommandEncapsulation(byte sourceEndpoint,byte destEndpoint,DataFrame command,boolean responseExpected){
  if (getVersion() < 2) {
    throw new ZWaveRuntimeException("String_Node_Str");
  }
  if (command instanceof SendData) {
    SendData sd=(SendData)command;
    byte[] data=sd.getSendData();
    byte[] newData=new byte[data.length + 4];
    newData[0]=MultiInstanceCommandClass.ID;
    newData[1]=MULTI_CHANNEL_CMD_ENCAP;
    newData[2]=sourceEndpoint;
    newData[3]=destEndpoint;
    System.arraycopy(data,0,newData,4,data.length);
    return createSendDataFrame("String_Node_Str",sd.getNodeId(),newData,responseExpected);
  }
 else {
    throw new ZWaveRuntimeException("String_Node_Str");
  }
}
Program: 35286
Project: 35286
Buggy source:
@Override public DataFrameTransaction createTransaction(ZWaveChannelContext ctx,boolean listeningNode){
  return new SendDataTransaction(ctx,this,listeningNode,isResponseExpected);
}

Fixed version (ground truth):
@Override public DataFrameTransaction createTransaction(ZWaveChannelContext ctx,boolean listeningNode){
  return new SendDataTransaction(ctx,this,listeningNode,responseExpected);
}
Program: 35287
Project: 35287
Buggy source:
@Override public void sendDataFrame(DataFrame d){
  DataFrame ed=micc.createMultiChannelCommandEncapsulation((byte)0,destEndpoint,d,true);
  if (ed == null) {
    ed=d;
  }
  context.sendDataFrame(ed);
}

Fixed version (ground truth):
@Override public void sendDataFrame(DataFrame d){
  boolean responseExpected=(d instanceof SendData) && ((SendData)d).isResponseExpected();
  DataFrame ed=micc.createMultiChannelCommandEncapsulation((byte)0,destEndpoint,d,responseExpected);
  if (ed == null) {
    ed=d;
  }
  context.sendDataFrame(ed);
}
Program: 35288
Project: 35288
Buggy source:
/** 
 * Stops the controller (i.e. stop processing events).
 */
void stop();

Fixed version (ground truth):
/** 
 * Stops the controller (i.e. stop processing events).
 */
void stop() throws InterruptedException ;
Program: 35290
Project: 35290
Buggy source:
@Override public void stop(){
}

Fixed version (ground truth):
@Override public void stop() throws InterruptedException {
  store.close();
  eventLoopGroup.shutdownGracefully().sync();
}
Program: 35291
Project: 35291
Buggy source:
/** 
 * Creates a Z-Wave DataFrame from a ByteBuf.
 * @param buf the buffer to process
 * @return a DataFrame instance (or null if a valid one wasn't found)
 */
protected DataFrame createDataFrame(ByteBuf buf){
  if (buf.readableBytes() > 3) {
    byte messageType=buf.getByte(buf.readerIndex() + 3);
switch (messageType) {
case Version.ID:
      return new Version(buf);
case MemoryGetId.ID:
    return new MemoryGetId(buf);
case InitData.ID:
  return new InitData(buf);
case NodeProtocolInfo.ID:
return new NodeProtocolInfo(buf);
case SendData.ID:
return new SendData(buf);
case ApplicationCommand.ID:
return new ApplicationCommand(buf);
case ApplicationUpdate.ID:
return new ApplicationUpdate(buf);
case RequestNodeInfo.ID:
return new RequestNodeInfo(buf);
case GetRoutingInfo.ID:
return new GetRoutingInfo(buf);
case GetSUCNodeId.ID:
return new GetSUCNodeId(buf);
}
}
return null;
}

Fixed version (ground truth):
/** 
 * Creates a Z-Wave DataFrame from a ByteBuf.
 * @param buf the buffer to process
 * @return a DataFrame instance (or null if a valid one wasn't found)
 */
private DataFrame createDataFrame(ByteBuf buf){
  if (buf.readableBytes() > 3) {
    byte messageType=buf.getByte(buf.readerIndex() + 3);
switch (messageType) {
case Version.ID:
      return new Version(buf);
case MemoryGetId.ID:
    return new MemoryGetId(buf);
case InitData.ID:
  return new InitData(buf);
case NodeProtocolInfo.ID:
return new NodeProtocolInfo(buf);
case SendData.ID:
return new SendData(buf);
case ApplicationCommand.ID:
return new ApplicationCommand(buf);
case ApplicationUpdate.ID:
return new ApplicationUpdate(buf);
case RequestNodeInfo.ID:
return new RequestNodeInfo(buf);
case GetRoutingInfo.ID:
return new GetRoutingInfo(buf);
case GetSUCNodeId.ID:
return new GetSUCNodeId(buf);
}
}
return null;
}
Program: 35292
Project: 35292
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  logger.debug("String_Node_Str",ByteUtil.createString(in));
  ByteBuf data;
  if (previousBuf != null) {
    CompositeByteBuf cbuf=Unpooled.compositeBuffer();
    cbuf.addComponent(previousBuf);
    cbuf.addComponent(in);
    cbuf.writerIndex(previousBuf.readableBytes() + in.readableBytes());
    data=cbuf;
    previousBuf=null;
  }
 else {
    data=in;
  }
  while (data.readableBytes() > 0) {
switch (state) {
case WAITING_FOR_DATA_FRAME_START:
      if (!lookForDataFrameStart(data,out)) {
        return;
      }
    this.state=State.READ_DATA_FRAME_LENGTH;
case READ_DATA_FRAME_LENGTH:
  if (data.readableBytes() < 1) {
    return;
  }
currentDataFrameLength=data.getByte(data.readerIndex() + 1);
this.state=State.WAITING_FOR_DATA_FRAME_DATA;
case WAITING_FOR_DATA_FRAME_DATA:
if (data.readableBytes() < currentDataFrameLength + 2) {
logger.trace("String_Node_Str");
if (data.readableBytes() > 0) {
logger.trace("String_Node_Str");
previousBuf=data;
}
return;
}
currentDataFrame=createDataFrame(data);
this.state=State.READ_DATA_FRAME_CHECKSUM;
case READ_DATA_FRAME_CHECKSUM:
if (data.readableBytes() < 1) {
return;
}
byte checksum=data.readByte();
if (currentDataFrame != null) {
logger.debug("String_Node_Str",currentDataFrame);
out.add(currentDataFrame);
}
resetDecoder();
}
}
logger.trace("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",ByteUtil.createString(in));
  }
  ByteBuf data;
  if (previousBuf != null) {
    CompositeByteBuf cbuf=Unpooled.compositeBuffer();
    cbuf.addComponent(previousBuf);
    cbuf.addComponent(in);
    cbuf.writerIndex(previousBuf.readableBytes() + in.readableBytes());
    data=cbuf;
    previousBuf=null;
  }
 else {
    data=in;
  }
  while (data.isReadable()) {
    if (data.readableBytes() == 1 && isSingleByteFrame(data,data.readerIndex())) {
      out.add(createSingleByteFrame(data));
    }
 else {
      boolean foundFrame=false;
      for (int searchStartIx=data.readerIndex(); searchStartIx < data.readerIndex() + data.readableBytes(); searchStartIx++) {
        if (data.getByte(searchStartIx) == DataFrame.START_OF_FRAME) {
          int frameEndIx=scanForFrame(data,searchStartIx);
          if (frameEndIx > 0) {
            if (searchStartIx > data.readerIndex() && isSingleByteFrame(data,searchStartIx - 1)) {
              data.readerIndex(searchStartIx - 1);
              out.add(createSingleByteFrame(data));
            }
 else {
              data.readerIndex(searchStartIx);
            }
            out.add(createDataFrame(data));
            data.readByte();
            foundFrame=true;
          }
        }
      }
      if (!foundFrame) {
        break;
      }
    }
  }
  if (data.readableBytes() > 0) {
    previousBuf=data;
  }
  logger.trace("String_Node_Str");
}
Program: 35293
Project: 35293
Buggy source:
@Test public void testPartialMessage() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x06,0x01,0x10,0x01});
  decoder.decode(null,in,out);
  assertEquals(1,in.readerIndex());
  assertEquals(0x01,in.getByte(in.readerIndex()));
  assertEquals(1,out.size());
  in=wrappedBuffer(new byte[]{0x01,0x10,0x01,0x15,0x5A,0x2D,0x57,0x61,0x76,0x65,0x20,0x32,0x2E,0x37,0x38,0x00,0x01,(byte)0x9B});
  decoder.decode(null,in,out);
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ACK);
  assertTrue(out.get(1) instanceof Version);
}

Fixed version (ground truth):
@Test public void testPartialMessage() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  ByteBuf in=wrappedBuffer(new byte[]{0x06,0x01,0x10,0x01});
  decoder.decode(null,in,out);
  assertEquals(0,in.readerIndex());
  assertEquals(0,out.size());
  in=wrappedBuffer(new byte[]{0x15,0x5A,0x2D,0x57,0x61,0x76,0x65,0x20,0x32,0x2E,0x37,0x38,0x00,0x01,(byte)0x9B});
  decoder.decode(null,in,out);
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ACK);
  assertTrue(out.get(1) instanceof Version);
}
Program: 35294
Project: 35294
Buggy source:
public void onDataFrameTransactionComplete(){
  logger.trace("String_Node_Str");
  ZWaveDataFrameTransactionInboundHandler transactionHandler=(ZWaveDataFrameTransactionInboundHandler)context.pipeline().get("String_Node_Str");
  if (pendingQueue.size() > 0) {
    DataFrame frame=pendingQueue.pop();
    logger.trace("String_Node_Str",frame);
    context.writeAndFlush(frame);
    frame.incremenentSendCount();
    transactionHandler.onDataFrameWrite(frame);
  }
 else {
    logger.trace("String_Node_Str");
  }
}

Fixed version (ground truth):
public void onDataFrameTransactionComplete(){
  logger.trace("String_Node_Str");
  ZWaveDataFrameTransactionInboundHandler transactionHandler=(ZWaveDataFrameTransactionInboundHandler)context.pipeline().get("String_Node_Str");
  if (pendingQueue.size() > 0) {
    FrameWrite fw=pendingQueue.pop();
    logger.trace("String_Node_Str",fw.frame);
    context.writeAndFlush(fw.frame,fw.promise);
    fw.frame.incremenentSendCount();
    transactionHandler.onDataFrameWrite(fw.frame);
  }
 else {
    logger.trace("String_Node_Str");
  }
}
Program: 35295
Project: 35295
Buggy source:
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  logger.trace("String_Node_Str" + msg);
  if (msg instanceof DataFrame) {
    ZWaveDataFrameTransactionInboundHandler transactionHandler=(ZWaveDataFrameTransactionInboundHandler)ctx.pipeline().get("String_Node_Str");
    if (transactionHandler != null) {
      DataFrame frame=(DataFrame)msg;
      if (transactionHandler.hasCurrentRequestTransaction()) {
        logger.trace("String_Node_Str" + frame + "String_Node_Str"+ pendingQueue.size());
        pendingQueue.add(frame);
      }
 else {
        logger.trace("String_Node_Str",frame);
        ctx.writeAndFlush(msg,promise);
        frame.incremenentSendCount();
        transactionHandler.onDataFrameWrite(frame);
      }
    }
 else {
      logger.error("String_Node_Str");
    }
  }
 else {
    ctx.writeAndFlush(msg,promise);
  }
}

Fixed version (ground truth):
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  logger.trace("String_Node_Str" + msg);
  if (msg instanceof DataFrame) {
    ZWaveDataFrameTransactionInboundHandler transactionHandler=(ZWaveDataFrameTransactionInboundHandler)ctx.pipeline().get("String_Node_Str");
    if (transactionHandler != null) {
      DataFrame frame=(DataFrame)msg;
      if (transactionHandler.hasCurrentRequestTransaction()) {
        logger.trace("String_Node_Str" + frame + "String_Node_Str"+ pendingQueue.size());
        pendingQueue.add(new FrameWrite(frame,promise));
      }
 else {
        logger.trace("String_Node_Str",frame);
        ctx.writeAndFlush(msg,promise);
        frame.incremenentSendCount();
        transactionHandler.onDataFrameWrite(frame);
      }
    }
 else {
      logger.error("String_Node_Str");
    }
  }
 else {
    ctx.writeAndFlush(msg,promise);
  }
}
Program: 35297
Project: 35297
Buggy source:
@Test public void testExtraneousPrefixBytes() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x02,0x03,0x04,0x01,0x05,0x00,0x13,0x02,0x00,(byte)0xeb});
  decoder.decode(null,in,out);
  assertEquals(1,out.size());
  assertTrue(out.get(0) instanceof SendData);
  SendData sd=(SendData)out.get(0);
  assertTrue(sd.hasCallbackId());
  assertEquals(Byte.valueOf((byte)0x02),sd.getCallbackId());
  assertEquals(DataFrameType.REQUEST,sd.getType());
}

Fixed version (ground truth):
@Test public void testExtraneousPrefixBytes() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  ByteBuf in=wrappedBuffer(new byte[]{0x02,0x03,0x04,0x01,0x05,0x00,0x13,0x02,0x00,(byte)0xeb});
  assertEquals(10,in.readableBytes());
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(1,out.size());
  assertTrue(out.get(0) instanceof SendData);
  SendData sd=(SendData)out.get(0);
  assertTrue(sd.hasCallbackId());
  assertEquals(Byte.valueOf((byte)0x02),sd.getCallbackId());
  assertEquals(DataFrameType.REQUEST,sd.getType());
}
Program: 35298
Project: 35298
Buggy source:
@Test public void testPartialMessage() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  ByteBuf in=wrappedBuffer(new byte[]{0x06,0x01,0x10,0x01});
  decoder.decode(null,in,out);
  assertEquals(0,in.readerIndex());
  assertEquals(0,out.size());
  in=wrappedBuffer(new byte[]{0x15,0x5A,0x2D,0x57,0x61,0x76,0x65,0x20,0x32,0x2E,0x37,0x38,0x00,0x01,(byte)0x9B});
  decoder.decode(null,in,out);
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ACK);
  assertTrue(out.get(1) instanceof Version);
}

Fixed version (ground truth):
@Test public void testPartialMessage() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  ByteBuf in=wrappedBuffer(new byte[]{0x06,0x01,0x10,0x01});
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(0,out.size());
  in=wrappedBuffer(new byte[]{0x15,0x5A,0x2D,0x57,0x61,0x76,0x65,0x20,0x32,0x2E,0x37,0x38,0x00,0x01,(byte)0x9B});
  assertEquals(15,in.readableBytes());
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ACK);
  assertTrue(out.get(1) instanceof Version);
}
Program: 35299
Project: 35299
Buggy source:
@Test public void testTwoFramesAcrossTwoReads() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x01,0x0d,0x00,0x04,0x00,0x0e,0x07,(byte)0x86,0x12,0x06,0x03,0x28,0x03,0x19,0x5c,0x01,0x0d});
  decoder.decode(null,in,out);
  in=wrappedBuffer(new byte[]{0x00,0x04,0x00,0x0e,0x07,(byte)0x86,0x12,0x06,0x03,0x28,0x03,0x19,0x5c});
  decoder.decode(null,in,out);
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ApplicationCommand);
  assertTrue(out.get(1) instanceof ApplicationCommand);
}

Fixed version (ground truth):
@Test public void testTwoFramesAcrossTwoReads() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x01,0x0d,0x00,0x04,0x00,0x0e,0x07,(byte)0x86,0x12,0x06,0x03,0x28,0x03,0x19,0x5c,0x01,0x0d});
  assertEquals(17,in.readableBytes());
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(1,out.size());
  in=wrappedBuffer(new byte[]{0x00,0x04,0x00,0x0e,0x07,(byte)0x86,0x12,0x06,0x03,0x28,0x03,0x19,0x5c});
  assertEquals(13,in.readableBytes());
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(2,out.size());
  assertTrue(out.get(0) instanceof ApplicationCommand);
  assertTrue(out.get(1) instanceof ApplicationCommand);
}
Program: 35300
Project: 35300
Buggy source:
@Test public void testTwoCompleteFramesAtOnce() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  decoder.decode(null,wrappedBuffer(new byte[]{0x01,0x09,0x00,0x13,0x06,0x02,0x25,0x02,0x05,0x01,(byte)0xC2,0x01,0x04,0x01,0x13,0x01,(byte)0xE8}),out);
  assertEquals(2,out.size());
}

Fixed version (ground truth):
@Test public void testTwoCompleteFramesAtOnce() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<>();
  ByteBuf buf=wrappedBuffer(new byte[]{0x01,0x09,0x00,0x13,0x06,0x02,0x25,0x02,0x05,0x01,(byte)0xC2,0x01,0x04,0x01,0x13,0x01,(byte)0xE8});
  assertEquals(17,buf.readableBytes());
  decoder.decode(null,buf,out);
  assertEquals(0,buf.readableBytes());
  assertEquals(2,out.size());
}
Program: 35301
Project: 35301
Buggy source:
@Test public void testRandom2() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x01,0x25,0x01,0x02,0x05,0x00,0x1d,0x01,0x00,0x00,0x00,(byte)0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x02});
  decoder.decode(null,in,out);
}

Fixed version (ground truth):
@Test public void testRandom2() throws Exception {
  ZWaveFrameDecoder decoder=new ZWaveFrameDecoder();
  List<Object> out=new ArrayList<Object>();
  ByteBuf in=wrappedBuffer(new byte[]{0x01,0x25,0x01,0x02,0x05,0x00,0x1d,0x01,0x00,0x00,0x00,(byte)0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x02});
  assertEquals(39,in.readableBytes());
  decoder.decode(null,in,out);
  assertEquals(0,in.readableBytes());
  assertEquals(1,in.refCnt());
}
Program: 35303
Project: 35303
Buggy source:
private void ensureAvailable(long want){
  long need=capacity();
  long used=limit();
  while (want >= (need - used))   need<<=1;
  if (need != capacity()) {
    DirectStore store=(DirectStore)store();
    store.resize(need,false);
    if (address() != store.address()) {
      long pos=position();
      long limit=limit();
      startAddr=store.address();
      positionAddr=startAddr + pos;
      limitAddr=startAddr + limit;
      capacityAddr=startAddr + store.size();
    }
  }
}

Fixed version (ground truth):
private void ensureAvailable(long want){
  long need=capacity();
  long used=limit();
  while (want >= (need - used))   need<<=1;
  if (need != capacity()) {
    DirectStore store=(DirectStore)store();
    store.resize(need,false);
    if (address() != store.address()) {
      long pos=position();
      long limit=limit();
      startAddr=store.address();
      positionAddr=startAddr + pos;
      limitAddr=startAddr + limit;
    }
    capacityAddr=startAddr + store.size();
  }
}
Program: 35304
Project: 35304
Buggy source:
public Buf(){
  super(new DirectStore(BUF_INIT_SIZE),new AtomicInteger(1));
  writeByte(0,0);
}

Fixed version (ground truth):
Buf(){
  super(new DirectStore(BUF_INIT_SIZE),new AtomicInteger(1));
  writeByte(0,0);
}
Program: 35305
Project: 35305
Buggy source:
void reset(){
  bufInUse=false;
  buf.clear();
  error=null;
  outBuf=null;
  outPos=outLen=0;
}

Fixed version (ground truth):
void reset(){
  bufInUse=false;
  buf.reset();
  error=null;
  outBuf=null;
  outPos=outLen=0;
}
Program: 35306
Project: 35306
Buggy source:
private void test(String json){
  StringWriter stringWriter=new StringWriter();
  JsonParser p=JsonParser.builder().applyAdapter(new WriterAdapter(stringWriter)).build();
  try {
    p.parse(new ByteBufferBytes(ByteBuffer.wrap(json.getBytes("String_Node_Str"))));
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
  p.close();
  com.google.gson.JsonParser parser=new com.google.gson.JsonParser();
  JsonElement o1=parser.parse(json);
  JsonElement o2=parser.parse(stringWriter.toString());
  assertEquals(o1,o2);
}

Fixed version (ground truth):
private void test(String json){
  testSimple(json);
  testPull(json);
}
Program: 35307
Project: 35307
Buggy source:
/** 
 * Start the controller using the prefered SamplingRate on the list of predictor
 * @param samplingType one of: HOLDOUT, RANDOMSAMPLING, KFOLD
 * @param param The parameter associated with the sampling type
 * @param showDatasetStats show statistics about the dataset
 */
public void Start(int samplingType,float param,boolean showDatasetStats){
  List<String> statsColumns=new ArrayList<String>();
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  List<String> predictorNames=new ArrayList<String>();
  for (  Predictor predictor : predictors) {
    predictorNames.add(predictor.getTAG());
  }
  for (int i=0; i < datasets.size(); i++) {
    int maxCount=datasetsMaxCount.get(i);
    Format format=datasets.get(i);
    database.loadDataset(format,maxCount,true);
    ProfileManager.loadProfileByName(format.toString());
    stats=new StatsLogger(statsColumns,predictorNames,false);
    startTime=System.currentTimeMillis();
    for (int id=0; id < predictors.size(); id++) {
switch (samplingType) {
case HOLDOUT:
        Holdout(param,id);
      break;
case KFOLD:
    KFold((int)param,id);
  break;
case RANDOMSAMPLING:
RandomSubSampling(param,id);
break;
default :
System.out.println("String_Node_Str");
}
}
endTime=System.currentTimeMillis();
displayStats(true);
}
}

Fixed version (ground truth):
/** 
 * Start the controller using the prefered SamplingRate on the list of predictor
 * @param samplingType one of: HOLDOUT, RANDOMSAMPLING, KFOLD
 * @param param The parameter associated with the sampling type
 * @param showDatasetStats show statistics about the dataset
 */
public void Start(int samplingType,float param,boolean showDatasetStats){
  List<String> statsColumns=new ArrayList<String>();
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  statsColumns.add("String_Node_Str");
  List<String> predictorNames=new ArrayList<String>();
  for (  Predictor predictor : predictors) {
    predictorNames.add(predictor.getTAG());
  }
  for (int i=0; i < datasets.size(); i++) {
    int maxCount=datasetsMaxCount.get(i);
    Format format=datasets.get(i);
    ProfileManager.loadProfileByName(format.toString());
    database.loadDataset(format,maxCount,true);
    stats=new StatsLogger(statsColumns,predictorNames,false);
    startTime=System.currentTimeMillis();
    for (int id=0; id < predictors.size(); id++) {
switch (samplingType) {
case HOLDOUT:
        Holdout(param,id);
      break;
case KFOLD:
    KFold((int)param,id);
  break;
case RANDOMSAMPLING:
RandomSubSampling(param,id);
break;
default :
System.out.println("String_Node_Str");
}
}
endTime=System.currentTimeMillis();
displayStats(true);
}
}
Program: 35308
Project: 35308
Buggy source:
@Override public Boolean Train(List<Sequence> trainingSequences){
  for (  Sequence seq : trainingSequences) {
    state.clear();
    state.add(root);
    for (    Item item : seq.getItems()) {
      List<Node> newState=new ArrayList<Node>();
      newState.add(root);
      for (      Node node : state) {
        if (node.pathFromRoot.size() <= maxTreeHeight) {
          Node child=node.addChild(item.val);
          size++;
          dictionnary.put(child.pathFromRoot,child);
          newState.add(child);
        }
      }
      state=newState;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public Boolean Train(List<Sequence> trainingSequences){
  root=new Node(0,new ArrayList<Integer>());
  size=1;
  state=new ArrayList<Node>();
  dictionnary=new HashMap<List<Integer>,Node>();
  for (  Sequence seq : trainingSequences) {
    state.clear();
    state.add(root);
    for (    Item item : seq.getItems()) {
      List<Node> newState=new ArrayList<Node>();
      newState.add(root);
      for (      Node node : state) {
        if (node.pathFromRoot.size() <= maxTreeHeight) {
          Node child=node.addChild(item.val);
          size++;
          dictionnary.put(child.pathFromRoot,child);
          newState.add(child);
        }
      }
      state=newState;
    }
  }
  return true;
}
Program: 35309
Project: 35309
Buggy source:
public synchronized void writeAsync(KineticMessage message,Object context) throws IOException, InterruptedException {
  this.client.finalizeHeader(message);
  Long seq=Long.valueOf(message.getCommand().getHeader().getSequence());
  while (this.ackmap.size() >= this.asyncQueuedSize && this.isRunning) {
    this.wait();
  }
  this.ackmap.put(seq,context);
  this.doWrite(message);
}

Fixed version (ground truth):
public synchronized void writeAsync(KineticMessage message,Object context) throws IOException, InterruptedException {
  this.client.finalizeHeader(message);
  Long seq=Long.valueOf(message.getCommand().getHeader().getSequence());
  while (ackmap.size() >= asyncQueuedSize && (isClosed == false)) {
    this.wait();
  }
  this.ackmap.put(seq,context);
  this.doWrite(message);
}
Program: 35310
Project: 35310
Buggy source:
private void validatePort(String port){
  if (port == null || port.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(port);
  if (!matcher.find()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void validatePort(String port){
  if (port == null || port.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int portIn;
  try {
    portIn=Integer.parseInt(port);
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException("String_Node_Str" + port);
  }
  if (portIn < MIN_PORT || portIn > MAX_PORT) {
    throw new IllegalArgumentException("String_Node_Str" + port);
  }
}
Program: 35311
Project: 35311
Buggy source:
/** 
 * Set cluster version with the specified version.
 * @param newClusterVersion
 * @throws KineticException
 */
public void setClusterVersion(long newClusterVersion) throws KineticException ;

Fixed version (ground truth):
/** 
 * Set cluster version with the specified version.
 * @param newClusterVersion new cluster version to be set.
 * @throws KineticException if any internal error occurred
 */
public void setClusterVersion(long newClusterVersion) throws KineticException ;
Program: 35312
Project: 35312
Buggy source:
/** 
 * Get the configuration information of the drive <p>
 * @return the configuration information from the drive.
 * @throws KineticException if any internal error occurred.
 * @see DefaultConfiguration
 */
public Configuration getConfiguration() throws KineticException ;

Fixed version (ground truth):
/** 
 * Get the configuration information of the drive <p>
 * @return the configuration information from the drive.
 * @throws KineticException if any internal error occurred.
 * @see Configuration
 */
public Configuration getConfiguration() throws KineticException ;
Program: 35313
Project: 35313
Buggy source:
/** 
 * Set the max message size field content of the limits.
 * @param key the content to be set to the max message size field.
 */
public void setMaxMessageSize(int maxMessageSize){
  this.maxMessageSize=maxMessageSize;
}

Fixed version (ground truth):
/** 
 * Set the max allowed message size.
 * @param maxMessageSize tthe max allowed message size
 */
public void setMaxMessageSize(int maxMessageSize){
  this.maxMessageSize=maxMessageSize;
}
Program: 35314
Project: 35314
Buggy source:
/** 
 * Get the value of max connections.
 * @return the content of the max connections field.
 */
public int getMaxConnections(){
  return maxConnections;
}

Fixed version (ground truth):
/** 
 * Get max allowed concurrent connections.
 * @return max allowed concurrent connections
 */
public int getMaxConnections(){
  return maxConnections;
}
Program: 35315
Project: 35315
Buggy source:
/** 
 * Set the max out standing write requests field content of the limits.
 * @param key the content to be set to the max out standing write requests field.
 */
public void setMaxOutstandingWriteRequests(int maxOutstandingWriteRequests){
  this.maxOutstandingWriteRequests=maxOutstandingWriteRequests;
}

Fixed version (ground truth):
/** 
 * Set max allowed out-standing write requests
 * @param maxOutstandingWriteRequests max allowed out-standing write requests
 */
public void setMaxOutstandingWriteRequests(int maxOutstandingWriteRequests){
  this.maxOutstandingWriteRequests=maxOutstandingWriteRequests;
}
Program: 35316
Project: 35316
Buggy source:
/** 
 * Get the value of max version size.
 * @return the content of the max version size field.
 */
public int getMaxVersionSize(){
  return maxVersionSize;
}

Fixed version (ground truth):
/** 
 * Get max allowed version size.
 * @return max allowed version size.
 */
public int getMaxVersionSize(){
  return maxVersionSize;
}
Program: 35317
Project: 35317
Buggy source:
/** 
 * Get the value of max message size.
 * @return the content of the max message size.
 */
public int getMaxMessageSize(){
  return maxMessageSize;
}

Fixed version (ground truth):
/** 
 * Get max allowed message size.
 * @return max allowed message size
 */
public int getMaxMessageSize(){
  return maxMessageSize;
}
Program: 35318
Project: 35318
Buggy source:
/** 
 * Set the max connections field content of the limits.
 * @param key the content to be set to the max connections field.
 */
public void setMaxConnections(int maxConnections){
  this.maxConnections=maxConnections;
}

Fixed version (ground truth):
/** 
 * Set max allowed concurrent connections
 * @param maxConnections the max allowed concurrent connections
 */
public void setMaxConnections(int maxConnections){
  this.maxConnections=maxConnections;
}
Program: 35319
Project: 35319
Buggy source:
/** 
 * Set the max out standing read requests field content of the limits.
 * @param key the content to be set to the max out standing read requests field.
 */
public void setMaxOutstandingReadRequests(int maxOutstandingReadRequests){
  this.maxOutstandingReadRequests=maxOutstandingReadRequests;
}

Fixed version (ground truth):
/** 
 * Set the max allowed out standing read requests.
 * @param maxOutstandingReadRequests the max allowed out standing read requests
 */
public void setMaxOutstandingReadRequests(int maxOutstandingReadRequests){
  this.maxOutstandingReadRequests=maxOutstandingReadRequests;
}
Program: 35320
Project: 35320
Buggy source:
/** 
 * Set the max tag size field content of the limits.
 * @param key the content to be set to the max tag field.
 */
public void setMaxTagSize(int maxTagSize){
  this.maxTagSize=maxTagSize;
}

Fixed version (ground truth):
/** 
 * Set the max tag size.
 * @param maxTagSize the max tag size
 */
public void setMaxTagSize(int maxTagSize){
  this.maxTagSize=maxTagSize;
}
Program: 35321
Project: 35321
Buggy source:
/** 
 * Set the max value size field content of the limits.
 * @param key the content to be set to the max value size field.
 */
public void setMaxValueSize(int maxValueSize){
  this.maxValueSize=maxValueSize;
}

Fixed version (ground truth):
/** 
 * Set the max allowed value size.
 * @param maxValueSize the max allowed value size.
 */
public void setMaxValueSize(int maxValueSize){
  this.maxValueSize=maxValueSize;
}
Program: 35322
Project: 35322
Buggy source:
/** 
 * Set the max version size field content of the limits.
 * @param key the content to be set to the max version size field.
 */
public void setMaxVersionSize(int maxVersionSize){
  this.maxVersionSize=maxVersionSize;
}

Fixed version (ground truth):
/** 
 * Set the max allowed version size.
 * @param maxVersionSize the max allowed version size.
 */
public void setMaxVersionSize(int maxVersionSize){
  this.maxVersionSize=maxVersionSize;
}
Program: 35323
Project: 35323
Buggy source:
/** 
 * Get the value of max key range size.
 * @return the content of the max key range size.
 */
public int getMaxKeyRangeCount(){
  return maxKeyRangeCount;
}

Fixed version (ground truth):
/** 
 * Get max allowed number of keys can be returned from getKeyRange.
 * @return max allowed number of keys can be returned from getKeyRange.
 */
public int getMaxKeyRangeCount(){
  return maxKeyRangeCount;
}
Program: 35324
Project: 35324
Buggy source:
/** 
 * Get the value of max out standing write requests.
 * @return the content of the max out standing write requests field.
 */
public int getMaxOutstandingWriteRequests(){
  return maxOutstandingWriteRequests;
}

Fixed version (ground truth):
/** 
 * Get max allowed out-standing write requests.
 * @return tmax allowed out-standing write requests.
 */
public int getMaxOutstandingWriteRequests(){
  return maxOutstandingWriteRequests;
}
Program: 35325
Project: 35325
Buggy source:
/** 
 * Set the max key size field content of the limits.
 * @param key the content to be set to the max key size field.
 */
public void setMaxKeySize(int maxKeySize){
  this.maxKeySize=maxKeySize;
}

Fixed version (ground truth):
/** 
 * Set the max allowed key size.
 * @param maxKeySize the max allowed key size.
 */
public void setMaxKeySize(int maxKeySize){
  this.maxKeySize=maxKeySize;
}
Program: 35326
Project: 35326
Buggy source:
/** 
 * Set the max key range size field content of the limits.
 * @param key the content to be set to the max key range size field.
 */
public void setMaxKeyRangeCount(int maxKeyRangeCount){
  this.maxKeyRangeCount=maxKeyRangeCount;
}

Fixed version (ground truth):
/** 
 * Set max allowed number of keys can be returned from getKeyRange.
 * @param maxKeyRangeCount max allowed number of keys can be returned from getKeyRange.
 */
public void setMaxKeyRangeCount(int maxKeyRangeCount){
  this.maxKeyRangeCount=maxKeyRangeCount;
}
Program: 35327
Project: 35327
Buggy source:
/** 
 * Get callback result. <p> The Param Type <T> matches the corresponding return type for its synchronous API variation. For example, a  {@link KineticClient#putForced(Entry)} operation would have aCallbackResult of type  {@link Entry}.
 * @return the result instance corresponding to the asynchronous request.
 */
public T getResult();

Fixed version (ground truth):
/** 
 * Get callback result. <p> The Param Type matches the corresponding return type for its synchronous API variation. For example, a  {@link KineticClient#putForced(Entry)} operation would have aCallbackResult of type  {@link Entry}.
 * @return the result instance corresponding to the asynchronous request.
 */
public T getResult();
Program: 35328
Project: 35328
Buggy source:
/** 
 * Generic kinetic asynchronous request operation. This is a variation of the   {@link #request(com.seagate.kinetic.proto.Kinetic.Message.Builder)}API. <p>
 * @param requestMessage the request message to the kinetic service.
 * @param callback Kinetic client runtime invokes the CallbackHandler.onSuccess() when a successful request's response message is available. CallbackHandler.onError(KineticException e) is invoked if any internal error occurs.
 * @param < T > The type must be consistent with the corresponding synchronous request method's return type. For example, for an asynchronous get request, the parameter specified must be an <code>Entry</code> type.
 * @throws KineticException if any internal error occurred.
 * @see #request(KineticMessage)
 * @see CallbackHandler
 * @see CallbackResult
 */
public <T>void requestAsync(KineticMessage requestMessage,CallbackHandler<T> callback) throws KineticException ;

Fixed version (ground truth):
/** 
 * Generic kinetic asynchronous request operation. <p>
 * @param requestMessage the request message to the kinetic service.
 * @param callback Kinetic client runtime invokes the CallbackHandler.onSuccess() when a successful request's response message is available. CallbackHandler.onError(KineticException e) is invoked if any internal error occurs.
 * @param < T > The type must be consistent with the corresponding synchronous request method's return type. For example, for an asynchronous get request, the parameter specified must be an <code>Entry</code> type.
 * @throws KineticException if any internal error occurred.
 * @see #request(KineticMessage)
 * @see CallbackHandler
 * @see CallbackResult
 */
public <T>void requestAsync(KineticMessage requestMessage,CallbackHandler<T> callback) throws KineticException ;
Program: 35329
Project: 35329
Buggy source:
/** 
 * Create a new instance of <code>BatchOperation</code> object. <p> Please note that this API is only supported by the simulator and Drive that implement Kinetic protocol 3.0.6 and later.
 * @return a new instance of <code>BatchOperation</code> object.
 * @since protocol version 3.0.6
 */
public BatchOperation createBatchOperation() throws KineticException ;

Fixed version (ground truth):
/** 
 * Create a new instance of <code>BatchOperation</code> object. <p> Please note that this API is only supported by the simulator and Drive that implement Kinetic protocol 3.0.6 and later.
 * @return a new instance of <code>BatchOperation</code> object.
 * @since protocol version 3.0.6
 * @throws KineticException if any internal error occurred.
 */
public BatchOperation createBatchOperation() throws KineticException ;
Program: 35330
Project: 35330
Buggy source:
@SuppressWarnings("String_Node_Str") public synchronized void init(RequestContext context) throws InvalidBatchException, InvalidRequestException {
  if (this.batch != null) {
    throw new InvalidRequestException("String_Node_Str");
  }
  this.context=context;
  this.cid=context.getRequestMessage().getCommand().getHeader().getConnectionID();
  this.batchId=context.getRequestMessage().getCommand().getHeader().getBatchID();
  try {
    batch=engine.getStore().createBatchOperation();
  }
 catch (  KVStoreException e) {
    throw new InvalidBatchException(e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public synchronized void init(RequestContext context) throws InvalidBatchException, InvalidRequestException {
  if (this.batch != null) {
    this.waitForBatchToFinish();
  }
  this.context=context;
  this.cid=context.getRequestMessage().getCommand().getHeader().getConnectionID();
  this.batchId=context.getRequestMessage().getCommand().getHeader().getBatchID();
  try {
    batch=engine.getStore().createBatchOperation();
  }
 catch (  KVStoreException e) {
    throw new InvalidBatchException(e);
  }
}
Program: 35331
Project: 35331
Buggy source:
private synchronized void waitForBatchToFinish(){
  long timeout=0;
  long period=3000;
  while (batch != null) {
    try {
      this.wait(period);
      if (batch == null) {
        return;
      }
      timeout+=period;
      if (timeout >= MAX_TIME_OUT) {
        throw new RuntimeException("String_Node_Str");
      }
 else {
        logger.warning("String_Node_Str" + timeout);
      }
    }
 catch (    InterruptedException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
private synchronized void waitForBatchToFinish(){
  long totalWaitTime=0;
  long period=3000;
  long start=System.currentTimeMillis();
  while (batch != null) {
    try {
      this.wait(period);
      if (batch == null) {
        return;
      }
      totalWaitTime=(System.currentTimeMillis() - start);
      if (totalWaitTime >= MAX_TIME_OUT) {
        throw new RuntimeException("String_Node_Str");
      }
 else {
        logger.warning("String_Node_Str" + totalWaitTime);
      }
    }
 catch (    InterruptedException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
    }
  }
}
Program: 35332
Project: 35332
Buggy source:
@Override protected void encode(ChannelHandlerContext ctx,KineticMessage km,ByteBuf out) throws Exception {
  try {
    byte[] value=km.getValue();
    out.writeByte((byte)'F');
    Message.Builder builder=(Builder)km.getMessage();
    Message msg=builder.build();
    byte[] protoMessageBytes=msg.toByteArray();
    out.writeInt(protoMessageBytes.length);
    if (value != null) {
      out.writeInt(value.length);
    }
 else {
      out.writeInt(0);
    }
    out.writeBytes(protoMessageBytes);
    if (value != null && value.length > 0) {
      out.writeBytes(value);
    }
    if (printMessage) {
      logger.info("String_Node_Str");
      String printMsg=ProtocolMessageUtil.toString(msg,value.length);
      logger.info(printMsg);
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    throw e;
  }
}

Fixed version (ground truth):
@Override protected void encode(ChannelHandlerContext ctx,KineticMessage km,ByteBuf out) throws Exception {
  try {
    byte[] value=km.getValue();
    out.writeByte((byte)'F');
    Message.Builder builder=(Builder)km.getMessage();
    Message msg=builder.build();
    byte[] protoMessageBytes=msg.toByteArray();
    out.writeInt(protoMessageBytes.length);
    if (value != null) {
      out.writeInt(value.length);
    }
 else {
      out.writeInt(0);
    }
    out.writeBytes(protoMessageBytes);
    if (value != null && value.length > 0) {
      out.writeBytes(value);
    }
    if (printMessage) {
      logger.info("String_Node_Str");
      int len=0;
      if (value != null) {
        len=value.length;
      }
      String printMsg=ProtocolMessageUtil.toString(msg,len);
      logger.info(printMsg);
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    throw e;
  }
}
Program: 35333
Project: 35333
Buggy source:
@Factory public Object[] allTests(){
  return new Object[]{new UUIDTest(),new IntegerArrayTest()};
}

Fixed version (ground truth):
@Factory public Object[] allTests(){
  return new Object[]{new UUIDTest(),new IntegerArrayTest(),new BigIntArrayTest()};
}
Program: 35334
Project: 35334
Buggy source:
public static void setWebDriver(WebDriver driver){
  DriverManager.driver.set(driver);
}

Fixed version (ground truth):
public static void setWebDriver(WebDriver driver){
  driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
  DriverManager.driver.set(driver);
}
Program: 35335
Project: 35335
Buggy source:
/** 
 * List the dependencies of the given element.
 * @param computationElement Computation element to prepare.
 * @param model Model of the current container.
 */
private void prepareForComputationElement(final ComputationElementDTO computationElement,final IsModel model){
  final Computation computation=computationElement.getComputationForModel(model);
  computations.put(computationElement,computation);
  for (  final Dependency dependency : computation.getDependencies()) {
    List<ComputationElementDTO> list=dependencies.get(((SingleDependency)dependency).getFlexibleElement());
    if (list == null) {
      list=new ArrayList<ComputationElementDTO>();
      if (dependency instanceof SingleDependency) {
        dependencies.put(((SingleDependency)dependency).getFlexibleElement(),list);
      }
    }
    list.add(computationElement);
  }
}

Fixed version (ground truth):
/** 
 * List the dependencies of the given element.
 * @param computationElement Computation element to prepare.
 * @param model Model of the current container.
 */
private void prepareForComputationElement(final ComputationElementDTO computationElement,final IsModel model){
  final Computation computation=computationElement.getComputationForModel(model);
  computations.put(computationElement,computation);
  for (  final Dependency dependency : computation.getDependencies()) {
    List<ComputationElementDTO> list;
    if (dependency instanceof SingleDependency) {
      list=dependencies.get(((SingleDependency)dependency).getFlexibleElement());
    }
 else     if (dependency instanceof CollectionDependency) {
      list=dependencies.get(((CollectionDependency)dependency).getFlexibleElement());
    }
 else {
      continue;
    }
    if (list == null) {
      list=new ArrayList<ComputationElementDTO>();
      if (dependency instanceof SingleDependency) {
        dependencies.put(((SingleDependency)dependency).getFlexibleElement(),list);
      }
    }
    list.add(computationElement);
  }
}
Program: 35339
Project: 35339
Buggy source:
protected boolean userCanPerformChangeTypeOnContact(ValueEventChangeType changeType,ContactDTO contact){
  return !contact.getContactModel().isUnderMaintenance();
}

Fixed version (ground truth):
protected boolean userCanPerformChangeTypeOnContact(ValueEventChangeType changeType,ContactDTO contact){
  return !contact.getContactModel().isUnderMaintenance() && ProfileUtils.isGranted(auth(),GlobalPermissionEnum.EDIT_VISIBLE_CONTACTS);
}