nus-yam/ex-repair huggingface dataset:
Program: 107589
Project: 107589
Buggy source:
/** 
 * Decodes signs of excitation.
 * @param sRC Range coder state.
 * @param q pulse signal.
 * @param length length of output.
 * @param sigtype Signal type.
 * @param QuantOffsetType Quantization offset type.
 * @param RateLevelIndex Rate Level Index.
 */
static void SKP_Silk_decode_signs(SKP_Silk_range_coder_state sRC,int q[],final int length,final int sigtype,final int QuantOffsetType,final int RateLevelIndex){
  int i;
  int data;
  int data_ptr[]=new int[1];
  int[] cdf=new int[3];
  i=Macros.SKP_SMULBB(Define.N_RATE_LEVELS - 1,(sigtype << 1) + QuantOffsetType) + RateLevelIndex;
  cdf[0]=0;
  cdf[1]=TablesSign.SKP_Silk_sign_CDF[i];
  cdf[2]=65535;
  for (i=0; i < length; i++) {
    if (q[i] > 0) {
      RangeCoder.SKP_Silk_range_decoder(data_ptr,0,sRC,cdf,0,1);
      data=data_ptr[0];
      q[i]*=(data << 1) - 1;
    }
  }
}

Fixed version (ground truth):
/** 
 * Decodes signs of excitation.
 * @param sRC Range coder state.
 * @param q pulse signal.
 * @param length length of output.
 * @param sigtype Signal type.
 * @param QuantOffsetType Quantization offset type.
 * @param RateLevelIndex Rate Level Index.
 */
static void SKP_Silk_decode_signs(SKP_Silk_range_coder_state sRC,int q[],final int length,final int sigtype,final int QuantOffsetType,final int RateLevelIndex){
  int i;
  int data;
  int data_ptr[]=new int[1];
  int[] cdf=new int[3];
  i=SKP_SMULBB(N_RATE_LEVELS - 1,(sigtype << 1) + QuantOffsetType) + RateLevelIndex;
  cdf[0]=0;
  cdf[1]=TablesSign.SKP_Silk_sign_CDF[i];
  cdf[2]=65535;
  for (i=0; i < length; i++) {
    if (q[i] > 0) {
      RangeCoder.SKP_Silk_range_decoder(data_ptr,0,sRC,cdf,0,1);
      data=data_ptr[0];
      q[i]*=(data << 1) - 1;
    }
  }
}
Program: 107590
Project: 107590
Buggy source:
/** 
 * Encodes signs of excitation.
 * @param sRC Range coder state.
 * @param q Pulse signal.
 * @param length Length of input.
 * @param sigtype Signal type.
 * @param QuantOffsetType QuantOffsetType.
 * @param RateLevelIndex Rate level index.
 */
