nus-yam/ex-repair huggingface dataset:
Program: 103857
Project: 103857
Buggy source:
public void setReceiveBufferSize(int size) throws IOException {
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#setReceiveBufferSize(int)}.
 * @param size ignored.
 */
public void setReceiveBufferSize(int size) throws IOException {
}
Program: 103858
Project: 103858
Buggy source:
public int getReceiveBufferSize(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#getReceiveBufferSize()} that always returns <tt>-1</tt>.
 */
public int getReceiveBufferSize(){
  return -1;
}
Program: 103859
Project: 103859
Buggy source:
public double getRTCPBandwidthFraction(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#getRTCPBandwidthFraction()} that always returns <tt>-1</tt>.
 */
public double getRTCPBandwidthFraction(){
  return -1;
}
Program: 103860
Project: 103860
Buggy source:
public void setSendBufferSize(int size) throws IOException {
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#setSendBufferSize(int)}.
 * @param size ignored.
 */
public void setSendBufferSize(int size) throws IOException {
}
Program: 103861
Project: 103861
Buggy source:
public int getSendBufferSize(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#getSendBufferSize()} that always returns <tt>-1</tt>.
 */
public int getSendBufferSize(){
  return -1;
}
Program: 103862
Project: 103862
Buggy source:
public void close(){
  dataOutputStream=null;
  controlOutputStream=null;
  if (dataInputStream != null) {
    dataInputStream.close();
    dataInputStream=null;
  }
  if (controlInputStream != null) {
    controlInputStream.close();
    controlInputStream=null;
  }
  connector.close();
}

Fixed version (ground truth):
/** 
 * Closes all sockets, stream, and the <tt>StreamConnector</tt> that this <tt>RTPConnector</tt> is using.
 */
public void close(){
  dataOutputStream=null;
  controlOutputStream=null;
  if (dataInputStream != null) {
    dataInputStream.close();
    dataInputStream=null;
  }
  if (controlInputStream != null) {
    controlInputStream.close();
    controlInputStream=null;
  }
  connector.close();
}
Program: 103863
Project: 103863
Buggy source:
public double getRTCPSenderBandwidthFraction(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnector#getRTCPSenderBandwidthFraction()} that always returns<tt>-1</tt>.
 */
public double getRTCPSenderBandwidthFraction(){
  return -1;
}
Program: 103864
Project: 103864
Buggy source:
public PacketTransformerChain(boolean isRtp){
  this.isRtp=isRtp;
}

Fixed version (ground truth):
/** 
 * Creates an instance of this packet transformer and prepares it to deal with RTP or RTCP according to the <tt>isRtp</tt> arg.
 * @param isRtp <tt>true</tt> if this transformer will be dealing withRTP (i.e. will transform packets via the RTP transformers in this chain rather than the RTCP ones) and <tt>false</tt> otherwise.
 */
public PacketTransformerChain(boolean isRtp){
  this.isRtp=isRtp;
}
Program: 103865
Project: 103865
Buggy source:
/** 
 * Returns the list of CSRC identifiers for all parties currently known to contribute to the media that this stream is sending toward its remote counter part. In other words, the method returns the list of CSRC IDs that this stream will include in outgoing RTP packets. This method will return an <tt>null</tt> in case this stream is not part of a mixed conference call.
 * @return a <tt>long[]</tt> array of CSRC IDs representing parties that arecurrently known to contribute to the media that this stream is sending or an <tt>null</tt> in case this <tt>MediaStream</tt> is not part of a conference call.
 */
public long[] getLocalContributingSourceIDs(){
  if (this.deviceSession == null)   return null;
  MediaDeviceSession deviceSession=getDeviceSession();
  long[] ssrcArray=deviceSession.getRemoteSSRCList();
  List<Long> csrcList=new ArrayList<Long>(ssrcArray.length);
  for (  long csrc : ssrcArray) {
    if (csrc != this.getRemoteSourceID())     csrcList.add(csrc);
  }
  int cc=csrcList.size();
  if (cc == 0)   return null;
  long[] csrcArray=new long[cc];
  for (int i=0; i < csrcArray.length; i++) {
    csrcArray[i]=csrcList.get(i);
  }
  return csrcArray;
}

Fixed version (ground truth):
/** 
 * Returns the list of CSRC identifiers for all parties currently known to contribute to the media that this stream is sending toward its remote counter part. In other words, the method returns the list of CSRC IDs that this stream will include in outgoing RTP packets. This method will return an <tt>null</tt> in case this stream is not part of a mixed conference call.
 * @return a <tt>long[]</tt> array of CSRC IDs representing parties that arecurrently known to contribute to the media that this stream is sending or an <tt>null</tt> in case this <tt>MediaStream</tt> is not part of a conference call.
 */
public long[] getLocalContributingSourceIDs(){
  if (this.deviceSession == null)   return null;
  MediaDeviceSession deviceSession=getDeviceSession();
  long[] ssrcArray=deviceSession.getRemoteSSRCList();
  List<Long> csrcList=new ArrayList<Long>(ssrcArray.length);
  for (  long csrc : ssrcArray) {
    if (csrc != this.getRemoteSourceID()) {
      csrcList.add(csrc);
    }
 else {
    }
  }
  csrcList.add(getLocalSourceID());
  int cc=csrcList.size();
  if (cc == 0)   return null;
  long[] csrcArray=new long[cc];
  for (int i=0; i < csrcArray.length; i++) {
    csrcArray[i]=csrcList.get(i);
  }
  return csrcArray;
}
Program: 103866
Project: 103866
Buggy source:
/** 
 * Replaces the existing CSRC list (even if empty) with <tt>newCsrcList</tt> and updates the CC (CSRC count) field of this <tt>RawPacket</tt> accordingly.
 * @param newCsrcList the list of CSRC identifiers that we'd like to set forthis <tt>RawPacket</tt>.
 */
public void setCsrcList(long[] newCsrcList){
  int newCsrcCount=newCsrcList.length;
  byte[] csrcBuff=new byte[newCsrcCount * 4];
  int csrcOffset=0;
  for (  long csrc : newCsrcList) {
    csrcBuff[csrcOffset]=(byte)(csrc >> 24);
    csrcBuff[csrcOffset + 1]=(byte)(csrc >> 16);
    csrcBuff[csrcOffset + 2]=(byte)(csrc >> 8);
    csrcBuff[csrcOffset + 3]=(byte)csrc;
    csrcOffset+=4;
  }
  int oldCsrcCount=getCsrcCount();
  byte[] oldBuffer=this.getBuffer();
  byte[] newBuffer=new byte[oldBuffer.length + csrcBuff.length - oldCsrcCount * 4];
  System.arraycopy(oldBuffer,0,newBuffer,0,offset + FIXED_HEADER_SIZE);
  System.arraycopy(csrcBuff,0,newBuffer,offset + FIXED_HEADER_SIZE,csrcBuff.length);
  int payloadOffsetForOldBuff=offset + FIXED_HEADER_SIZE + oldCsrcCount * 4;
  int payloadOffsetForNewBuff=offset + FIXED_HEADER_SIZE + newCsrcCount * 4;
  System.arraycopy(oldBuffer,payloadOffsetForOldBuff,newBuffer,payloadOffsetForNewBuff,csrcBuff.length - payloadOffsetForOldBuff);
  newBuffer[offset]=(byte)((newBuffer[offset] & 0xF0b) & newCsrcCount);
}

Fixed version (ground truth):
/** 
 * Replaces the existing CSRC list (even if empty) with <tt>newCsrcList</tt> and updates the CC (CSRC count) field of this <tt>RawPacket</tt> accordingly.
 * @param newCsrcList the list of CSRC identifiers that we'd like to set forthis <tt>RawPacket</tt>.
 */
public void setCsrcList(long[] newCsrcList){
  int newCsrcCount=newCsrcList.length;
  byte[] csrcBuff=new byte[newCsrcCount * 4];
  int csrcOffset=0;
  for (  long csrc : newCsrcList) {
    csrcBuff[csrcOffset]=(byte)(csrc >> 24);
    csrcBuff[csrcOffset + 1]=(byte)(csrc >> 16);
    csrcBuff[csrcOffset + 2]=(byte)(csrc >> 8);
    csrcBuff[csrcOffset + 3]=(byte)csrc;
    csrcOffset+=4;
  }
  int oldCsrcCount=getCsrcCount();
  byte[] oldBuffer=this.getBuffer();
  byte[] newBuffer=new byte[oldBuffer.length + csrcBuff.length - oldCsrcCount * 4];
  System.arraycopy(oldBuffer,0,newBuffer,0,offset + FIXED_HEADER_SIZE);
  System.arraycopy(csrcBuff,0,newBuffer,offset + FIXED_HEADER_SIZE,csrcBuff.length);
  int payloadOffsetForOldBuff=offset + FIXED_HEADER_SIZE + oldCsrcCount * 4;
  int payloadOffsetForNewBuff=offset + FIXED_HEADER_SIZE + newCsrcCount * 4;
  System.arraycopy(oldBuffer,payloadOffsetForOldBuff,newBuffer,payloadOffsetForNewBuff,oldBuffer.length - payloadOffsetForOldBuff);
  newBuffer[offset]=(byte)((newBuffer[offset] & 0xF0) | newCsrcCount);
  this.buffer=newBuffer;
  this.length=newBuffer.length;
}
Program: 103867
Project: 103867
Buggy source:
/** 
 * Returns the number of CSRC identifiers currently included in this packet.
 * @return the CSRC count for this <tt>RawPacket</tt>.
 */
public int getCsrcCount(){
  return (buffer[offset] & 0x0fb);
}

Fixed version (ground truth):
/** 
 * Returns the number of CSRC identifiers currently included in this packet.
 * @return the CSRC count for this <tt>RawPacket</tt>.
 */
public int getCsrcCount(){
  return (buffer[offset] & 0x0f);
}
Program: 103868
Project: 103868
Buggy source:
/** 
 * Puts all <tt>MediaStream</tt>s in this handler locally on or off hold (according to the value of <tt>locallyOnHold</tt>). This would also be taken into account when the next update offer is generated.
 * @param locallyOnHold <tt>true</tt> if we are to make our audio streamstop transmitting and <tt>false</tt> if we are to start transmitting again.
 */
public void setLocallyOnHold(boolean locallyOnHold){
  this.locallyOnHold=locallyOnHold;
  if (locallyOnHold) {
    if (audioStream != null) {
      audioStream.setDirection(audioStream.getDirection().and(MediaDirection.SENDONLY));
      audioStream.setMute(locallyOnHold);
    }
    if (videoStream != null) {
      videoStream.setDirection(videoStream.getDirection().and(MediaDirection.SENDONLY));
      videoStream.setMute(locallyOnHold);
    }
  }
 else {
    if (audioStream != null) {
      audioStream.setDirection(audioStream.getDirection().or(MediaDirection.SENDONLY));
      audioStream.setMute(false);
    }
    if (videoStream != null) {
      videoStream.setDirection(videoStream.getDirection().or(MediaDirection.SENDONLY));
      videoStream.setMute(locallyOnHold);
    }
  }
}

Fixed version (ground truth):
/** 
 * Puts all <tt>MediaStream</tt>s in this handler locally on or off hold (according to the value of <tt>locallyOnHold</tt>). This would also be taken into account when the next update offer is generated.
 * @param locallyOnHold <tt>true</tt> if we are to make our audio streamstop transmitting and <tt>false</tt> if we are to start transmitting again.
 */
public void setLocallyOnHold(boolean locallyOnHold){
  this.locallyOnHold=locallyOnHold;
  if (locallyOnHold) {
    if (audioStream != null) {
      audioStream.setDirection(audioStream.getDirection().and(MediaDirection.SENDONLY));
      audioStream.setMute(locallyOnHold);
    }
    if (videoStream != null) {
      videoStream.setDirection(videoStream.getDirection().and(MediaDirection.SENDONLY));
      videoStream.setMute(locallyOnHold);
    }
  }
 else {
    if (audioStream != null) {
      audioStream.setDirection(audioStream.getDirection().or(MediaDirection.SENDONLY));
      audioStream.setMute(locallyOnHold);
    }
    if (videoStream != null) {
      videoStream.setDirection(videoStream.getDirection().or(MediaDirection.SENDONLY));
      videoStream.setMute(locallyOnHold);
    }
  }
}
Program: 103869
Project: 103869
Buggy source:
private SessionDescription createUpdateOffer(SessionDescription sdescToUpdate) throws OperationFailedException {
  Vector<MediaDescription> newMediaDescs=createMediaDescriptions();
  SessionDescription newOffer=SdpUtils.createSessionUpdateDescription(sdescToUpdate,getLastUsedLocalHost(),newMediaDescs);
  return newOffer;
}

Fixed version (ground truth):
private SessionDescription createUpdateOffer(SessionDescription sdescToUpdate) throws OperationFailedException {
  Vector<MediaDescription> newMediaDescs=createMediaDescriptions();
  SessionDescription newOffer=SdpUtils.createSessionUpdateDescription(sdescToUpdate,getLastUsedLocalHost(),newMediaDescs);
  this.localSess=newOffer;
  return newOffer;
}
Program: 103870
Project: 103870
Buggy source:
/** 
 * Sets our state to CONNECTED, sends an ACK and processes the SDP description in the <tt>ok</tt> <tt>Response</tt>.
 * @param clientTransaction the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param ok the OK <tt>Response</tt> to process
 */
public void processInviteOK(ClientTransaction clientTransaction,Response ok){
  try {
    getProtocolProvider().sendAck(clientTransaction);
  }
 catch (  InvalidArgumentException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
catch (  SipException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
  if (!CallPeerState.CONNECTING_WITH_EARLY_MEDIA.equals(getState())) {
    setSdpDescription(new String(ok.getRawContent()));
  }
  try {
    if (!CallPeerState.CONNECTING_WITH_EARLY_MEDIA.equals(getState())) {
      getMediaHandler().processAnswer(getSdpDescription());
    }
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    try {
      setState(CallPeerState.CONNECTED);
      hangup();
    }
 catch (    Exception e) {
    }
 finally {
      logAndFail("String_Node_Str",exc);
    }
    return;
  }
  if (!CallPeerState.isOnHold(getState()))   setState(CallPeerState.CONNECTED);
}

Fixed version (ground truth):
/** 
 * Sets our state to CONNECTED, sends an ACK and processes the SDP description in the <tt>ok</tt> <tt>Response</tt>.
 * @param clientTransaction the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param ok the OK <tt>Response</tt> to process
 */
public void processInviteOK(ClientTransaction clientTransaction,Response ok){
  try {
    getProtocolProvider().sendAck(clientTransaction);
  }
 catch (  InvalidArgumentException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
catch (  SipException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
  try {
    if (!CallPeerState.CONNECTING_WITH_EARLY_MEDIA.equals(getState())) {
      getMediaHandler().processAnswer(new String(ok.getRawContent()));
    }
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    try {
      setState(CallPeerState.CONNECTED);
      hangup();
    }
 catch (    Exception e) {
    }
 finally {
      logAndFail("String_Node_Str",exc);
    }
    return;
  }
  if (!CallPeerState.isOnHold(getState()))   setState(CallPeerState.CONNECTED);
}
Program: 103871
Project: 103871
Buggy source:
/** 
 * Reinitializes the media session of the <tt>CallPeer</tt> that this INVITE request is destined to.
 * @param serverTransaction a reference to the {@link ServerTransaction}that contains the reINVITE request.
 */
public void processReInvite(ServerTransaction serverTransaction){
  Request invite=serverTransaction.getRequest();
  setLatestInviteTransaction(serverTransaction);
  ContentLengthHeader cl=invite.getContentLength();
  if (cl != null && cl.getContentLength() > 0) {
    setSdpDescription(new String(invite.getRawContent()));
  }
  Response response=null;
  try {
    response=messageFactory.createResponse(Response.OK,invite);
    String sdpAnswer=getMediaHandler().processOffer(getSdpDescription());
    response.setContent(sdpAnswer,getProtocolProvider().getHeaderFactory().createContentTypeHeader("String_Node_Str","String_Node_Str"));
    logger.trace("String_Node_Str" + response);
    serverTransaction.sendResponse(response);
    logger.debug("String_Node_Str");
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    setState(CallPeerState.FAILED,"String_Node_Str" + ex.getMessage());
    getProtocolProvider().sayErrorSilently(serverTransaction,Response.SERVER_INTERNAL_ERROR);
    return;
  }
  reevalRemoteHoldStatus();
}

Fixed version (ground truth):
/** 
 * Reinitializes the media session of the <tt>CallPeer</tt> that this INVITE request is destined to.
 * @param serverTransaction a reference to the {@link ServerTransaction}that contains the reINVITE request.
 */
public void processReInvite(ServerTransaction serverTransaction){
  Request invite=serverTransaction.getRequest();
  setLatestInviteTransaction(serverTransaction);
  String sdp=null;
  ContentLengthHeader cl=invite.getContentLength();
  if (cl != null && cl.getContentLength() > 0) {
    sdp=new String(invite.getRawContent());
  }
  Response response=null;
  try {
    response=messageFactory.createResponse(Response.OK,invite);
    String sdpAnswer;
    if (sdp == null)     sdpAnswer=getMediaHandler().processOffer(sdp);
 else     sdpAnswer=getMediaHandler().createOffer();
    response.setContent(sdpAnswer,getProtocolProvider().getHeaderFactory().createContentTypeHeader("String_Node_Str","String_Node_Str"));
    logger.trace("String_Node_Str" + response);
    serverTransaction.sendResponse(response);
    logger.debug("String_Node_Str");
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    setState(CallPeerState.FAILED,"String_Node_Str" + ex.getMessage());
    getProtocolProvider().sayErrorSilently(serverTransaction,Response.SERVER_INTERNAL_ERROR);
    return;
  }
  reevalRemoteHoldStatus();
}
Program: 103872
Project: 103872
Buggy source:
/** 
 * Updates the session description and sends the state of the corresponding call peer to CONNECTED.
 * @param serverTransaction the transaction that the ACK was received in.
 * @param ack the ACK <tt>Request</tt> we need to process
 */
public void processAck(ServerTransaction serverTransaction,Request ack){
  ContentLengthHeader contentLength=ack.getContentLength();
  if ((contentLength != null) && (contentLength.getContentLength() > 0)) {
    setSdpDescription(new String(ack.getRawContent()));
  }
  CallPeerState peerState=getState();
  if (!CallPeerState.isOnHold(peerState)) {
    setState(CallPeerState.CONNECTED);
  }
}

Fixed version (ground truth):
/** 
 * Updates the session description and sends the state of the corresponding call peer to CONNECTED.
 * @param serverTransaction the transaction that the ACK was received in.
 * @param ack the ACK <tt>Request</tt> we need to process
 */
public void processAck(ServerTransaction serverTransaction,Request ack){
  ContentLengthHeader contentLength=ack.getContentLength();
  if ((contentLength != null) && (contentLength.getContentLength() > 0)) {
    try {
      getMediaHandler().processAnswer(new String(ack.getRawContent()));
    }
 catch (    Exception exc) {
      logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
      return;
    }
  }
  CallPeerState peerState=getState();
  if (!CallPeerState.isOnHold(peerState)) {
    setState(CallPeerState.CONNECTED);
  }
}
Program: 103873
Project: 103873
Buggy source:
/** 
 * Handles early media in 183 Session Progress responses. Retrieves the SDP and makes sure that we start transmitting and playing early media that we receive. Puts the call into a CONNECTING_WITH_EARLY_MEDIA state.
 * @param tran the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param response the 183 <tt>Response</tt> to process
 */
public void processSessionProgress(ClientTransaction tran,Response response){
  if (response.getContentLength().getContentLength() == 0) {
    logger.debug("String_Node_Str");
    return;
  }
  ContentTypeHeader contentTypeHeader=(ContentTypeHeader)response.getHeader(ContentTypeHeader.NAME);
  if (!contentTypeHeader.getContentType().equalsIgnoreCase("String_Node_Str") || !contentTypeHeader.getContentSubType().equalsIgnoreCase("String_Node_Str")) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  setSdpDescription(new String(response.getRawContent()));
  try {
    getMediaHandler().processAnswer(getSdpDescription());
  }
 catch (  Exception exc) {
    logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    return;
  }
  setState(CallPeerState.CONNECTING_WITH_EARLY_MEDIA);
}

Fixed version (ground truth):
/** 
 * Handles early media in 183 Session Progress responses. Retrieves the SDP and makes sure that we start transmitting and playing early media that we receive. Puts the call into a CONNECTING_WITH_EARLY_MEDIA state.
 * @param tran the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param response the 183 <tt>Response</tt> to process
 */
public void processSessionProgress(ClientTransaction tran,Response response){
  if (response.getContentLength().getContentLength() == 0) {
    logger.debug("String_Node_Str");
    return;
  }
  ContentTypeHeader contentTypeHeader=(ContentTypeHeader)response.getHeader(ContentTypeHeader.NAME);
  if (!contentTypeHeader.getContentType().equalsIgnoreCase("String_Node_Str") || !contentTypeHeader.getContentSubType().equalsIgnoreCase("String_Node_Str")) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  try {
    getMediaHandler().processAnswer(new String(response.getRawContent()));
  }
 catch (  Exception exc) {
    logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    return;
  }
  setState(CallPeerState.CONNECTING_WITH_EARLY_MEDIA);
}
Program: 103875
Project: 103875
Buggy source:
/** 
 * Overrides the
 */
public void setState(CallPeerState newState,String reason){
  super.setState(newState,reason);
  this.getMediaHandler().close();
}

Fixed version (ground truth):
/** 
 * Overrides the parent set state method in order to make sure that we close our media handler whenever we enter a disconnected state.
 * @param newState the <tt>CallPeerState</tt> that we are about to enter andthat we pass to our predecessor.
 * @param reason a reason phrase explaining the state (e.g. if newStateindicates a failure) and that we pass to our predecessor.
 */
public void setState(CallPeerState newState,String reason){
  super.setState(newState,reason);
  if (CallPeerState.DISCONNECTED.equals(newState) || CallPeerState.FAILED.equals(newState))   this.getMediaHandler().close();
}
Program: 103876
Project: 103876
Buggy source:
/** 
 * Creates a new call peer with address <tt>peerAddress</tt>.
 * @param peerAddress the JAIN SIP <tt>Address</tt> of the new call peer.
 * @param owningCall the call that contains this call peer.
 * @param containingTransaction the transaction that created the call peer.
 * @param sourceProvider the provider that the containingTransaction belongsto.
 */
public CallPeerSipImpl(Address peerAddress,CallSipImpl owningCall,Transaction containingTransaction,SipProvider sourceProvider){
  this.peerAddress=peerAddress;
  this.call=owningCall;
  this.parentOpSet=owningCall.getParentOperationSet();
  this.messageFactory=getProtocolProvider().getMessageFactory();
  this.mediaHandler=new CallPeerMediaHandler(this);
  setDialog(containingTransaction.getDialog());
  setLatestInviteTransaction(containingTransaction);
  setJainSipProvider(sourceProvider);
  this.peerID=String.valueOf(System.currentTimeMillis()) + String.valueOf(hashCode());
}

Fixed version (ground truth):
/** 
 * Creates a new call peer with address <tt>peerAddress</tt>.
 * @param peerAddress the JAIN SIP <tt>Address</tt> of the new call peer.
 * @param owningCall the call that contains this call peer.
 * @param containingTransaction the transaction that created the call peer.
 * @param sourceProvider the provider that the containingTransaction belongsto.
 */
public CallPeerSipImpl(Address peerAddress,CallSipImpl owningCall,Transaction containingTransaction,SipProvider sourceProvider){
  this.peerAddress=peerAddress;
  this.call=owningCall;
  this.messageFactory=getProtocolProvider().getMessageFactory();
  this.mediaHandler=new CallPeerMediaHandler(this);
  setDialog(containingTransaction.getDialog());
  setLatestInviteTransaction(containingTransaction);
  setJainSipProvider(sourceProvider);
  this.peerID=String.valueOf(System.currentTimeMillis()) + String.valueOf(hashCode());
}
Program: 103877
Project: 103877
Buggy source:
/** 
 * Creates a new call and sends a RINGING response.
 * @param jainSipProvider the provider containing<tt>sourceTransaction</tt>.
 * @param serverTran the transaction containing the received request.
 * @return CallPeerSipImpl the newly created call peer (the one that sentthe INVITE).
 */
public CallPeerSipImpl processInvite(SipProvider jainSipProvider,ServerTransaction serverTran){
  Request invite=serverTran.getRequest();
  CallPeerSipImpl peer=createCallPeerFor(serverTran,jainSipProvider);
  ContentLengthHeader cl=invite.getContentLength();
  if (cl != null && cl.getContentLength() > 0) {
    peer.setSdpDescription(new String(invite.getRawContent()));
  }
  Response response=null;
  try {
    logger.trace("String_Node_Str");
    response=messageFactory.createResponse(Response.RINGING,invite);
    serverTran.sendResponse(response);
    logger.debug("String_Node_Str" + response);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    peer.setState(CallPeerState.FAILED,"String_Node_Str" + ex.getMessage());
    return peer;
  }
  return peer;
}

Fixed version (ground truth):
/** 
 * Creates a new call and sends a RINGING response.
 * @param jainSipProvider the provider containing<tt>sourceTransaction</tt>.
 * @param serverTran the transaction containing the received request.
 * @return CallPeerSipImpl the newly created call peer (the one that sentthe INVITE).
 */
public CallPeerSipImpl processInvite(SipProvider jainSipProvider,ServerTransaction serverTran){
  Request invite=serverTran.getRequest();
  CallPeerSipImpl peer=createCallPeerFor(serverTran,jainSipProvider);
  Response response=null;
  try {
    logger.trace("String_Node_Str");
    response=messageFactory.createResponse(Response.RINGING,invite);
    serverTran.sendResponse(response);
    logger.debug("String_Node_Str" + response);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    peer.setState(CallPeerState.FAILED,"String_Node_Str" + ex.getMessage());
    return peer;
  }
  return peer;
}
Program: 103879
Project: 103879
Buggy source:
/** 
 * Register in JMF the custom codecs we provide
 */
@SuppressWarnings("String_Node_Str") public void registerCustomCodecs(){
  Collection<String> registeredPlugins=new HashSet<String>(PlugInManager.getPlugInList(null,null,PlugInManager.CODEC));
  boolean commit=false;
  for (  String className : CUSTOM_CODECS) {
    if (className == null)     continue;
    if (registeredPlugins.contains(className)) {
      logger.debug("String_Node_Str" + className + "String_Node_Str");
    }
 else {
      commit=true;
      boolean registered;
      Throwable exception=null;
      try {
        Codec codec=(Codec)Class.forName(className).newInstance();
        registered=PlugInManager.addPlugIn(className,codec.getSupportedInputFormats(),codec.getSupportedOutputFormats(null),PlugInManager.CODEC);
      }
 catch (      Throwable ex) {
        registered=false;
        exception=ex;
      }
      if (registered)       logger.debug("String_Node_Str" + className + "String_Node_Str");
 else       logger.debug("String_Node_Str" + className + "String_Node_Str",exception);
    }
  }
  if (commit)   try {
    PlugInManager.commit();
  }
 catch (  IOException ex) {
    logger.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * Register in JMF the custom codecs we provide
 */
public void registerCustomCodecs(){
  @SuppressWarnings("String_Node_Str") Collection<String> registeredPlugins=new HashSet<String>(PlugInManager.getPlugInList(null,null,PlugInManager.CODEC));
  boolean commit=false;
  for (  String className : CUSTOM_CODECS) {
    if (className == null)     continue;
    if (registeredPlugins.contains(className)) {
      logger.debug("String_Node_Str" + className + "String_Node_Str");
    }
 else {
      commit=true;
      boolean registered;
      Throwable exception=null;
      try {
        Codec codec=(Codec)Class.forName(className).newInstance();
        registered=PlugInManager.addPlugIn(className,codec.getSupportedInputFormats(),codec.getSupportedOutputFormats(null),PlugInManager.CODEC);
      }
 catch (      Throwable ex) {
        registered=false;
        exception=ex;
      }
      if (registered)       logger.debug("String_Node_Str" + className + "String_Node_Str");
 else       logger.debug("String_Node_Str" + className + "String_Node_Str",exception);
    }
  }
  if (commit)   try {
    PlugInManager.commit();
  }
 catch (  IOException ex) {
    logger.error("String_Node_Str",ex);
  }
}
Program: 103880
Project: 103880
Buggy source:
public MediaFormat[] getSupportedEncodings(MediaType type){
  Set<MediaFormat> supportedEncodings;
switch (type) {
case AUDIO:
    supportedEncodings=supportedAudioEncodings;
  break;
case VIDEO:
supportedEncodings=supportedVideoEncodings;
break;
default :
return MediaUtils.EMPTY_MEDIA_FORMATS;
}
return supportedEncodings.toArray(new MediaFormat[supportedEncodings.size()]);
}

Fixed version (ground truth):
/** 
 * Gets the supported <tt>MediaFormat</tt>s i.e. the enabled available <tt>MediaFormat</tt>s sorted in decreasing priority.
 * @param type the <tt>MediaType</tt> of the supported <tt>MediaFormat</tt>sto get
 * @return an array of the supported <tt>MediaFormat</tt>s i.e. the enabledavailable <tt>MediaFormat</tt>s sorted in decreasing priority
 */
public MediaFormat[] getSupportedEncodings(MediaType type){
  Set<MediaFormat> supportedEncodings;
switch (type) {
case AUDIO:
    if (supportedAudioEncodings == null)     supportedAudioEncodings=updateSupportedEncodings(type);
  supportedEncodings=supportedAudioEncodings;
break;
case VIDEO:
if (supportedVideoEncodings == null) supportedVideoEncodings=updateSupportedEncodings(type);
supportedEncodings=supportedVideoEncodings;
break;
default :
return MediaUtils.EMPTY_MEDIA_FORMATS;
}
return supportedEncodings.toArray(new MediaFormat[supportedEncodings.size()]);
}
Program: 103881
Project: 103881
Buggy source:
/** 
 * Updates the codecs in the supported sets according preferences in encodingPreferences. If value is "0" the codec is disabled.
 */
private void updateSupportedEncodings(){
  for (  MediaFormat format : getAvailableEncodings(MediaType.AUDIO)) {
    Integer pref1=encodingPreferences.get(format);
    int pref1IntValue=(pref1 == null) ? 0 : pref1;
    if (pref1IntValue > 0)     supportedAudioEncodings.add(format);
 else     supportedAudioEncodings.remove(format);
  }
  for (  MediaFormat format : getAvailableEncodings(MediaType.VIDEO)) {
    Integer pref1=encodingPreferences.get(format);
    int pref1IntValue=(pref1 == null) ? 0 : pref1;
    if (pref1IntValue > 0)     supportedVideoEncodings.add(format);
 else     supportedVideoEncodings.remove(format);
  }
}

Fixed version (ground truth):
/** 
 * Gets the <tt>Set</tt> of enabled available <tt>MediaFormat</tt>s with the specified <tt>MediaType</tt> sorted in decreasing priority.
 * @param type the <tt>MediaType</tt> of the <tt>MediaFormat</tt>s to get
 * @return a <tt>Set</tt> of enabled available <tt>MediaFormat</tt>s withthe specified <tt>MediaType</tt> sorted in decreasing priority
 */
private Set<MediaFormat> updateSupportedEncodings(MediaType type){
  Set<MediaFormat> supported=new TreeSet<MediaFormat>(encodingComparator);
  for (  MediaFormat format : getAvailableEncodings(type))   if (getPriority(format) > 0)   supported.add(format);
  return supported;
}
Program: 103882
Project: 103882
Buggy source:
/** 
 * Register in JMF the custom packages we provide
 */
@SuppressWarnings("String_Node_Str") public void registerCustomPackages(){
  Vector<String> currentPackagePrefix=PackageManager.getProtocolPrefixList();
  for (  String className : CUSTOM_PACKAGES) {
    if (!currentPackagePrefix.contains(className)) {
      currentPackagePrefix.add(className);
      logger.debug("String_Node_Str" + className);
    }
  }
  PackageManager.setProtocolPrefixList(currentPackagePrefix);
  PackageManager.commitProtocolPrefixList();
  logger.debug("String_Node_Str" + currentPackagePrefix);
}

Fixed version (ground truth):
/** 
 * Register in JMF the custom packages we provide
 */
public void registerCustomPackages(){
  @SuppressWarnings("String_Node_Str") Vector<String> currentPackagePrefix=PackageManager.getProtocolPrefixList();
  for (  String className : CUSTOM_PACKAGES) {
    if (!currentPackagePrefix.contains(className)) {
      currentPackagePrefix.add(className);
      logger.debug("String_Node_Str" + className);
    }
  }
  PackageManager.setProtocolPrefixList(currentPackagePrefix);
  PackageManager.commitProtocolPrefixList();
  logger.debug("String_Node_Str" + currentPackagePrefix);
}
Program: 103883
Project: 103883
Buggy source:
/** 
 * Sets <tt>pref</tt> as the preference associated with <tt>encoding</tt>. Use this method for both audio and video encodings and don't worry if preferences are equal since we rarely need to compare prefs of video encodings to those of audio encodings.
 * @param encoding a string containing the SDP int of the encoding whosepref we're setting.
 * @param priority a positive int indicating the preference for that encoding.
 */
public void setPriority(MediaFormat encoding,int priority){
  encodingPreferences.put(encoding,priority);
  NeomediaActivator.getConfigurationService().setProperty(PROP_SDP_PREFERENCE + "String_Node_Str" + encoding.getEncoding()+ "String_Node_Str"+ ((long)encoding.getClockRate()),priority);
  updateSupportedEncodings();
}

Fixed version (ground truth):
/** 
 * Sets <tt>pref</tt> as the preference associated with <tt>encoding</tt>. Use this method for both audio and video encodings and don't worry if preferences are equal since we rarely need to compare prefs of video encodings to those of audio encodings.
 * @param encoding a string containing the SDP int of the encoding whosepref we're setting.
 * @param priority a positive int indicating the preference for that encoding.
 */
public void setPriority(MediaFormat encoding,int priority){
  encodingPreferences.put(encoding,priority);
  NeomediaActivator.getConfigurationService().setProperty(PROP_SDP_PREFERENCE + "String_Node_Str" + encoding.getEncoding()+ "String_Node_Str"+ encoding.getClockRateString(),priority);
  updateSupportedEncodings();
}
Program: 103885
Project: 103885
Buggy source:
/** 
 * Gets the output <tt>DataSource</tt> of this instance which provides the captured (RTP) data to be sent by <tt>MediaStream</tt> to <tt>MediaStreamTarget</tt>.
 * @return the output <tt>DataSource</tt> of this instance which providesthe captured (RTP) data to be sent by <tt>MediaStream</tt> to <tt>MediaStreamTarget</tt>
 */
public DataSource getOutputDataSource(){
  Processor processor=getProcessor();
  return (processor == null) ? null : processor.getDataOutput();
}

Fixed version (ground truth):
/** 
 * Gets the output <tt>DataSource</tt> of this instance which provides the captured (RTP) data to be sent by <tt>MediaStream</tt> to <tt>MediaStreamTarget</tt>.
 * @return the output <tt>DataSource</tt> of this instance which providesthe captured (RTP) data to be sent by <tt>MediaStream</tt> to <tt>MediaStreamTarget</tt>
 */
public DataSource getOutputDataSource(){
  Processor processor=getProcessor();
  DataSource outputDataSource;
  if ((processor == null) || ((processor.getState() < Processor.Realized) && !waitForState(processor,Processor.Realized)))   outputDataSource=null;
 else   outputDataSource=processor.getDataOutput();
  return outputDataSource;
}
Program: 103887
Project: 103887
Buggy source:
/** 
 * The input data stream calls this method to transform incoming packets.
 * @see PacketTransformer#reverseTransform(RawPacket)
 */
public RawPacket reverseTransform(RawPacket pkt){
  if (!started && enableZrtp) {
    startZrtp();
  }
  byte[] buffer=pkt.getBuffer();
  int offset=pkt.getOffset();
  if ((buffer[offset] & 0x10) != 0x10) {
    if (srtpInTransformer == null) {
      return pkt;
    }
    pkt=srtpInTransformer.reverseTransform(pkt);
    if (pkt != null && started && zrtpEngine.inState(ZrtpStateClass.ZrtpStates.WaitConfAck)) {
      zrtpEngine.conf2AckSecure();
    }
    return pkt;
  }
  if (enableZrtp) {
    ZrtpRawPacket zPkt=new ZrtpRawPacket(pkt);
    if (!zPkt.checkCrc()) {
      securityEventManager.showMessage(ZrtpCodes.MessageSeverity.Warning,EnumSet.of(ZrtpCodes.WarningCodes.WarningCRCmismatch));
      return null;
    }
    if (!zPkt.hasMagic() || zrtpEngine == null) {
      return null;
    }
    byte[] extHeader=zPkt.getMessagePart();
    zrtpEngine.processZrtpMessage(extHeader,zPkt.getSSRC());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * The input data stream calls this method to transform incoming packets.
 * @see PacketTransformer#reverseTransform(RawPacket)
 */
public RawPacket reverseTransform(RawPacket pkt){
  if (!started && enableZrtp && ownSSRC != 0) {
    startZrtp();
  }
  byte[] buffer=pkt.getBuffer();
  int offset=pkt.getOffset();
  if ((buffer[offset] & 0x10) != 0x10) {
    if (srtpInTransformer == null) {
      return pkt;
    }
    pkt=srtpInTransformer.reverseTransform(pkt);
    if (pkt != null && started && zrtpEngine.inState(ZrtpStateClass.ZrtpStates.WaitConfAck)) {
      zrtpEngine.conf2AckSecure();
    }
    return pkt;
  }
  if (enableZrtp && ownSSRC != 0) {
    ZrtpRawPacket zPkt=new ZrtpRawPacket(pkt);
    if (!zPkt.checkCrc()) {
      securityEventManager.showMessage(ZrtpCodes.MessageSeverity.Warning,EnumSet.of(ZrtpCodes.WarningCodes.WarningCRCmismatch));
      return null;
    }
    if (!zPkt.hasMagic() || zrtpEngine == null) {
      return null;
    }
    byte[] extHeader=zPkt.getMessagePart();
    zrtpEngine.processZrtpMessage(extHeader,zPkt.getSSRC());
  }
  return null;
}
Program: 103888
Project: 103888
Buggy source:
/** 
 * Adds a custom component at the end of the conversation.
 * @param component the component to add at the end of the conversation.
 */
public void addComponent(ChatConversationComponent component){
  Style style=document.getStyleSheet().addStyle(StyleConstants.ComponentElementName,document.getStyleSheet().getStyle("String_Node_Str"));
  style.addAttribute(AbstractDocument.ElementNameAttribute,StyleConstants.ComponentElementName);
  TransparentPanel wrapPanel=new TransparentPanel(new BorderLayout());
  wrapPanel.add(component,BorderLayout.NORTH);
  style.addAttribute(StyleConstants.ComponentAttribute,wrapPanel);
  style.addAttribute("String_Node_Str","String_Node_Str");
  style.addAttribute("String_Node_Str",component.getDate().getTime());
  try {
    document.insertString(document.getLength(),"String_Node_Str",style);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
  this.setCarretToEnd();
}

Fixed version (ground truth):
/** 
 * Adds a custom component at the end of the conversation.
 * @param component the component to add at the end of the conversation.
 */
public void addComponent(ChatConversationComponent component){
  Style style=document.getStyleSheet().addStyle(StyleConstants.ComponentElementName,document.getStyleSheet().getStyle("String_Node_Str"));
  style.addAttribute(AbstractDocument.ElementNameAttribute,StyleConstants.ComponentElementName);
  TransparentPanel wrapPanel=new TransparentPanel(new BorderLayout());
  wrapPanel.add(component,BorderLayout.NORTH);
  style.addAttribute(StyleConstants.ComponentAttribute,wrapPanel);
  style.addAttribute("String_Node_Str","String_Node_Str");
  style.addAttribute("String_Node_Str",component.getDate().getTime());
  try {
    document.insertString(document.getLength(),"String_Node_Str",style);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
  this.scrollToBottom();
}
Program: 103889
Project: 103889
Buggy source:
/** 
 * Inserts the given string at the beginning of the contained in this panel document.
 * @param chatString the string to insert
 */
public void insertMessageAfterStart(String chatString){
  Element root=this.document.getDefaultRootElement();
  try {
    this.document.insertBeforeStart(root.getElement(0),chatString);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  if (!isHistory)   this.ensureDocumentSize();
  this.setCarretToEnd();
}

Fixed version (ground truth):
/** 
 * Inserts the given string at the beginning of the contained in this panel document.
 * @param chatString the string to insert
 */
public void insertMessageAfterStart(String chatString){
  Element root=this.document.getDefaultRootElement();
  try {
    this.document.insertBeforeStart(root.getElement(0),chatString);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  if (!isHistory)   this.ensureDocumentSize();
  this.scrollToBottom();
}
Program: 103890
Project: 103890
Buggy source:
/** 
 * Highlights keywords searched in the history.
 * @param message the source message
 * @param keyword the searched keyword
 * @return the formatted message
 */
private String processKeyword(String message,String contentType,String keyword){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType != null && contentType.equals(HTML_CONTENT_TYPE)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    startPlainTextTag=START_PLAINTEXT_TAG;
    endPlainTextTag=END_PLAINTEXT_TAG;
  }
  Pattern p=Pattern.compile(keyword,Pattern.CASE_INSENSITIVE);
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement=endPlainTextTag + "String_Node_Str" + matchGroup+ "String_Node_Str"+ startPlainTextTag;
    m.appendReplacement(msgBuffer,GuiUtils.replaceSpecialRegExpChars(replacement));
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Highlights keywords searched in the history.
 * @param message the source message
 * @param contentType the content type
 * @param keyword the searched keyword
 * @return the formatted message
 */
private String processKeyword(String message,String contentType,String keyword){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType != null && contentType.equals(HTML_CONTENT_TYPE)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    startPlainTextTag=START_PLAINTEXT_TAG;
    endPlainTextTag=END_PLAINTEXT_TAG;
  }
  Pattern p=Pattern.compile(keyword,Pattern.CASE_INSENSITIVE);
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement=endPlainTextTag + "String_Node_Str" + matchGroup+ "String_Node_Str"+ startPlainTextTag;
    m.appendReplacement(msgBuffer,GuiUtils.replaceSpecialRegExpChars(replacement));
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}
Program: 103891
Project: 103891
Buggy source:
/** 
 * Formats message smileys.
 * @param message The source message string.
 * @return The message string with properly formated smileys.
 */
private String processSmileys(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (!HTML_CONTENT_TYPE.equals(contentType)) {
    startPlainTextTag=START_PLAINTEXT_TAG;
    endPlainTextTag=END_PLAINTEXT_TAG;
  }
 else {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  Collection<Smiley> smileys=ImageLoader.getDefaultSmileyPack();
  Matcher m=getSmileyPattern(smileys).matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  int prevEnd=0;
  while (m.find()) {
    msgBuffer.append(message.substring(prevEnd,m.start()));
    prevEnd=m.end();
    String smileyString=m.group().trim();
    msgBuffer.append(endPlainTextTag);
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(ImageLoader.getSmiley(smileyString).getImagePath());
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(smileyString);
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(startPlainTextTag);
  }
  msgBuffer.append(message.substring(prevEnd));
  return msgBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Formats message smileys.
 * @param message the source message string
 * @param contentType the content type
 * @return the message string with properly formated smileys
 */
private String processSmileys(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (!HTML_CONTENT_TYPE.equals(contentType)) {
    startPlainTextTag=START_PLAINTEXT_TAG;
    endPlainTextTag=END_PLAINTEXT_TAG;
  }
 else {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  Collection<Smiley> smileys=ImageLoader.getDefaultSmileyPack();
  Matcher m=getSmileyPattern(smileys).matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  int prevEnd=0;
  while (m.find()) {
    msgBuffer.append(message.substring(prevEnd,m.start()));
    prevEnd=m.end();
    String smileyString=m.group().trim();
    msgBuffer.append(endPlainTextTag);
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(ImageLoader.getSmiley(smileyString).getImagePath());
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(smileyString);
    msgBuffer.append("String_Node_Str");
    msgBuffer.append(startPlainTextTag);
  }
  msgBuffer.append(message.substring(prevEnd));
  return msgBuffer.toString();
}
Program: 103892
Project: 103892
Buggy source:
/** 
 * Appends the given string at the end of the contained in this panel document.
 * @param chatString the string to append
 */
public void appendMessageToEnd(String chatString){
  Element root=this.document.getDefaultRootElement();
  try {
    this.document.insertAfterEnd(root.getElement(root.getElementCount() - 1),chatString);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  if (!isHistory)   this.ensureDocumentSize();
  this.setCarretToEnd();
}

Fixed version (ground truth):
/** 
 * Appends the given string at the end of the contained in this panel document.
 * @param chatString the string to append
 */
public void appendMessageToEnd(String chatString){
  Element root=this.document.getDefaultRootElement();
  try {
    this.document.insertAfterEnd(root.getElement(root.getElementCount() - 1),chatString);
  }
 catch (  BadLocationException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  if (!isHistory)   this.ensureDocumentSize();
  this.scrollToBottom();
}
Program: 103893
Project: 103893
Buggy source:
/** 
 * Returns the string to be used as the tooltip for <i>event</i>. 
 * @return the string to be used as the tooltip for <i>event</i>.
 */
public String getToolTipText(MouseEvent event){
  if (currentHref != null && currentHref.length() != 0)   return currentHref;
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the string to be used as the tooltip for <i>event</i>. 
 * @param event the <tt>MouseEvent</tt> 
 * @return the string to be used as the tooltip for <i>event</i>.
 */
public String getToolTipText(MouseEvent event){
  if (currentHref != null && currentHref.length() != 0)   return currentHref;
 else   return null;
}
Program: 103894
Project: 103894
Buggy source:
/** 
 * Returns the text contained in the write area editor.
 * @return The text contained in the write area editor.
 */
public String getTextFromWriteArea(String mimeType){
  if (mimeType.equals(OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE)) {
    return writeMessagePanel.getText();
  }
 else {
    return writeMessagePanel.getTextAsHtml();
  }
}

Fixed version (ground truth):
/** 
 * Returns the text contained in the write area editor.
 * @param mimeType the mime type
 * @return The text contained in the write area editor.
 */
public String getTextFromWriteArea(String mimeType){
  if (mimeType.equals(OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE)) {
    return writeMessagePanel.getText();
  }
 else {
    return writeMessagePanel.getTextAsHtml();
  }
}