nus-yam/ex-repair huggingface dataset:
Program: 106796
Project: 106796
Buggy source:
public AgentMonitor(long msId,HostDao hostDao,VMInstanceDao vmDao,DataCenterDao dcDao,HostPodDao podDao,AgentManagerImpl agentMgr,AlertManager alertMgr,long pingTimeout){
  super("String_Node_Str");
  _msId=msId;
  _pingTimeout=pingTimeout;
  _hostDao=hostDao;
  _agentMgr=agentMgr;
  _stop=false;
  _vmDao=vmDao;
  _dcDao=dcDao;
  _podDao=podDao;
  _alertMgr=alertMgr;
  Connection conn=Transaction.getStandaloneConnection();
  if (conn == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  _concierge=new ConnectionConcierge("String_Node_Str",conn,true,true);
}

Fixed version (ground truth):
public AgentMonitor(long msId,HostDao hostDao,VMInstanceDao vmDao,DataCenterDao dcDao,HostPodDao podDao,AgentManagerImpl agentMgr,AlertManager alertMgr,long pingTimeout){
  super("String_Node_Str");
  _msId=msId;
  _pingTimeout=pingTimeout;
  _hostDao=hostDao;
  _agentMgr=agentMgr;
  _stop=false;
  _vmDao=vmDao;
  _dcDao=dcDao;
  _podDao=podDao;
  _alertMgr=alertMgr;
  try {
    Connection conn=Transaction.getStandaloneConnectionWithException();
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,false);
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}
Program: 106797
Project: 106797
Buggy source:
private Connection getHeartbeatConnection() throws SQLException {
  if (_heartbeatConnection == null) {
    Connection conn=Transaction.getStandaloneConnectionWithException();
    _heartbeatConnection=new ConnectionConcierge("String_Node_Str",conn,false,false);
  }
  return _heartbeatConnection.conn();
}

Fixed version (ground truth):
private Connection getHeartbeatConnection() throws SQLException {
  if (_heartbeatConnection == null) {
    Connection conn=Transaction.getStandaloneConnectionWithException();
    _heartbeatConnection=new ConnectionConcierge("String_Node_Str",conn,false);
  }
  return _heartbeatConnection.conn();
}
Program: 106798
Project: 106798
Buggy source:
public Attribute findAttribute(String name){
  for (  Attribute attr : _attributes) {
    if (attr.columnName.equals(GenericDao.REMOVED) && attr.isUpdatable()) {
      return null;
    }
    if (attr.columnName.equals(name)) {
      return attr;
    }
  }
  return null;
}

Fixed version (ground truth):
public Attribute findAttribute(String name){
  for (  Attribute attr : _attributes) {
    if (attr.columnName.equalsIgnoreCase(name)) {
      if (attr.columnName.equalsIgnoreCase(GenericDao.REMOVED) && attr.isUpdatable()) {
        return null;
      }
      return attr;
    }
  }
  return null;
}
Program: 106799
Project: 106799
Buggy source:
public static ByteBuffer doDecompress(ByteBuffer buffer){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(65535);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}

Fixed version (ground truth):
public static ByteBuffer doDecompress(ByteBuffer buffer,int length){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(length);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}
Program: 106800
Project: 106800
Buggy source:
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  if (tmp.capacity() >= 8192) {
    tmp=doCompress(tmp);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}

Fixed version (ground truth):
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  int capacity=tmp.capacity();
  if (capacity >= 8192) {
    tmp=doCompress(tmp,capacity);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(capacity);
  return buffers;
}
Program: 106801
Project: 106801
Buggy source:
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}

Fixed version (ground truth):
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff,size);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}
Program: 106802
Project: 106802
Buggy source:
public static ByteBuffer doCompress(ByteBuffer buffer){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(65535);
  byte[] array=new byte[buffer.capacity()];
  buffer.get(array);
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,65535);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}