static void SKP_Silk_encode_signs(SKP_Silk_range_coder_state sRC,byte[] q,final int length,final int sigtype,final int QuantOffsetType,final int RateLevelIndex){
  int i;
  int inData;
  int[] cdf=new int[3];
  i=Macros.SKP_SMULBB(Define.N_RATE_LEVELS - 1,(sigtype << 1) + QuantOffsetType) + RateLevelIndex;
  cdf[0]=0;
  cdf[1]=TablesSign.SKP_Silk_sign_CDF[i];
  cdf[2]=65535;
  for (i=0; i < length; i++) {
    if (q[i] != 0) {
      inData=(q[i] >> 15) + 1;
      RangeCoder.SKP_Silk_range_encoder(sRC,inData,cdf,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Encodes signs of excitation.
 * @param sRC Range coder state.
 * @param q Pulse signal.
 * @param length Length of input.
 * @param sigtype Signal type.
 * @param QuantOffsetType QuantOffsetType.
 * @param RateLevelIndex Rate level index.
 */
static void SKP_Silk_encode_signs(SKP_Silk_range_coder_state sRC,byte[] q,final int length,final int sigtype,final int QuantOffsetType,final int RateLevelIndex){
  int i;
  int inData;
  int[] cdf=new int[3];
  i=SKP_SMULBB(N_RATE_LEVELS - 1,(sigtype << 1) + QuantOffsetType) + RateLevelIndex;
  cdf[0]=0;
  cdf[1]=TablesSign.SKP_Silk_sign_CDF[i];
  cdf[2]=65535;
  for (i=0; i < length; i++) {
    if (q[i] != 0) {
      inData=(q[i] >> 15) + 1;
      RangeCoder.SKP_Silk_range_encoder(sRC,inData,cdf,0);
    }
  }
}
Program: 107592
Project: 107592
Buggy source:
/** 
 * Returns the jitter average of this upload/download stream.
 * @param streamDirection The stream direction (DOWNLOAD or UPLOAD) of thestream from which this function retrieve the jitter.
 * @return the last jitter average computed (in ms).
 */
private double getJitterMs(StreamDirection streamDirection){
  MediaFormat format=mediaStreamImpl.getFormat();
  double clockRate;
  if (format == null) {
    MediaType mediaType=mediaStreamImpl.getMediaType();
    clockRate=MediaType.VIDEO.equals(mediaType) ? 90000 : -1;
  }
 else   clockRate=format.getClockRate();
  if (clockRate <= 0)   return -1;
  return (jitterRTPTimestampUnits[streamDirection.ordinal()] / clockRate) * 1000.0;
}

Fixed version (ground truth):
/** 
 * Returns the jitter average of this upload/download stream.
 * @param streamDirection The stream direction (DOWNLOAD or UPLOAD) of thestream from which this function retrieve the jitter.
 * @return the last jitter average computed (in ms).
 */
private double getJitterMs(StreamDirection streamDirection){
  return rtpTimeToMs(jitterRTPTimestampUnits[streamDirection.ordinal()]);
}
Program: 107593
Project: 107593
Buggy source:
/** 
 * Updates this stream stats with the new feedback received.
 * @param feedback The last RTCP feedback received by the MediaStream.
 */
private void updateNewReceivedFeedback(RTCPFeedback feedback){
  StreamDirection streamDirection=StreamDirection.UPLOAD;
  updateJitterRTPTimestampUnits(feedback,streamDirection);
  long uploadNewNbRecv=feedback.getXtndSeqNum();
  long newNbLost=feedback.getNumLost() - nbLost[streamDirection.ordinal()];
  long nbSteps=uploadNewNbRecv - uploadFeedbackNbPackets;
  updateNbLoss(streamDirection,newNbLost,nbSteps);
  uploadFeedbackNbPackets=uploadNewNbRecv;
  setRttMs(computeRTTInMs(feedback));
}

Fixed version (ground truth):
/** 
 * Updates this stream stats with the new feedback received.
 * @param feedback The last RTCP feedback received by the MediaStream.
 */
private void updateNewReceivedFeedback(RTCPFeedback feedback){
  StreamDirection streamDirection=StreamDirection.UPLOAD;
  updateJitterRTPTimestampUnits(feedback,streamDirection);
  long uploadNewNbRecv=feedback.getXtndSeqNum();
  nbPacketsLostUpload=feedback.getNumLost();
  long newNbLost=nbPacketsLostUpload - nbLost[streamDirection.ordinal()];
  long nbSteps=uploadNewNbRecv - uploadFeedbackNbPackets;
  updateNbLoss(streamDirection,newNbLost,nbSteps);
  uploadFeedbackNbPackets=uploadNewNbRecv;
  setRttMs(computeRTTInMs(feedback));
}
Program: 107594
Project: 107594
Buggy source:
/** 
 * Returns the number of Protocol Data Units (PDU) sent/received since the beginning of the session.
 * @param streamDirection The stream direction (DOWNLOAD or UPLOAD) of thestream from which this function retrieve the number of sent/received packets.
 * @return the number of packets sent/received for this stream.
 */
private long getNbPDU(StreamDirection streamDirection){
  StreamRTPManager rtpManager=mediaStreamImpl.queryRTPManager();
  long nbPDU=0;
  if (rtpManager != null) {
switch (streamDirection) {
case UPLOAD:
      nbPDU=rtpManager.getGlobalTransmissionStats().getRTPSent();
    break;
case DOWNLOAD:
  GlobalReceptionStats globalReceptionStats=rtpManager.getGlobalReceptionStats();
nbPDU=globalReceptionStats.getPacketsRecd() - globalReceptionStats.getRTCPRecd();
break;
}
}
return nbPDU;
}

Fixed version (ground truth):
/** 
 * Returns the number of Protocol Data Units (PDU) sent/received since the beginning of the session.
 * @param streamDirection The stream direction (DOWNLOAD or UPLOAD) of thestream from which this function retrieve the number of sent/received packets.
 * @return the number of packets sent/received for this stream.
 */
private long getNbPDU(StreamDirection streamDirection){
  long nbPDU=0;
  StatisticsEngine statisticsEngine=mediaStreamImpl.getStatisticsEngine();
  if (statisticsEngine != null) {
switch (streamDirection) {
case UPLOAD:
      nbPDU=statisticsEngine.getRtpPacketsSent();
    break;
case DOWNLOAD:
  nbPDU=statisticsEngine.getRtpPacketsReceived();
break;
}
}
return nbPDU;
}
Program: 107595
Project: 107595
Buggy source:
/** 
 * Returns the number of lost packets for the receive streams.
 * @return  the number of lost packets for the receive streams.
 */
private long getDownloadNbPacketLost(){
  long downloadLost=0;
  for (  ReceiveStream stream : mediaStreamImpl.getReceiveStreams()) {
    downloadLost+=stream.getSourceReceptionStats().getPDUlost();
  }
  return downloadLost;
}

Fixed version (ground truth):
/** 
 * Returns the number of lost packets for the receive streams.
 * @return  the number of lost packets for the receive streams.
 */
public long getDownloadNbPacketLost(){
  long downloadLost=0;
  for (  ReceiveStream stream : mediaStreamImpl.getReceiveStreams()) {
    downloadLost+=stream.getSourceReceptionStats().getPDUlost();
  }
  return downloadLost;
}
Program: 107596
Project: 107596
Buggy source:
/** 
 * Gets the <tt>java.security.Provider</tt> instance (to be) employed for an optimized AES implementation.
 * @return the <tt>java.security.Provider</tt> instance (to be) employed foran optimized AES implementation
 */
private static Provider getProvider(){
  Provider provider;
synchronized (AES.class) {
    provider=AES.provider;
    if ((provider == null) && useProvider) {
      ConfigurationService cfg=LibJitsi.getConfigurationService();
      String providerName=(cfg == null) ? System.getProperty(PROVIDER_NAME_PNAME) : cfg.getString(PROVIDER_NAME_PNAME);
      try {
        if ((providerName != null) && (providerName.length() != 0)) {
          if ("String_Node_Str".equals(providerName)) {
            String name=null;
            Package pkg=AES.class.getPackage();
            if (pkg != null)             name=pkg.getName();
            if ((name == null) || (name.length() == 0))             name="String_Node_Str";
            provider=new sun.security.pkcs11.SunPKCS11("String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          }
 else {
            provider=Security.getProvider(providerName);
          }
        }
      }
  finally {
        if (provider == null)         useProvider=false;
 else         AES.provider=provider;
      }
    }
  }
  return provider;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>java.security.Provider</tt> instance (to be) employed for an optimized AES implementation.
 * @return the <tt>java.security.Provider</tt> instance (to be) employed foran optimized AES implementation
 */
private static Provider getProvider(){
  Provider provider;
synchronized (AES.class) {
    provider=AES.provider;
    if ((provider == null) && useProvider) {
      ConfigurationService cfg=LibJitsi.getConfigurationService();
      String providerName=(cfg == null) ? System.getProperty(PROVIDER_NAME_PNAME) : cfg.getString(PROVIDER_NAME_PNAME);
      try {
        if ((providerName != null) && (providerName.length() != 0)) {
          if ("String_Node_Str".equals(providerName)) {
            String name=null;
            Package pkg=AES.class.getPackage();
            if (pkg != null)             name=pkg.getName();
            if ((name == null) || (name.length() == 0))             name="String_Node_Str";
          }
 else {
            provider=Security.getProvider(providerName);
          }
        }
      }
  finally {
        if (provider == null)         useProvider=false;
 else         AES.provider=provider;
      }
    }
  }
  return provider;
}
Program: 107599
Project: 107599
Buggy source:
/** 
 * Removes <tt>ssrc</tt> from the array of SSRC identifiers representing parties that this <tt>MediaDeviceSession</tt> is currently receiving streams from.
 * @param ssrc the SSRC identifier that we'd like to remove from the arrayof <tt>ssrc</tt> identifiers stored by this session.
 */
protected void removeSSRC(long ssrc){
  int index=-1;
  if (ssrcList == null || ssrcList.length == 0) {
    return;
  }
  for (int i=0; i < ssrcList.length; i++) {
    if (ssrcList[i] == ssrc) {
      index=i;
      break;
    }
  }
  if (index < 0 || index >= ssrcList.length) {
    return;
  }
  if (ssrcList.length == 1) {
    setSsrcList(null);
    return;
  }
  long[] newSsrcList=new long[ssrcList.length];
  System.arraycopy(ssrcList,0,newSsrcList,0,index);
  if (index < ssrcList.length - 1) {
    System.arraycopy(ssrcList,index + 1,newSsrcList,index,ssrcList.length - index - 1);
  }
  setSsrcList(newSsrcList);
}

Fixed version (ground truth):
/** 
 * Removes <tt>ssrc</tt> from the array of SSRC identifiers representing parties that this <tt>MediaDeviceSession</tt> is currently receiving streams from.
 * @param ssrc the SSRC identifier that we'd like to remove from the arrayof <tt>ssrc</tt> identifiers stored by this session.
 */
protected void removeSSRC(long ssrc){
  int index=-1;
  if (ssrcList == null || ssrcList.length == 0) {
    return;
  }
  for (int i=0; i < ssrcList.length; i++) {
    if (ssrcList[i] == ssrc) {
      index=i;
      break;
    }
  }
  if (index < 0 || index >= ssrcList.length) {
    return;
  }
  if (ssrcList.length == 1) {
    setSsrcList(null);
    return;
  }
  long[] newSsrcList=new long[ssrcList.length - 1];
  System.arraycopy(ssrcList,0,newSsrcList,0,index);
  if (index < ssrcList.length - 1) {
    System.arraycopy(ssrcList,index + 1,newSsrcList,index,ssrcList.length - index - 1);
  }
  setSsrcList(newSsrcList);
}
Program: 107600
Project: 107600
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>Buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  Format format;
  format=buffer.getFormat();
  if (format == null) {
    format=getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RawPacket rtpPacket=rtpFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(rtpPacket.getOffset());
  buffer.setLength(rtpPacket.getPayloadLength());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked) {
    timestamp=System.nanoTime();
  }
  lastReadWasMarked=rtpPacket.isPacketMarked();
  if (lastReadWasMarked) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(timestamp);
  if (lastRtpTimestamp == -1) {
    lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
    return;
  }
  long previous=lastRtpTimestamp;
  lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
  long rtpDiff=lastRtpTimestamp - previous;
  if (rtpDiff < 0)   rtpDiff+=1L << 32;
  long nanos=(rtpDiff * 1000 * 1000* 1000) / CLOCK_RATE;
  if (nanos > 0) {
    try {
      Thread.sleep(nanos / 1000000,(int)(nanos % 1000000));
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>Buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  Format format;
  format=buffer.getFormat();
  if (format == null) {
    format=getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RawPacket rtpPacket=rtpFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(rtpPacket.getOffset());
  buffer.setLength(rtpPacket.getPayloadLength());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked) {
    timestamp=System.nanoTime();
  }
  lastReadWasMarked=rtpPacket.isPacketMarked();
  if (lastReadWasMarked) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(timestamp);
  if (lastRtpTimestamp == -1) {
    lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
    return;
  }
  long previous=lastRtpTimestamp;
  lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
  long rtpDiff=lastRtpTimestamp - previous;
  long nanos=(rtpDiff * 1000 * 1000* 1000) / CLOCK_RATE;
  if (nanos > 0) {
    try {
      Thread.sleep(nanos / 1000000,(int)(nanos % 1000000));
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 107601
Project: 107601
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>Buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  Format format;
  format=buffer.getFormat();
  if (format == null) {
    format=getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RawPacket rtpPacket=rtpFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(rtpPacket.getOffset());
  buffer.setLength(rtpPacket.getPayloadLength());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked) {
    timestamp=System.nanoTime();
  }
  lastReadWasMarked=rtpPacket.isPacketMarked();
  if (lastReadWasMarked) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(timestamp);
  long rtpDiff=rtpPacket.getTimestamp() - this.lastRtpTimestamp;
  if (rtpDiff < 0)   rtpDiff+=1L << 32;
  long nanos=(rtpDiff * 1000 * 1000* 1000) / CLOCK_RATE;
  if (nanos > 0) {
    try {
      Thread.sleep(nanos / 1000000,(int)(nanos % 1000000));
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.lastRtpTimestamp=rtpPacket.getTimestamp();
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>Buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  Format format;
  format=buffer.getFormat();
  if (format == null) {
    format=getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RawPacket rtpPacket=rtpFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(rtpPacket.getOffset());
  buffer.setLength(rtpPacket.getPayloadLength());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked) {
    timestamp=System.nanoTime();
  }
  lastReadWasMarked=rtpPacket.isPacketMarked();
  if (lastReadWasMarked) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(timestamp);
  if (lastRtpTimestamp == -1) {
    lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
    return;
  }
  long previous=lastRtpTimestamp;
  lastRtpTimestamp=0xffffffffL & rtpPacket.getTimestamp();
  long rtpDiff=lastRtpTimestamp - previous;
  if (rtpDiff < 0)   rtpDiff+=1L << 32;
  long nanos=(rtpDiff * 1000 * 1000* 1000) / CLOCK_RATE;
  if (nanos > 0) {
    try {
      Thread.sleep(nanos / 1000000,(int)(nanos % 1000000));
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 107602
Project: 107602
Buggy source:
/** 
 * doConnect allow us to initialize the DataSource with informations that we couldn't have in the constructor, like the MediaLocator that give us the path of the ivf file which give us information on the format 
 */
public void doConnect() throws IOException {
  super.doConnect();
  this.fileLocation=getLocator().getRemainder();
  ivfHeader=new IVFHeader(this.fileLocation);
  this.SUPPORTED_FORMATS[0]=new VideoFormat(Constants.VP8,ivfHeader.getDimension(),Format.NOT_SPECIFIED,Format.byteArray,ivfHeader.getFramerate() / ivfHeader.getTimeScale());
}

Fixed version (ground truth):
/** 
 * doConnect allow us to initialize the DataSource with informations that we couldn't have in the constructor, like the MediaLocator that give us the path of the ivf file which give us information on the format 
 */
public void doConnect() throws IOException {
  super.doConnect();
  this.fileLocation=getLocator().getRemainder();
  ivfHeader=new IVFHeader(this.fileLocation);
  this.SUPPORTED_FORMATS[0]=new VideoFormat(Constants.VP8,ivfHeader.getDimension(),Format.NOT_SPECIFIED,Format.byteArray,Format.NOT_SPECIFIED);
}
Program: 107603
Project: 107603
Buggy source:
/** 
 * Get the next vp8 frame of the IVF file as a <tt>byte</tt> array. You should use this function if you don't want to allocate a new VP8Frame for each call.
 * @param frame the <tt>VP8Frame</tt> that will be filled with theinformations and data of the next frame read.
 * @param loopFile if true and that the end of the file is reached,this <tt>IVFFileReader</tt> will go back at the beginning of the file and start over the reading of the file.
 * @return the next vp8 frame of the IVF file as a <tt>byte</tt> array.
 * @throws IOException if an error occur during the read, of if EOF is reached.
 */
public void getNextFrame(VP8Frame frame,boolean loopFile) throws IOException {
  if ((loopFile == true) && (frameNo >= header.getNumberOfFramesInFile())) {
    stream.seek(header.getHeaderLengh());
    frameNo=0;
  }
  byte[] data;
  int frameSizeInBytes;
  long timestamp;
  frameSizeInBytes=changeEndianness(stream.readInt());
  timestamp=changeEndianness(stream.readLong());
  data=new byte[frameSizeInBytes];
  stream.read(data);
  frameNo++;
  frame.set(timestamp,frameSizeInBytes,data);
}

Fixed version (ground truth):
/** 
 * Get the next vp8 frame of the IVF file as a <tt>byte</tt> array. You should use this function if you don't want to allocate a new VP8Frame for each call.
 * @param frame the <tt>VP8Frame</tt> that will be filled with theinformations and data of the next frame read.
 * @param loopFile if true and that the end of the file is reached,this <tt>IVFFileReader</tt> will go back at the beginning of the file and start over the reading of the file.
 * @return the next vp8 frame of the IVF file as a <tt>byte</tt> array.
 * @throws IOException if an error occur during the read, of if EOF is reached.
 */
public void getNextFrame(VP8Frame frame,boolean loopFile) throws IOException {
  if ((loopFile == true) && (stream.getFilePointer() >= stream.length())) {
    stream.seek(header.getHeaderLengh());
    frameNo=0;
  }
  byte[] data;
  int frameSizeInBytes;
  long timestamp;
  frameSizeInBytes=changeEndianness(stream.readInt());
  timestamp=changeEndianness(stream.readLong());
  data=new byte[frameSizeInBytes];
  stream.read(data);
  frameNo++;
  frame.set(timestamp,frameSizeInBytes,data);
}
Program: 107604
Project: 107604
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  ivfFileReader.getNextFrame(frame,true);
  buffer.setData(frame.getFrameData());
  buffer.setOffset(0);
  buffer.setLength(frame.getFrameLength());
  buffer.setTimeStamp(System.nanoTime());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  millis=System.currentTimeMillis() - this.timeLastRead;
  millis=(frame.getTimestamp() - lastFrameTimestamp) * TIMEBASE - millis;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.lastFrameTimestamp=frame.getTimestamp();
  this.timeLastRead=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long nanos=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  ivfFileReader.getNextFrame(frame,true);
  buffer.setData(frame.getFrameData());
  buffer.setOffset(0);
  buffer.setLength(frame.getFrameLength());
  buffer.setTimeStamp(System.nanoTime());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  nanos=System.nanoTime() - this.timeLastRead;
  nanos=(frame.getTimestamp() - lastFrameTimestamp) * TIMEBASE - nanos;
  if (nanos > 0) {
    try {
      Thread.sleep(nanos / 1000000,(int)(nanos % 1000000));
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.lastFrameTimestamp=frame.getTimestamp();
  this.timeLastRead=System.nanoTime();
}
Program: 107605
Project: 107605
Buggy source:
/** 
 * Initializes a new <tt>IVFStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
IVFStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  this.ivfFileReader=new IVFFileReader(dataSource.getLocator().getRemainder());
  this.TIMEBASE=(int)(1000. / ((VideoFormat)getFormat()).getFrameRate());
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>IVFStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
IVFStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  this.ivfFileReader=new IVFFileReader(dataSource.getLocator().getRemainder());
  IVFHeader header=ivfFileReader.getHeader();
  this.TIMEBASE=1000000000 * header.getTimeScale() / header.getFramerate();
}
Program: 107606
Project: 107606
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  Dimension size=((VideoFormat)format).getSize();
  int frameSizeInBytes=(int)(size.getHeight() * size.getWidth() * 4);
  byte[] data=AbstractCodec2.validateByteArraySize(buffer,frameSizeInBytes,false);
  Arrays.fill(data,0,frameSizeInBytes,(byte)color);
  if (increment)   color+=3;
 else   color-=3;
  if (color >= 255) {
    increment=false;
    color=255;
  }
 else   if (color <= 0) {
    increment=true;
    color=0;
  }
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(data.length);
  buffer.setTimeStamp(System.nanoTime());
  millis=System.currentTimeMillis() - timeLastRead;
  millis=(long)(1000.0 / format.getFrameRate()) - millis;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  timeLastRead=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  Dimension size=format.getSize();
  int frameSizeInBytes=(int)(size.getHeight() * size.getWidth() * 4);
  byte[] data=AbstractCodec2.validateByteArraySize(buffer,frameSizeInBytes,false);
  Arrays.fill(data,0,frameSizeInBytes,(byte)color);
  if (increment) {
    color+=3;
  }
 else {
    color-=3;
  }
  if (color >= 255) {
    increment=false;
    color=255;
  }
 else   if (color <= 0) {
    increment=true;
    color=0;
  }
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(frameSizeInBytes);
  buffer.setTimeStamp(System.nanoTime());
  millis=System.currentTimeMillis() - timeLastRead;
  millis=(long)(1000.0 / format.getFrameRate()) - millis;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  timeLastRead=System.currentTimeMillis();
}
Program: 107607
Project: 107607
Buggy source:
void reset(long ssrc){
synchronized (buffers) {
    Buffer buffer=buffers.get(ssrc);
    if (buffer != null)     buffers.remove(buffer);
  }
}

Fixed version (ground truth):
/** 
 * Resets the buffer for a particular SSRC (effectively re-enabling it if it was disabled).
 * @param ssrc
 */
void reset(long ssrc){
synchronized (buffers) {
    Buffer buffer=buffers.get(ssrc);
    if (buffer != null)     buffers.remove(ssrc);
  }
}
Program: 107608
Project: 107608
Buggy source:
/** 
 * Determines whether a specific <tt>RawPacket</tt> appears to represent an RTCP packet.
 * @param pkt the <tt>RawPacket</tt> to be examined
 * @return <tt>true</tt> if the specified <tt>pkt</tt> appears to representan RTCP packet
 */
private static boolean isRTCP(RawPacket pkt){
  int len=pkt.getLength();
  boolean b=false;
  if (len >= 4) {
    byte[] buf=pkt.getBuffer();
    int off=pkt.getOffset();
    int v=(buf[off] & 0xc0) >>> 6;
    if (v == RTCPHeader.VERSION) {
      int length=(buf[off + 2] << 8) + (buf[off + 3] << 0);
      if (length <= len)       b=true;
    }
  }
  return b;
}

Fixed version (ground truth):
/** 
 * Determines whether a specific <tt>RawPacket</tt> appears to represent an RTCP packet.
 * @param pkt the <tt>RawPacket</tt> to be examined
 * @return <tt>true</tt> if the specified <tt>pkt</tt> appears to representan RTCP packet
 */
private static boolean isRTCP(RawPacket pkt){
  int len=pkt.getLength();
  boolean b=false;
  if (len >= 4) {
    byte[] buf=pkt.getBuffer();
    int off=pkt.getOffset();
    int v=(buf[off] & 0xc0) >>> 6;
    if (v == RTCPHeader.VERSION) {
      int lengthInWords=(buf[off + 2] << 8) + (buf[off + 3] << 0);
      int lengthInBytes=(lengthInWords + 1) * 4;
      if (lengthInBytes <= len)       b=true;
    }
  }
  return b;
}
Program: 107609
Project: 107609
Buggy source:
/** 
 * Set the type of this session.
 * @param type the <tt>MediaType</tt> of this session
 */
public void setSessionType(MediaType sessionType){
  this.sessionType=sessionType;
}

Fixed version (ground truth):
/** 
 * Set the type of this session.
 * @param sessionType the <tt>MediaType</tt> of this session
 */
public void setSessionType(MediaType sessionType){
  this.sessionType=sessionType;
}
Program: 107610
Project: 107610
Buggy source:
/** 
 * Initializes a new <tt>SsrcTransformEngine</tt> to be utilized by a specific <tt>MediaStreamImpl</tt>.
 * @param mediaStream the <tt>MediaStreamImpl</tt> to utilize the newinstance
 */
public SsrcTransformEngine(MediaStreamImpl mediaStream){
  Map<Byte,RTPExtension> activeRTPExtensions=mediaStream.getActiveRTPExtensions();
  if ((activeRTPExtensions != null) && !activeRTPExtensions.isEmpty()) {
    for (    Map.Entry<Byte,RTPExtension> e : activeRTPExtensions.entrySet()) {
      RTPExtension rtpExtension=e.getValue();
      String uri=rtpExtension.getURI().toString();
      if (RTPExtension.SSRC_AUDIO_LEVEL_URN.equals(uri)) {
        Byte extID=e.getKey();
        setSsrcAudioLevelExtensionID((extID == null) ? -1 : extID.byteValue(),rtpExtension.getDirection());
      }
    }
  }
  ConfigurationService cfg=LibJitsi.getConfigurationService();
  boolean b=false;
  if (cfg != null) {
    b=cfg.getBoolean(DROP_MUTED_AUDIO_SOURCE_IN_REVERSE_TRANSFORM,b);
  }
  dropMutedAudioSourceInReverseTransform=b;
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>SsrcTransformEngine</tt> to be utilized by a specific <tt>MediaStreamImpl</tt>.
 * @param mediaStream the <tt>MediaStreamImpl</tt> to utilize the newinstance
 */
public SsrcTransformEngine(MediaStreamImpl mediaStream){
  Map<Byte,RTPExtension> activeRTPExtensions=mediaStream.getActiveRTPExtensions();
  if ((activeRTPExtensions != null) && !activeRTPExtensions.isEmpty()) {
    for (    Map.Entry<Byte,RTPExtension> e : activeRTPExtensions.entrySet()) {
      RTPExtension rtpExtension=e.getValue();
      String uri=rtpExtension.getURI().toString();
      if (RTPExtension.SSRC_AUDIO_LEVEL_URN.equals(uri)) {
        Byte extID=e.getKey();
        setSsrcAudioLevelExtensionID((extID == null) ? -1 : extID.byteValue(),rtpExtension.getDirection());
      }
    }
  }
  dropMutedAudioSourceInReverseTransform=false;
}
Program: 107611
Project: 107611
Buggy source:
/** 
 * The size in bytes of the Payload Descriptor at offset <tt>offset</tt> in <tt>input</tt>. The size is between 1 and 6.
 * @param input input
 * @param offset offset
 * @return The size in bytes of the Payload Descriptor at offset<tt>offset</tt> in <tt>input</tt>. The size is between 1 and 6.
 * @throws Exception if there isn't a valid Payload Descriptor structureat offset <tt>offset</tt> in <tt>input</tt>.
 */
public static int getSize(byte[] input,int offset) throws Exception {
  if (input.length < offset + 1)   throw new Exception("String_Node_Str");
  if ((input[offset] & X_BIT) == 0)   return 1;
  int size=1;
  if ((input[offset + 1] & I_BIT) != 0) {
    size++;
    if ((input[offset + 2] & M_BIT) != 0)     size++;
  }
  if ((input[offset + 1] & L_BIT) != 0)   size++;
  if ((input[offset + 1] & (T_BIT | K_BIT)) != 0)   size++;
  return size;
}

Fixed version (ground truth):
/** 
 * The size in bytes of the Payload Descriptor at offset <tt>offset</tt> in <tt>input</tt>. The size is between 1 and 6.
 * @param input input
 * @param offset offset
 * @return The size in bytes of the Payload Descriptor at offset<tt>offset</tt> in <tt>input</tt>. The size is between 1 and 6.
 * @throws Exception if there isn't a valid Payload Descriptor structureat offset <tt>offset</tt> in <tt>input</tt>.
 */
public static int getSize(byte[] input,int offset) throws Exception {
  if (input.length < offset + 1)   throw new Exception("String_Node_Str");
  if ((input[offset] & X_BIT) == 0)   return 1;
  int size=2;
  if ((input[offset + 1] & I_BIT) != 0) {
    size++;
    if ((input[offset + 2] & M_BIT) != 0)     size++;
  }
  if ((input[offset + 1] & L_BIT) != 0)   size++;
  if ((input[offset + 1] & (T_BIT | K_BIT)) != 0)   size++;
  return size;
}
Program: 107612
Project: 107612
Buggy source:
/** 
 * Returns all available <tt>ScreenDevice</tt>s.
 * @return an array of all available <tt>ScreenDevice</tt>s
 */
public static ScreenDevice[] getAvailableScreenDevices(){
  GraphicsEnvironment ge;
  try {
    ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  }
 catch (  NoClassDefFoundError ncdfe) {
    ge=null;
  }
  ScreenDevice[] screens=null;
  if ((ge != null) && !ge.isHeadlessInstance()) {
    GraphicsDevice[] devices=ge.getScreenDevices();
    if ((devices != null) && (devices.length != 0)) {
      screens=new ScreenDevice[devices.length];
      int i=0;
      for (      GraphicsDevice dev : devices) {
        screens[i]=new ScreenDeviceImpl(i,dev);
        i++;
      }
    }
  }
  return (screens == null) ? EMPTY_SCREEN_DEVICE_ARRAY : screens;
}

Fixed version (ground truth):
/** 
 * Returns all available <tt>ScreenDevice</tt>s.
 * @return an array of all available <tt>ScreenDevice</tt>s
 */
public static ScreenDevice[] getAvailableScreenDevices(){
  GraphicsEnvironment ge;
  try {
    ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  }
 catch (  Throwable t) {
    if (t instanceof ThreadDeath)     throw (ThreadDeath)t;
 else     ge=null;
  }
  ScreenDevice[] screens=null;
  if ((ge != null) && !ge.isHeadlessInstance()) {
    GraphicsDevice[] devices=ge.getScreenDevices();
    if ((devices != null) && (devices.length != 0)) {
      screens=new ScreenDevice[devices.length];
      int i=0;
      for (      GraphicsDevice dev : devices) {
        screens[i]=new ScreenDeviceImpl(i,dev);
        i++;
      }
    }
  }
  return (screens == null) ? EMPTY_SCREEN_DEVICE_ARRAY : screens;
}
Program: 107613
Project: 107613
Buggy source:
/** 
 * Returns the meta <tt>PacketTransformer</tt> that will be applying RTCP transformations from all engines registered in this <tt>TransformEngineChain</tt>.
 * @return a <tt>PacketTransformerChain</tt> over all RTCP transformers inthis engine chain.
 */
public PacketTransformer getRTCPTransformer(){
  return rtcpTransformChain;
}

Fixed version (ground truth):
/** 
 * Returns the meta <tt>PacketTransformer</tt> that will be applying RTCP transformations from all engines registered in this <tt>TransformEngineChain</tt>.
 * @return a <tt>PacketTransformerChain</tt> over all RTCP transformers inthis engine chain.
 */
public PacketTransformer getRTCPTransformer(){
  boolean invokeOnEngineChain;
  PacketTransformer rtpTransformer;
synchronized (this) {
    if (rtcpTransformChain == null) {
      rtcpTransformChain=new PacketTransformerChain(false);
      invokeOnEngineChain=true;
    }
 else {
      invokeOnEngineChain=false;
    }
    rtpTransformer=rtcpTransformChain;
  }
  if (invokeOnEngineChain) {
    for (    TransformEngine engine : engineChain)     engine.getRTCPTransformer();
  }
  return rtpTransformer;
}
Program: 107614
Project: 107614
Buggy source:
/** 
 * Creates a new <tt>TransformEngineChain</tt> using the <tt>engineChain</tt> array. Engines will be applied in the order specified by the <tt>engineChain</tt> array for outgoing packets and in the reverse order for incoming packets.
 * @param engineChain an array containing <tt>TransformEngine</tt>s in theorder that they are to be applied on outgoing packets.
 */
public TransformEngineChain(TransformEngine[] engineChain){
  this.engineChain=engineChain.clone();
  rtpTransformChain=new PacketTransformerChain(true);
  rtcpTransformChain=new PacketTransformerChain(false);
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>TransformEngineChain</tt> using the <tt>engineChain</tt> array. Engines will be applied in the order specified by the <tt>engineChain</tt> array for outgoing packets and in the reverse order for incoming packets.
 * @param engineChain an array containing <tt>TransformEngine</tt>s in theorder that they are to be applied on outgoing packets.
 */
public TransformEngineChain(TransformEngine[] engineChain){
  this.engineChain=engineChain.clone();
}
Program: 107615
Project: 107615
Buggy source:
/** 
 * Returns the meta <tt>PacketTransformer</tt> that will be applying RTCP transformations from all engines registered in this <tt>TransformEngineChain</tt>.
 * @return a <tt>PacketTransformerChain</tt> over all RTP transformers inthis engine chain.
 */
public PacketTransformer getRTPTransformer(){
  return rtpTransformChain;
}

Fixed version (ground truth):
/** 
 * Returns the meta <tt>PacketTransformer</tt> that will be applying RTCP transformations from all engines registered in this <tt>TransformEngineChain</tt>.
 * @return a <tt>PacketTransformerChain</tt> over all RTP transformers inthis engine chain.
 */
public PacketTransformer getRTPTransformer(){
  boolean invokeOnEngineChain;
  PacketTransformer rtpTransformer;
synchronized (this) {
    if (rtpTransformChain == null) {
      rtpTransformChain=new PacketTransformerChain(true);
      invokeOnEngineChain=true;
    }
 else {
      invokeOnEngineChain=false;
    }
    rtpTransformer=rtpTransformChain;
  }
  if (invokeOnEngineChain) {
    for (    TransformEngine engine : engineChain)     engine.getRTPTransformer();
  }
  return rtpTransformer;
}
Program: 107616
Project: 107616
Buggy source:
/** 
 * Copies the content of the most recently received packet into <tt>buffer</tt>.
 * @param buffer the <tt>byte[]</tt> that we'd like to copy the content ofthe packet to.
 * @param offset the position where we are supposed to start writing in<tt>buffer</tt>.
 * @param length the number of <tt>byte</tt>s available for writing in<tt>buffer</tt>.
 * @return the number of bytes read
 * @throws IOException if <tt>length</tt> is less than the size of thepacket.
 */
public int read(byte[] buffer,int offset,int length) throws IOException {
  if (ioError)   return -1;
  int pktLength=pkt.getLength();
  if (length < pktLength) {
    throw new IOException("String_Node_Str" + pktLength);
  }
  System.arraycopy(pkt.getBuffer(),pkt.getOffset(),buffer,offset,pktLength);
  return pktLength;
}

Fixed version (ground truth):
/** 
 * Copies the content of the most recently received packet into <tt>buffer</tt>.
 * @param buffer the <tt>byte[]</tt> that we'd like to copy the content ofthe packet to.
 * @param offset the position where we are supposed to start writing in<tt>buffer</tt>.
 * @param length the number of <tt>byte</tt>s available for writing in<tt>buffer</tt>.
 * @return the number of bytes read
 * @throws IOException if <tt>length</tt> is less than the size of thepacket.
 */
public int read(byte[] buffer,int offset,int length) throws IOException {
  if (buffer == null)   throw new NullPointerException("String_Node_Str");
  if (ioError)   return -1;
  RawPacket pkt;
synchronized (pktSyncRoot) {
    pkt=this.pkt;
    this.pkt=null;
  }
  int pktLength;
  if (pkt == null) {
    pktLength=0;
  }
 else {
    boolean poolPkt=true;
    try {
      pktLength=pkt.getLength();
      if (length < pktLength) {
        poolPkt=false;
        throw new IOException("String_Node_Str" + pktLength);
      }
 else {
        byte[] pktBuffer=pkt.getBuffer();
        if (pktBuffer == null) {
          throw new NullPointerException("String_Node_Str" + pktLength + "String_Node_Str"+ pkt.getOffset());
        }
 else {
          System.arraycopy(pkt.getBuffer(),pkt.getOffset(),buffer,offset,pktLength);
        }
      }
    }
  finally {
      if (!poolPkt) {
synchronized (pktSyncRoot) {
          if (this.pkt == null)           this.pkt=pkt;
 else           poolPkt=true;
        }
      }
      if (poolPkt) {
        pkt.setBuffer(null);
        pkt.setLength(0);
        pkt.setOffset(0);
        rawPacketPool.offer(pkt);
      }
    }
  }
  return pktLength;
}
Program: 107618
Project: 107618
Buggy source:
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getContentLength()} that always returns<tt>LENGTH_UNKNOWN</tt>.
 * @return <tt>LENGTH_UNKNOWN</tt>, no matter what.
 */
public long getContentLength(){
  return pkt.getLength();
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getContentLength()} that always returns<tt>LENGTH_UNKNOWN</tt>.
 * @return <tt>LENGTH_UNKNOWN</tt>, no matter what.
 */
public long getContentLength(){
  return LENGTH_UNKNOWN;
}
Program: 107619
Project: 107619
Buggy source:
/** 
 * Creates a new <tt>RawPacket</tt> from a specific <tt>DatagramPacket</tt> in order to have this instance receive its packet data through its  {@link #read(byte[],int,int)} method. Allows extenders to intercept thepacket data and possibly filter and/or modify it.
 * @param datagramPacket the <tt>DatagramPacket</tt> containing the packetdata
 * @return a new <tt>RawPacket</tt> containing the packet data of thespecified <tt>DatagramPacket</tt> or possibly its modification; <tt>null</tt> to ignore the packet data of the specified <tt>DatagramPacket</tt> and not make it available to this instance through its  {@link #read(byte[],int,int)} method
 */
protected RawPacket createRawPacket(DatagramPacket datagramPacket){
  if (pkt == null) {
    return new RawPacket(datagramPacket.getData(),datagramPacket.getOffset(),datagramPacket.getLength());
  }
  pkt.setBuffer(datagramPacket.getData());
  pkt.setLength(datagramPacket.getLength());
  pkt.setOffset(datagramPacket.getOffset());
  return pkt;
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>RawPacket</tt> from a specific <tt>DatagramPacket</tt> in order to have this instance receive its packet data through its  {@link #read(byte[],int,int)} method. Allows extenders to intercept thepacket data and possibly filter and/or modify it.
 * @param datagramPacket the <tt>DatagramPacket</tt> containing the packetdata
 * @return a new <tt>RawPacket</tt> containing the packet data of thespecified <tt>DatagramPacket</tt> or possibly its modification; <tt>null</tt> to ignore the packet data of the specified <tt>DatagramPacket</tt> and not make it available to this instance through its  {@link #read(byte[],int,int)} method
 */
protected RawPacket createRawPacket(DatagramPacket datagramPacket){
  RawPacket pkt=rawPacketPool.poll();
  if (pkt == null) {
    pkt=new RawPacket(datagramPacket.getData(),datagramPacket.getOffset(),datagramPacket.getLength());
  }
 else {
    pkt.setBuffer(datagramPacket.getData());
    pkt.setLength(datagramPacket.getLength());
    pkt.setOffset(datagramPacket.getOffset());
  }
  return pkt;
}
Program: 107620
Project: 107620
Buggy source:
/** 
 * {@inheritDoc}The implementation of <tt>DtlsControlImpl</tt> always returns <tt>true</tt>.
 */
public boolean requiresSecureSignalingTransport(){
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}The implementation of <tt>DtlsControlImpl</tt> always returns <tt>true</tt>.
 */
@Override public boolean requiresSecureSignalingTransport(){
  return true;
}
Program: 107621
Project: 107621
Buggy source:
/** 
 * {@inheritDoc}
 */
public String getLocalFingerprint(){
  return localFingerprint;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String getLocalFingerprint(){
  return localFingerprint;
}
Program: 107622
Project: 107622
Buggy source:
/** 
 * {@inheritDoc}
 */
public void start(MediaType mediaType){
  DtlsTransformEngine transformEngine=getTransformEngine();
  if (transformEngine != null)   transformEngine.start(mediaType);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void start(MediaType mediaType){
  DtlsTransformEngine transformEngine=getTransformEngine();
  if (transformEngine != null)   transformEngine.start(mediaType);
}
Program: 107623
Project: 107623
Buggy source:
/** 
 * {@inheritDoc}
 */
public void setRemoteFingerprints(Map<String,String> remoteFingerprints){
  if (remoteFingerprints == null)   throw new NullPointerException("String_Node_Str");
synchronized (this) {
    this.remoteFingerprints=remoteFingerprints;
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void setRemoteFingerprints(Map<String,String> remoteFingerprints){
  if (remoteFingerprints == null)   throw new NullPointerException("String_Node_Str");
synchronized (this) {
    this.remoteFingerprints=remoteFingerprints;
    notifyAll();
  }
}
Program: 107624
Project: 107624
Buggy source:
/** 
 * {@inheritDoc}
 */
public void setConnector(AbstractRTPConnector connector){
  if (this.connector != connector) {
    this.connector=connector;
    DtlsTransformEngine transformEngine=this.transformEngine;
    if (transformEngine != null)     transformEngine.setConnector(this.connector);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void setConnector(AbstractRTPConnector connector){
  if (this.connector != connector) {
    this.connector=connector;
    DtlsTransformEngine transformEngine=this.transformEngine;
    if (transformEngine != null)     transformEngine.setConnector(this.connector);
  }
}
Program: 107625
Project: 107625
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean getSecureCommunicationStatus(){
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean getSecureCommunicationStatus(){
  return false;
}
Program: 107626
Project: 107626
Buggy source:
/** 
 * {@inheritDoc}
 */
public String getLocalFingerprintHashFunction(){
  return localFingerprintHashFunction;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String getLocalFingerprintHashFunction(){
  return localFingerprintHashFunction;
}