Fixed version (ground truth):
public static ByteBuffer doCompress(ByteBuffer buffer,int length){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(length);
  byte[] array;
  if (buffer.hasArray()) {
    array=buffer.array();
  }
 else {
    array=new byte[buffer.capacity()];
    buffer.get(array);
  }
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,length);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}
Program: 106805
Project: 106805
Buggy source:
public static ByteBuffer doDecompress(ByteBuffer buffer){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(65535);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}

Fixed version (ground truth):
public static ByteBuffer doDecompress(ByteBuffer buffer,int length){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(length);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}
Program: 106806
Project: 106806
Buggy source:
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  if (tmp.capacity() >= 8192) {
    tmp=doCompress(tmp);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}

Fixed version (ground truth):
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  int capacity=tmp.capacity();
  if (capacity >= 8192) {
    tmp=doCompress(tmp,capacity);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(capacity);
  return buffers;
}
Program: 106807
Project: 106807
Buggy source:
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}

Fixed version (ground truth):
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff,size);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}
Program: 106808
Project: 106808
Buggy source:
public static ByteBuffer doCompress(ByteBuffer buffer){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(65535);
  byte[] array=new byte[buffer.capacity()];
  buffer.get(array);
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,65535);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}

Fixed version (ground truth):
public static ByteBuffer doCompress(ByteBuffer buffer,int length){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(length);
  byte[] array;
  if (buffer.hasArray()) {
    array=buffer.array();
  }
 else {
    array=new byte[buffer.capacity()];
    buffer.get(array);
  }
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,length);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}
Program: 106809
Project: 106809
Buggy source:
@Override public void performDataMigration(Connection conn){
}

Fixed version (ground truth):
@Override public void performDataMigration(Connection conn){
  dropKeysIfExist(conn);
}
Program: 106810
Project: 106810
Buggy source:
@Override public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates,Map<Long,Integer> loadInfo,long dataCenterId){
  if (candidates != null) {
    List<ConsoleProxyVO> allocationList=new ArrayList<ConsoleProxyVO>();
    for (    ConsoleProxyVO proxy : candidates) {
      Integer load=loadInfo.get(proxy.getId());
      if (load == null || load < _maxSessionCount) {
        allocationList.add(proxy);
      }
    }
    if (allocationList.size() > 0)     return allocationList.get(_rand.nextInt(allocationList.size()));
  }
  return null;
}

Fixed version (ground truth):
@Override public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates,final Map<Long,Integer> loadInfo,long dataCenterId){
  if (candidates != null) {
    List<ConsoleProxyVO> allocationList=new ArrayList<ConsoleProxyVO>();
    for (    ConsoleProxyVO proxy : candidates) {
      allocationList.add(proxy);
    }
    Collections.sort(candidates,new Comparator<ConsoleProxyVO>(){
      @Override public int compare(      ConsoleProxyVO x,      ConsoleProxyVO y){
        Integer loadOfX=loadInfo.get(x.getId());
        Integer loadOfY=loadInfo.get(y.getId());
        if (loadOfX != null && loadOfY != null) {
          if (loadOfX < loadOfY)           return -1;
 else           if (loadOfX > loadOfY)           return 1;
          return 0;
        }
 else         if (loadOfX == null && loadOfY == null) {
          return 0;
        }
 else {
          if (loadOfX == null)           return -1;
          return 1;
        }
      }
    }
);
    if (allocationList.size() > 0)     return allocationList.get(0);
  }
  return null;
}
Program: 106811
Project: 106811
Buggy source:
@DB protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Transaction txn=Transaction.currentTxn();
  txn.start();
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot);
  createdVolume=volumeDetails.first();
  Long diskOfferingId=volume.getDiskOfferingId();
  if (createdVolume.getPath() != null) {
    Long offeringId=null;
    if (diskOfferingId != null) {
      DiskOfferingVO offering=_diskOfferingDao.findById(diskOfferingId);
      if (offering != null && (offering.getType() == DiskOfferingVO.Type.Disk)) {
        offeringId=offering.getId();
      }
    }
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),offeringId,null,createdVolume.getSize());
    _usageEventDao.persist(usageEvent);
  }
  txn.commit();
  return createdVolume;
}

Fixed version (ground truth):
protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Transaction txn=Transaction.currentTxn();
  txn.start();
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot);
  createdVolume=volumeDetails.first();
  return createdVolume;
}
Program: 106812
Project: 106812
Buggy source:
public static ByteBuffer doDecompress(ByteBuffer buffer){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(65535);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}

Fixed version (ground truth):
public static ByteBuffer doDecompress(ByteBuffer buffer,int length){
  byte[] byteArrayIn=new byte[1024];
  ByteArrayInputStream byteIn;
  if (buffer.hasArray()) {
    byteIn=new ByteArrayInputStream(buffer.array(),buffer.position() + buffer.arrayOffset(),buffer.remaining());
  }
 else {
    byte[] array=new byte[buffer.limit() - buffer.position()];
    buffer.get(array);
    byteIn=new ByteArrayInputStream(array);
  }
  ByteBuffer retBuff=ByteBuffer.allocate(length);
  int len=0;
  try {
    GZIPInputStream in=new GZIPInputStream(byteIn);
    while ((len=in.read(byteArrayIn)) > 0) {
      retBuff.put(byteArrayIn,0,len);
    }
    in.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  retBuff.flip();
  return retBuff;
}
Program: 106813
Project: 106813
Buggy source:
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  if (tmp.capacity() >= 8192) {
    tmp=doCompress(tmp);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}

Fixed version (ground truth):
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  int capacity=tmp.capacity();
  if (capacity >= 8192) {
    tmp=doCompress(tmp,capacity);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(capacity);
  return buffers;
}
Program: 106814
Project: 106814
Buggy source:
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}

Fixed version (ground truth):
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff,size);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}
Program: 106815
Project: 106815
Buggy source:
public static ByteBuffer doCompress(ByteBuffer buffer){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(65535);
  byte[] array=new byte[buffer.capacity()];
  buffer.get(array);
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,65535);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}

Fixed version (ground truth):
public static ByteBuffer doCompress(ByteBuffer buffer,int length){
  ByteArrayOutputStream byteOut=new ByteArrayOutputStream(length);
  byte[] array;
  if (buffer.hasArray()) {
    array=buffer.array();
  }
 else {
    array=new byte[buffer.capacity()];
    buffer.get(array);
  }
  try {
    GZIPOutputStream out=new GZIPOutputStream(byteOut,length);
    out.write(array);
    out.finish();
    out.close();
  }
 catch (  IOException e) {
    s_logger.error("String_Node_Str",e);
  }
  return ByteBuffer.wrap(byteOut.toByteArray());
}
Program: 106816
Project: 106816
Buggy source:
@Override public void performDataMigration(Connection conn){
}

Fixed version (ground truth):
@Override public void performDataMigration(Connection conn){
  dropKeysIfExist(conn);
}
Program: 106817
Project: 106817
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  if (configDao == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  Map<String,String> configs=configDao.getConfiguration();
  String value=configs.get("String_Node_Str");
  _maxSessionCount=NumbersUtil.parseInt(value,ConsoleProxyManager.DEFAULT_PROXY_CAPACITY);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  if (configDao == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  Map<String,String> configs=configDao.getConfiguration();
  return true;
}
Program: 106818
Project: 106818
Buggy source:
@Override public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates,Map<Long,Integer> loadInfo,long dataCenterId){
  if (candidates != null) {
    List<ConsoleProxyVO> allocationList=new ArrayList<ConsoleProxyVO>();
    for (    ConsoleProxyVO proxy : candidates) {
      Integer load=loadInfo.get(proxy.getId());
      if (load == null || load < _maxSessionCount) {
        allocationList.add(proxy);
      }
    }
    if (allocationList.size() > 0)     return allocationList.get(_rand.nextInt(allocationList.size()));
  }
  return null;
}

Fixed version (ground truth):
@Override public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates,final Map<Long,Integer> loadInfo,long dataCenterId){
  if (candidates != null) {
    List<ConsoleProxyVO> allocationList=new ArrayList<ConsoleProxyVO>();
    for (    ConsoleProxyVO proxy : candidates) {
      allocationList.add(proxy);
    }
    Collections.sort(candidates,new Comparator<ConsoleProxyVO>(){
      @Override public int compare(      ConsoleProxyVO x,      ConsoleProxyVO y){
        Integer loadOfX=loadInfo.get(x.getId());
        Integer loadOfY=loadInfo.get(y.getId());
        if (loadOfX != null && loadOfY != null) {
          if (loadOfX < loadOfY)           return -1;
 else           if (loadOfX > loadOfY)           return 1;
          return 0;
        }
 else         if (loadOfX == null && loadOfY == null) {
          return 0;
        }
 else {
          if (loadOfX == null)           return -1;
          return 1;
        }
      }
    }
);
    if (allocationList.size() > 0)     return allocationList.get(0);
  }
  return null;
}
Program: 106819
Project: 106819
Buggy source:
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  if (configDao == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  Map<String,String> configs=configDao.getConfiguration();
  String value=configs.get("String_Node_Str");
  _maxSessionCount=NumbersUtil.parseInt(value,ConsoleProxyManager.DEFAULT_PROXY_CAPACITY);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> params) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  if (configDao == null) {
    throw new ConfigurationException("String_Node_Str");
  }
  Map<String,String> configs=configDao.getConfiguration();
  return true;
}
Program: 106821
Project: 106821
Buggy source:
@Override public DomainResponse createDomainResponse(Domain domain){
  DomainResponse domainResponse=new DomainResponse();
  domainResponse.setDomainName(domain.getName());
  domainResponse.setId(domain.getId());
  domainResponse.setLevel(domain.getLevel());
  domainResponse.setParentDomainId(domain.getParent());
  if (domain.getParent() != null) {
    domainResponse.setParentDomainName(ApiDBUtils.findDomainById(domain.getParent()).getName());
  }
  if (domain.getChildCount() > 0) {
    domainResponse.setHasChild(true);
  }
  domainResponse.setObjectName("String_Node_Str");
  return domainResponse;
}

Fixed version (ground truth):
@Override public DomainResponse createDomainResponse(Domain domain){
  DomainResponse domainResponse=new DomainResponse();
  domainResponse.setDomainName(domain.getName());
  domainResponse.setId(domain.getId());
  domainResponse.setLevel(domain.getLevel());
  domainResponse.setNetworkDomain(domain.getNetworkDomain());
  domainResponse.setParentDomainId(domain.getParent());
  if (domain.getParent() != null) {
    domainResponse.setParentDomainName(ApiDBUtils.findDomainById(domain.getParent()).getName());
  }
  if (domain.getChildCount() > 0) {
    domainResponse.setHasChild(true);
  }
  domainResponse.setObjectName("String_Node_Str");
  return domainResponse;
}
Program: 106822
Project: 106822
Buggy source:
/** 
 * Creates a new zone
 * @param userId
 * @param zoneName
 * @param dns1
 * @param dns2
 * @param internalDns1
 * @param internalDns2
 * @param vnetRange
 * @param guestCidr
 * @param zoneType
 * @param allocationState
 * @return
 * @throws 
     * @throws 
 */
DataCenterVO createZone(long userId,String zoneName,String dns1,String dns2,String internalDns1,String internalDns2,String vnetRange,String guestCidr,String domain,Long domainId,NetworkType zoneType,boolean isSecurityGroupEnabled,String allocationState);

Fixed version (ground truth):
/** 
 * Creates a new zone
 * @param userId
 * @param zoneName
 * @param dns1
 * @param dns2
 * @param internalDns1
 * @param internalDns2
 * @param vnetRange
 * @param guestCidr
 * @param zoneType
 * @param allocationState
 * @param networkDomain TODO
 * @return
 * @throws 
     * @throws 
 */
DataCenterVO createZone(long userId,String zoneName,String dns1,String dns2,String internalDns1,String internalDns2,String vnetRange,String guestCidr,String domain,Long domainId,NetworkType zoneType,boolean isSecurityGroupEnabled,String allocationState,String networkDomain);
Program: 106826
Project: 106826
Buggy source:
@DB protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot);
  createdVolume=volumeDetails.first();
  Transaction txn=Transaction.currentTxn();
  txn.start();
  Long diskOfferingId=volume.getDiskOfferingId();
  if (createdVolume.getPath() != null) {
    Long offeringId=null;
    if (diskOfferingId != null) {
      DiskOfferingVO offering=_diskOfferingDao.findById(diskOfferingId);
      if (offering != null && (offering.getType() == DiskOfferingVO.Type.Disk)) {
        offeringId=offering.getId();
      }
    }
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),offeringId,null,createdVolume.getSize());
    _usageEventDao.persist(usageEvent);
  }
  txn.commit();
  return createdVolume;
}

Fixed version (ground truth):
protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot);
  createdVolume=volumeDetails.first();
  return createdVolume;
}
Program: 106827
Project: 106827
Buggy source:
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  buffers[1]=ByteBuffer.wrap(_content.getBytes());
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}

Fixed version (ground truth):
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  if (tmp.capacity() >= 8192) {
    tmp=doCompress(tmp);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}
Program: 106828
Project: 106828
Buggy source:
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  final ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}

Fixed version (ground truth):
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}
Program: 106829
Project: 106829
Buggy source:
@Override public void cleanupForServer(long msId){
  PreparedStatement pstmt=null;
  try {
    pstmt=_concierge.conn().prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
    pstmt.setLong(1,_msId);
    pstmt.executeUpdate();
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      if (pstmt != null) {
        pstmt.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void cleanupForServer(long msId){
  s_logger.info("String_Node_Str" + msId);
  PreparedStatement pstmt=null;
  try {
    pstmt=_concierge.conn().prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
    pstmt.setLong(1,msId);
    int rows=pstmt.executeUpdate();
    s_logger.info("String_Node_Str" + rows + "String_Node_Str"+ msId);
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      if (pstmt != null) {
        pstmt.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}
Program: 106830
Project: 106830
Buggy source:
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  buffers[1]=ByteBuffer.wrap(_content.getBytes());
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}

Fixed version (ground truth):
public ByteBuffer[] toBytes(){
  final ByteBuffer[] buffers=new ByteBuffer[2];
  ByteBuffer tmp;
  if (_content == null) {
    _content=s_gson.toJson(_cmds,_cmds.getClass());
  }
  tmp=ByteBuffer.wrap(_content.getBytes());
  if (tmp.capacity() >= 8192) {
    tmp=doCompress(tmp);
    _flags|=FLAG_COMPRESSED;
  }
  buffers[1]=tmp;
  buffers[0]=serializeHeader(buffers[1].capacity());
  return buffers;
}
Program: 106831
Project: 106831
Buggy source:
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  final ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}

Fixed version (ground truth):
/** 
 */
public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
  ByteBuffer buff=ByteBuffer.wrap(bytes);
  final byte ver=buff.get();
  final Version version=Version.get(ver);
  if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
    throw new UnsupportedVersionException("String_Node_Str" + version.toString(),UnsupportedVersionException.IncompatibleVersion);
  }
  final byte reserved=buff.get();
  final short flags=buff.getShort();
  final boolean isRequest=(flags & FLAG_REQUEST) > 0;
  final long seq=buff.getLong();
  final int size=buff.getInt();
  final long mgmtId=buff.getLong();
  final long agentId=buff.getLong();
  long via;
  if (version.ordinal() == Version.v1.ordinal()) {
    via=buff.getLong();
  }
 else {
    via=agentId;
  }
  if ((flags & FLAG_COMPRESSED) != 0) {
    buff=doDecompress(buff);
  }
  byte[] command=null;
  int offset=0;
  if (buff.hasArray()) {
    command=buff.array();
    offset=buff.arrayOffset() + buff.position();
  }
 else {
    command=new byte[buff.remaining()];
    buff.get(command);
    offset=0;
  }
  final String content=new String(command,offset,command.length - offset);
  if (isRequest) {
    return new Request(version,seq,agentId,mgmtId,via,flags,content);
  }
 else {
    return new Response(Version.get(ver),seq,agentId,mgmtId,via,flags,content);
  }
}
Program: 106832
Project: 106832
Buggy source:
@Override public void cleanupForServer(long msId){
  s_logger.info("String_Node_Str" + msId);
  PreparedStatement pstmt=null;
  try {
    pstmt=_conn.prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
    pstmt.setLong(1,_msId);
    int rows=pstmt.executeUpdate();
    s_logger.info("String_Node_Str" + rows + "String_Node_Str"+ msId);
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      if (pstmt != null) {
        pstmt.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void cleanupForServer(long msId){
  s_logger.info("String_Node_Str" + msId);
  PreparedStatement pstmt=null;
  try {
    pstmt=_conn.prepareStatement(CLEANUP_MGMT_LOCKS_SQL);
    pstmt.setLong(1,msId);
    int rows=pstmt.executeUpdate();
    s_logger.info("String_Node_Str" + rows + "String_Node_Str"+ msId);
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      if (pstmt != null) {
        pstmt.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}
Program: 106833
Project: 106833
Buggy source:
protected void accept(SelectionKey key) throws IOException {
  ServerSocketChannel serverSocketChannel=(ServerSocketChannel)key.channel();
  SocketChannel socketChannel=serverSocketChannel.accept();
  Socket socket=socketChannel.socket();
  socket.setKeepAlive(true);
  if (s_logger.isTraceEnabled()) {
    s_logger.trace("String_Node_Str" + socket);
  }
  socketChannel.configureBlocking(true);
  SSLEngine sslEngine=null;
  try {
    SSLContext sslContext=Link.initSSLContext(false);
    sslEngine=sslContext.createSSLEngine();
    sslEngine.setUseClientMode(false);
    sslEngine.setNeedClientAuth(false);
    Link.doHandshake(socketChannel,sslEngine,false);
  }
 catch (  Exception e) {
    logDebug(e,key,0);
    terminate(key);
    return;
  }
  if (s_logger.isTraceEnabled()) {
    s_logger.trace("String_Node_Str");
  }
  socketChannel.configureBlocking(false);
  InetSocketAddress saddr=(InetSocketAddress)socket.getRemoteSocketAddress();
  Link link=new Link(saddr,this);
  link.setSSLEngine(sslEngine);
  link.setKey(socketChannel.register(key.selector(),SelectionKey.OP_READ,link));
  Task task=_factory.create(Task.Type.CONNECT,link,null);
  registerLink(saddr,link);
  _executor.execute(task);
}

Fixed version (ground truth):
protected void accept(SelectionKey key) throws IOException {
  ServerSocketChannel serverSocketChannel=(ServerSocketChannel)key.channel();
  SocketChannel socketChannel=serverSocketChannel.accept();
  Socket socket=socketChannel.socket();
  socket.setKeepAlive(true);
  if (s_logger.isTraceEnabled()) {
    s_logger.trace("String_Node_Str" + socket);
  }
  socketChannel.configureBlocking(true);
  SSLEngine sslEngine=null;
  try {
    SSLContext sslContext=Link.initSSLContext(false);
    sslEngine=sslContext.createSSLEngine();
    sslEngine.setUseClientMode(false);
    sslEngine.setNeedClientAuth(false);
    Link.doHandshake(socketChannel,sslEngine,false);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str" + socket + "String_Node_Str"+ e.getMessage());
    terminate(key);
    return;
  }
  if (s_logger.isTraceEnabled()) {
    s_logger.trace("String_Node_Str");
  }
  socketChannel.configureBlocking(false);
  InetSocketAddress saddr=(InetSocketAddress)socket.getRemoteSocketAddress();
  Link link=new Link(saddr,this);
  link.setSSLEngine(sslEngine);
  link.setKey(socketChannel.register(key.selector(),SelectionKey.OP_READ,link));
  Task task=_factory.create(Task.Type.CONNECT,link,null);
  registerLink(saddr,link);
  _executor.execute(task);
}
Program: 106834
Project: 106834
Buggy source:
@Override public Long checkAccessAndSpecifyAuthority(Account caller,Long zoneId){
  if (isResourceDomainAdmin(caller.getType())) {
    if (zoneId == null)     return getZoneIdForAccount(caller);
 else     if (getZoneIdForAccount(caller) != zoneId)     throw new PermissionDeniedException("String_Node_Str" + caller + "String_Node_Str"+ zoneId);
 else     return zoneId;
  }
 else   return zoneId;
}

Fixed version (ground truth):
@Override public Long checkAccessAndSpecifyAuthority(Account caller,Long zoneId){
  if (isResourceDomainAdmin(caller.getType())) {
    if (zoneId == null)     return getZoneIdForAccount(caller);
 else     if (zoneId.compareTo(getZoneIdForAccount(caller)) != 0)     throw new PermissionDeniedException("String_Node_Str" + caller + "String_Node_Str"+ zoneId);
 else     return zoneId;
  }
 else   return zoneId;
}
Program: 106839
Project: 106839
Buggy source:
@Override public DomainResponse createDomainResponse(Domain domain){
  DomainResponse domainResponse=new DomainResponse();
  domainResponse.setDomainName(domain.getName());
  domainResponse.setId(domain.getId());
  domainResponse.setLevel(domain.getLevel());
  domainResponse.setParentDomainId(domain.getParent());
  if (domain.getParent() != null) {
    domainResponse.setParentDomainName(ApiDBUtils.findDomainById(domain.getParent()).getName());
  }
  if (domain.getChildCount() > 0) {
    domainResponse.setHasChild(true);
  }
  domainResponse.setObjectName("String_Node_Str");
  return domainResponse;
}

Fixed version (ground truth):
@Override public DomainResponse createDomainResponse(Domain domain){
  DomainResponse domainResponse=new DomainResponse();
  domainResponse.setDomainName(domain.getName());
  domainResponse.setId(domain.getId());
  domainResponse.setLevel(domain.getLevel());
  domainResponse.setNetworkDomain(domain.getNetworkDomain());
  domainResponse.setParentDomainId(domain.getParent());
  if (domain.getParent() != null) {
    domainResponse.setParentDomainName(ApiDBUtils.findDomainById(domain.getParent()).getName());
  }
  if (domain.getChildCount() > 0) {
    domainResponse.setHasChild(true);
  }
  domainResponse.setObjectName("String_Node_Str");
  return domainResponse;
}
Program: 106840
Project: 106840
Buggy source:
/** 
 * Creates a new zone
 * @param userId
 * @param zoneName
 * @param dns1
 * @param dns2
 * @param internalDns1
 * @param internalDns2
 * @param vnetRange
 * @param guestCidr
 * @param zoneType
 * @param allocationState
 * @return
 * @throws 
     * @throws 
 */
DataCenterVO createZone(long userId,String zoneName,String dns1,String dns2,String internalDns1,String internalDns2,String vnetRange,String guestCidr,String domain,Long domainId,NetworkType zoneType,boolean isSecurityGroupEnabled,String allocationState);

Fixed version (ground truth):
/** 
 * Creates a new zone
 * @param userId
 * @param zoneName
 * @param dns1
 * @param dns2
 * @param internalDns1
 * @param internalDns2
 * @param vnetRange
 * @param guestCidr
 * @param zoneType
 * @param allocationState
 * @param networkDomain TODO
 * @return
 * @throws 
     * @throws 
 */
DataCenterVO createZone(long userId,String zoneName,String dns1,String dns2,String internalDns1,String internalDns2,String vnetRange,String guestCidr,String domain,Long domainId,NetworkType zoneType,boolean isSecurityGroupEnabled,String allocationState,String networkDomain);