nus-yam/ex-repair huggingface dataset:
Program: 103573
Project: 103573
Buggy source:
/** 
 * Wraps up any ongoing candidate harvests and returns our response to the last offer we've received, so that the peer could use it to send a <tt>session-accept</tt>.
 * @return  the last generated list of {@link ContentPacketExtension}s that the call peer could use to send a <tt>session-accept</tt>.
 * @throws OperationFailedException if we fail to configure the media stream
 */
protected List<ContentPacketExtension> generateSessionAccept() throws OperationFailedException {
  List<ContentPacketExtension> sessAccept=getTransportManager().wrapupHarvest();
  for (  ContentPacketExtension content : sessAccept) {
    RtpDescriptionPacketExtension description=JingleUtils.getRtpDescription(content);
    MediaType type=MediaType.parseString(description.getMedia());
    StreamConnector connector=getTransportManager().getStreamConnector(type);
    MediaDevice dev=getDefaultDevice(type);
    MediaStreamTarget target=JingleUtils.extractDefaultTarget(content);
    MediaDirection direction=JingleUtils.getDirection(content,!peer.isInitiator());
    MediaFormat format=JingleUtils.payloadTypeToMediaFormat(description.getPayloadTypes().get(0),getDynamicPayloadTypes());
    List<RTPExtension> rtpExtensions=JingleUtils.extractRTPExtensions(description,this.getRtpExtensionsRegistry());
    initStream(connector,dev,format,target,direction,rtpExtensions);
  }
  return sessAccept;
}

Fixed version (ground truth):
/** 
 * Wraps up any ongoing candidate harvests and returns our response to the last offer we've received, so that the peer could use it to send a <tt>session-accept</tt>.
 * @return  the last generated list of {@link ContentPacketExtension}s that the call peer could use to send a <tt>session-accept</tt>.
 * @throws OperationFailedException if we fail to configure the media stream
 */
protected List<ContentPacketExtension> generateSessionAccept() throws OperationFailedException {
  List<ContentPacketExtension> sessAccept=getTransportManager().wrapupHarvest();
  for (  ContentPacketExtension ourContent : sessAccept) {
    RtpDescriptionPacketExtension description=JingleUtils.getRtpDescription(ourContent);
    MediaType type=MediaType.parseString(description.getMedia());
    StreamConnector connector=getTransportManager().getStreamConnector(type);
    MediaDevice dev=getDefaultDevice(type);
    ContentPacketExtension theirContent=this.remoteContentMap.get(ourContent.getName());
    MediaStreamTarget target=JingleUtils.extractDefaultTarget(theirContent);
    MediaDirection direction=JingleUtils.getDirection(ourContent,!peer.isInitiator());
    MediaFormat format=JingleUtils.payloadTypeToMediaFormat(description.getPayloadTypes().get(0),getDynamicPayloadTypes());
    List<RTPExtension> rtpExtensions=JingleUtils.extractRTPExtensions(description,this.getRtpExtensionsRegistry());
    initStream(connector,dev,format,target,direction,rtpExtensions);
  }
  return sessAccept;
}
Program: 103575
Project: 103575
Buggy source:
/** 
 * ZRTP computes the SAS string after nearly all the negotiation and computations are done internally.
 * @param sas 	The string containing the SAS.
 * @param isVerified is sas verified.
 */
@Override public void showSAS(String sas,boolean isVerified){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str" + sas);
  this.sas=sas;
  this.isSasVerified=isVerified;
}

Fixed version (ground truth):
/** 
 * ZRTP computes the SAS string after nearly all the negotiation and computations are done internally.
 * @param sas     The string containing the SAS.
 * @param isVerified is sas verified.
 */
@Override public void showSAS(String sas,boolean isVerified){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str" + sas);
  this.sas=sas;
  this.isSasVerified=isVerified;
}
Program: 103576
Project: 103576
Buggy source:
/** 
 * Inform user interface that security is not active any more. 
 */
@Override public void secureOff(){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str");
  securityListener.securityTurnedOff(sessionType);
}

Fixed version (ground truth):
/** 
 * Inform user interface that security is not active any more.
 */
@Override public void secureOff(){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str");
  securityListener.securityTurnedOff(sessionType);
}
Program: 103577
Project: 103577
Buggy source:
/** 
 * Inform the user that ZRTP received "go clear" message from its peer. 
 */
@Override public void confirmGoClear(){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Inform the user that ZRTP received "go clear" message from its peer.
 */
@Override public void confirmGoClear(){
  if (logger.isDebugEnabled())   logger.debug(sessionTypeToString(sessionType) + "String_Node_Str");
}
Program: 103579
Project: 103579
Buggy source:
/** 
 * Puts the specified <tt>CallPeer</tt> on or off hold.
 * @param peer the <tt>CallPeer</tt> to be put on or off hold
 * @param on <tt>true</tt> to have the specified <tt>CallPeer</tt>put on hold; <tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to send the "hold" message.
 */
private void putOnHold(CallPeer peer,boolean on) throws OperationFailedException {
  CallPeerJabberImpl jabberPeer=(CallPeerJabberImpl)peer;
}

Fixed version (ground truth):
/** 
 * Puts the specified <tt>CallPeer</tt> on or off hold.
 * @param peer the <tt>CallPeer</tt> to be put on or off hold
 * @param on <tt>true</tt> to have the specified <tt>CallPeer</tt>put on hold; <tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to send the "hold" message.
 */
private void putOnHold(CallPeer peer,boolean on) throws OperationFailedException {
  CallPeerJabberImpl jabberPeer=(CallPeerJabberImpl)peer;
  jabberPeer.putOnHold(on);
}
Program: 103580
Project: 103580
Buggy source:
/** 
 * Creates a   {@link JingleIQ} <tt>session-info</tt> packet carrying a<tt>ringing</tt> payload.
 * @param sessionInitiate the {@link JingleIQ} that established the sessionwhich the response is going to belong to.
 * @return a {@link JingleIQ} <tt>session-info</tt> packet carrying a<tt>ringing</tt> payload.
 */
public static JingleIQ createRinging(JingleIQ sessionInitiate){
  JingleIQ ringing=new JingleIQ();
  ringing.setTo(sessionInitiate.getFrom());
  ringing.setFrom(sessionInitiate.getTo());
  ringing.setType(IQ.Type.SET);
  ringing.setSID(sessionInitiate.getSID());
  ringing.setAction(JingleAction.SESSION_INFO);
  SessionInfoPacketExtension ringingPayload=new SessionInfoPacketExtension(SessionInfoType.ringing);
  ringing.setSessionInfo(ringingPayload);
  return ringing;
}

Fixed version (ground truth):
/** 
 * Creates a   {@link JingleIQ} <tt>session-info</tt> packet carrying a<tt>ringing</tt> payload.
 * @param sessionInitiate the {@link JingleIQ} that established the sessionwhich the response is going to belong to.
 * @return a {@link JingleIQ} <tt>session-info</tt> packet carrying a<tt>ringing</tt> payload.
 */
public static JingleIQ createRinging(JingleIQ sessionInitiate){
  return createSessionInfo(sessionInitiate.getFrom(),sessionInitiate.getTo(),sessionInitiate.getSID(),SessionInfoType.ringing);
}
Program: 103581
Project: 103581
Buggy source:
public void run(){
  if (currentImage == null) {
    byte[] accountImage=AccountInfoUtils.getImage(accountInfoOpSet);
    if ((accountImage != null) && (accountImage.length > 0)) {
      currentImage=accountImage;
      accountImageLabel.setImageIcon(currentImage);
    }
  }
  String accountName=null;
  if (currentFirstName == null) {
    String firstName=AccountInfoUtils.getFirstName(accountInfoOpSet);
    if (firstName != null && firstName.length() > 0) {
      currentFirstName=firstName;
      accountName=currentFirstName;
    }
  }
  if (currentLastName == null) {
    String lastName=AccountInfoUtils.getLastName(accountInfoOpSet);
    if (lastName != null && lastName.length() > 0) {
      currentLastName=lastName;
      if (accountName != null)       accountName+="String_Node_Str";
      accountName+=currentLastName;
    }
  }
  if (currentFirstName == null && currentLastName == null) {
    String displayName=AccountInfoUtils.getDisplayName(accountInfoOpSet);
    if (displayName != null)     accountName=displayName;
  }
  if (accountName != null && accountName.length() > 0)   accountNameLabel.setText(accountName);
}

Fixed version (ground truth):
public void run(){
  if (currentImage == null) {
    byte[] accountImage=AccountInfoUtils.getImage(accountInfoOpSet);
    if ((accountImage != null) && (accountImage.length > 0)) {
      currentImage=accountImage;
      accountImageLabel.setImageIcon(currentImage);
    }
  }
  String accountName=null;
  if (currentFirstName == null) {
    String firstName=AccountInfoUtils.getFirstName(accountInfoOpSet);
    if (firstName != null && firstName.length() > 0) {
      currentFirstName=firstName;
      accountName=currentFirstName;
    }
  }
  if (currentLastName == null) {
    String lastName=AccountInfoUtils.getLastName(accountInfoOpSet);
    if (lastName != null && lastName.length() > 0) {
      currentLastName=lastName;
      if ((accountName == null) || (accountName.length() == 0))       accountName=currentLastName;
 else       accountName+="String_Node_Str" + currentLastName;
    }
  }
  if (currentFirstName == null && currentLastName == null) {
    String displayName=AccountInfoUtils.getDisplayName(accountInfoOpSet);
    if (displayName != null)     accountName=displayName;
  }
  if (accountName != null && accountName.length() > 0)   accountNameLabel.setText(accountName);
}
Program: 103583
Project: 103583
Buggy source:
/** 
 * Returns the first name of the account, to which the given accountInfoOpSet belongs.
 * @param accountInfoOpSet The account info operation set corresponding tothe searched account.
 * @return the first name of the account, to which the givenaccountInfoOpSet belongs.
 */
public static String getFirstName(OperationSetServerStoredAccountInfo accountInfoOpSet){
  FirstNameDetail firstName=null;
  Iterator<GenericDetail> firstNameDetails=accountInfoOpSet.getDetails(FirstNameDetail.class);
  if (firstNameDetails.hasNext())   firstName=(FirstNameDetail)firstNameDetails.next();
  if (firstName == null)   return null;
  return firstName.getString();
}

Fixed version (ground truth):
/** 
 * Returns the first name of the account, to which the given accountInfoOpSet belongs.
 * @param accountInfoOpSet The account info operation set corresponding tothe searched account.
 * @return the first name of the account, to which the givenaccountInfoOpSet belongs.
 */
public static String getFirstName(OperationSetServerStoredAccountInfo accountInfoOpSet){
  Iterator<GenericDetail> firstNameDetails=accountInfoOpSet.getDetails(FirstNameDetail.class);
  if (firstNameDetails.hasNext()) {
    FirstNameDetail firstName=(FirstNameDetail)firstNameDetails.next();
    if (firstName != null)     return firstName.toString();
  }
  return null;
}
Program: 103584
Project: 103584
Buggy source:
/** 
 * Handles incoming jingle packets and passes them to the corresponding method based on their action.
 * @param packet the packet to process.
 */
public void processPacket(Packet packet){
  if (!(packet instanceof JingleIQ))   return;
  JingleIQ jingleIQ=(JingleIQ)packet;
  if (jingleIQ.getType() == IQ.Type.SET) {
    IQ ack=IQ.createResultIQ(jingleIQ);
    protocolProvider.getConnection().sendPacket(ack);
  }
  processJinglePacket(jingleIQ);
}

Fixed version (ground truth):
/** 
 * Handles incoming jingle packets and passes them to the corresponding method based on their action.
 * @param packet the packet to process.
 */
public void processPacket(Packet packet){
  if (!(packet instanceof JingleIQ))   return;
  JingleIQ jingleIQ=(JingleIQ)packet;
  if (jingleIQ.getType() == IQ.Type.SET) {
    IQ ack=IQ.createResultIQ(jingleIQ);
    protocolProvider.getConnection().sendPacket(ack);
  }
  try {
    processJinglePacket(jingleIQ);
  }
 catch (  Throwable thr) {
    logger.info("String_Node_Str",thr);
  }
}
Program: 103585
Project: 103585
Buggy source:
/** 
 * Returns the value of the senders argument which indicates the parties that will be generating content in this session; the allowable values are defined in the <tt>SendersEnum</tt>.
 * @return a {@link SendersEnum} instance indicating the the parties thatwill be generating content in this session.
 */
public SendersEnum getSenders(){
  return SendersEnum.valueOf(getAttributeAsString(SENDERS_ATTR_NAME));
}

Fixed version (ground truth):
/** 
 * Returns the value of the senders argument which indicates the parties that will be generating content in this session; the allowable values are defined in the <tt>SendersEnum</tt>.
 * @return a {@link SendersEnum} instance indicating the the parties thatwill be generating content in this session.
 */
public SendersEnum getSenders(){
  Object attributeVal=getAttribute(SENDERS_ATTR_NAME);
  return attributeVal == null ? null : SendersEnum.valueOf(attributeVal.toString());
}
Program: 103586
Project: 103586
Buggy source:
/** 
 * Closes both the control and the data socket of the specified connector and releases its reference (if it wasn't the case already).
 * @param mediaType the type of the connector we'd like to close.
 */
public void closeStreamConnector(MediaType mediaType){
  StreamConnector connector=(mediaType == MediaType.VIDEO) ? videoStreamConnector : audioStreamConnector;
synchronized (connector) {
    if (connector != null) {
      audioStreamConnector.getDataSocket().close();
      audioStreamConnector.getControlSocket().close();
      audioStreamConnector=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Closes both the control and the data socket of the specified connector and releases its reference (if it wasn't the case already).
 * @param mediaType the type of the connector we'd like to close.
 */
public void closeStreamConnector(MediaType mediaType){
  StreamConnector connector=(mediaType == MediaType.VIDEO) ? videoStreamConnector : audioStreamConnector;
synchronized (connector) {
    if (connector != null) {
      connector.getDataSocket().close();
      connector.getControlSocket().close();
      connector=null;
    }
  }
}
Program: 103587
Project: 103587
Buggy source:
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting our XMPP server. This is an utility method that is used whenever we have to choose one of our local addresses (e.g. when trying to pick a best candidate for raw udp). It is based on the assumption that, in absence of any more specific details, chances are that we will be accessing remote destinations via the same interface that we are using to access our jabber server.
 * @return the <tt>InetAddress</tt> that is most likely to be to be usedas a next hop when contacting our server.
 * @throws IllegalArgumentException if we don't have a valid server.
 */
public InetAddress getNextHop() throws IllegalArgumentException {
  InetAddress nextHop=null;
  String nextHopStr=null;
  if (proxy != null)   nextHopStr=proxy.getProxyAddress();
 else   nextHopStr=getConnection().getHost();
  try {
    nextHop=NetworkUtils.getInetAddress(nextHopStr);
  }
 catch (  UnknownHostException ex) {
    throw new IllegalArgumentException("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + nextHop + "String_Node_Str");
  return nextHop;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting our XMPP server. This is an utility method that is used whenever we have to choose one of our local addresses (e.g. when trying to pick a best candidate for raw udp). It is based on the assumption that, in absence of any more specific details, chances are that we will be accessing remote destinations via the same interface that we are using to access our jabber server.
 * @return the <tt>InetAddress</tt> that is most likely to be to be usedas a next hop when contacting our server.
 * @throws IllegalArgumentException if we don't have a valid server.
 */
public InetAddress getNextHop() throws IllegalArgumentException {
  InetAddress nextHop=null;
  String nextHopStr=null;
  if (proxy != null && proxy.getProxyType() != org.jivesoftware.smack.proxy.ProxyInfo.ProxyType.NONE) {
    nextHopStr=proxy.getProxyAddress();
  }
 else {
    nextHopStr=getConnection().getHost();
  }
  try {
    nextHop=NetworkUtils.getInetAddress(nextHopStr);
  }
 catch (  UnknownHostException ex) {
    throw new IllegalArgumentException("String_Node_Str",ex);
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + nextHop + "String_Node_Str");
  return nextHop;
}
Program: 103588
Project: 103588
Buggy source:
/** 
 * Changes auto join value in configuration service.
 * @param value change of auto join property.
 */
public void setAutoJoin(boolean value){
  autoJoin=value;
  if (!isPersistent())   return;
  if (value) {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,Boolean.toString(autoJoin));
  }
 else {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,null);
  }
}

Fixed version (ground truth):
/** 
 * Changes auto join value in configuration service.
 * @param value change of auto join property.
 */
public void setAutoJoin(boolean value){
  autoJoin=value;
  if (!isPersistent()) {
    setPersistent(true);
    ConfigurationManager.saveChatRoom(getParentProvider().getProtocolProvider(),getChatRoomID(),getChatRoomID(),getChatRoomName());
  }
  if (value) {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,Boolean.toString(autoJoin));
  }
 else {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,null);
  }
}
Program: 103589
Project: 103589
Buggy source:
/** 
 * Changes auto join value in configuration service.
 * @param value change of auto join property.
 */
public void setAutoJoin(boolean value){
  autoJoin=value;
  if (!persistent)   return;
  if (value) {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,Boolean.toString(autoJoin));
  }
 else {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,null);
  }
}

Fixed version (ground truth):
/** 
 * Changes auto join value in configuration service.
 * @param value change of auto join property.
 */
public void setAutoJoin(boolean value){
  autoJoin=value;
  if (!isPersistent())   return;
  if (value) {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,Boolean.toString(autoJoin));
  }
 else {
    ConfigurationManager.updateChatRoomProperty(getParentProvider().getProtocolProvider(),chatRoomID,AUTOJOIN_PROPERTY_NAME,null);
  }
}
Program: 103591
Project: 103591
Buggy source:
/** 
 * Returns the <tt>FileAccessService</tt> obtained from the bundle context.
 * @return the <tt>FileAccessService</tt> obtained from the bundle context
 */
public static FileAccessService getFileAccessService(){
  if (fileAccessService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(FileAccessService.class.getName());
    if (serviceReference != null)     fileAccessService=(FileAccessService)bundleContext.getService(serviceReference);
  }
  return fileAccessService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>FileAccessService</tt> obtained from the bundle context.
 * @return the <tt>FileAccessService</tt> obtained from the bundle context
 */
public static FileAccessService getFileAccessService(){
  if (fileAccessService == null) {
    fileAccessService=ServiceUtils.getService(bundleContext,FileAccessService.class);
  }
  return fileAccessService;
}
Program: 103592
Project: 103592
Buggy source:
/** 
 * Returns the <tt>AccountManager</tt> obtained from the bundle context.
 * @return the <tt>AccountManager</tt> obtained from the bundle context
 */
public static AccountManager getAccountManager(){
  if (accountManager == null) {
    ServiceReference accountManagerRef=bundleContext.getServiceReference(AccountManager.class.getName());
    accountManager=(AccountManager)bundleContext.getService(accountManagerRef);
  }
  return accountManager;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>AccountManager</tt> obtained from the bundle context.
 * @return the <tt>AccountManager</tt> obtained from the bundle context
 */
public static AccountManager getAccountManager(){
  if (accountManager == null) {
    accountManager=ServiceUtils.getService(bundleContext,AccountManager.class);
  }
  return accountManager;
}
Program: 103593
Project: 103593
Buggy source:
/** 
 * Returns the <tt>BrowserLauncherService</tt> obtained from the bundle context.
 * @return the <tt>BrowserLauncherService</tt> obtained from the bundlecontext
 */
public static BrowserLauncherService getBrowserLauncher(){
  if (browserLauncherService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(BrowserLauncherService.class.getName());
    browserLauncherService=(BrowserLauncherService)bundleContext.getService(serviceReference);
  }
  return browserLauncherService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>BrowserLauncherService</tt> obtained from the bundle context.
 * @return the <tt>BrowserLauncherService</tt> obtained from the bundlecontext
 */
public static BrowserLauncherService getBrowserLauncher(){
  if (browserLauncherService == null) {
    browserLauncherService=ServiceUtils.getService(bundleContext,BrowserLauncherService.class);
  }
  return browserLauncherService;
}
Program: 103594
Project: 103594
Buggy source:
/** 
 * Returns the <tt>KeybindingsService</tt> obtained from the bundle context.
 * @return the <tt>KeybindingsService</tt> obtained from the bundle context
 */
public static KeybindingsService getKeybindingsService(){
  if (keybindingsService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(KeybindingsService.class.getName());
    keybindingsService=(KeybindingsService)bundleContext.getService(serviceReference);
  }
  return keybindingsService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>KeybindingsService</tt> obtained from the bundle context.
 * @return the <tt>KeybindingsService</tt> obtained from the bundle context
 */
public static KeybindingsService getKeybindingsService(){
  if (keybindingsService == null) {
    keybindingsService=ServiceUtils.getService(bundleContext,KeybindingsService.class);
  }
  return keybindingsService;
}
Program: 103595
Project: 103595
Buggy source:
/** 
 * Returns a list of all registered contact sources.
 * @return a list of all registered contact sources
 */
public static List<ContactSourceService> getContactSources(){
  if (contactSources != null)   return contactSources;
  contactSources=new Vector<ContactSourceService>();
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ContactSourceService.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  if (serRefs != null) {
    for (int i=0; i < serRefs.length; i++) {
      ContactSourceService contactSource=(ContactSourceService)bundleContext.getService(serRefs[i]);
      contactSources.add(contactSource);
    }
  }
  return contactSources;
}

Fixed version (ground truth):
/** 
 * Returns a list of all registered contact sources.
 * @return a list of all registered contact sources
 */
public static List<ContactSourceService> getContactSources(){
  if (contactSources != null)   return contactSources;
  contactSources=new Vector<ContactSourceService>();
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ContactSourceService.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  if (serRefs != null) {
    for (    ServiceReference serRef : serRefs) {
      ContactSourceService contactSource=(ContactSourceService)bundleContext.getService(serRef);
      contactSources.add(contactSource);
    }
  }
  return contactSources;
}
Program: 103596
Project: 103596
Buggy source:
/** 
 * Returns an instance of the <tt>MediaService</tt> obtained from the bundle context.
 * @return an instance of the <tt>MediaService</tt> obtained from thebundle context
 */
public static MediaService getMediaService(){
  if (mediaService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(MediaService.class.getName());
    mediaService=(MediaService)bundleContext.getService(serviceReference);
  }
  return mediaService;
}

Fixed version (ground truth):
/** 
 * Returns an instance of the <tt>MediaService</tt> obtained from the bundle context.
 * @return an instance of the <tt>MediaService</tt> obtained from thebundle context
 */
public static MediaService getMediaService(){
  if (mediaService == null) {
    mediaService=ServiceUtils.getService(bundleContext,MediaService.class);
  }
  return mediaService;
}
Program: 103597
Project: 103597
Buggy source:
/** 
 * Returns the <tt>ProtocolProviderService</tt> corresponding to the given account identifier that is registered in the given factory
 * @param accountID the identifier of the account
 * @return the <tt>ProtocolProviderService</tt> corresponding to the givenaccount identifier that is registered in the given factory
 */
public static ProtocolProviderService getRegisteredProviderForAccount(AccountID accountID){
  Iterator<ProtocolProviderFactory> factories=getProtocolProviderFactories().values().iterator();
  while (factories.hasNext()) {
    ProtocolProviderFactory factory=factories.next();
    if (factory.getRegisteredAccounts().contains(accountID)) {
      ServiceReference serRef=factory.getProviderForAccount(accountID);
      if (serRef != null)       return (ProtocolProviderService)bundleContext.getService(serRef);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>ProtocolProviderService</tt> corresponding to the given account identifier that is registered in the given factory
 * @param accountID the identifier of the account
 * @return the <tt>ProtocolProviderService</tt> corresponding to the givenaccount identifier that is registered in the given factory
 */
public static ProtocolProviderService getRegisteredProviderForAccount(AccountID accountID){
  for (  ProtocolProviderFactory factory : getProtocolProviderFactories().values()) {
    if (factory.getRegisteredAccounts().contains(accountID)) {
      ServiceReference serRef=factory.getProviderForAccount(accountID);
      if (serRef != null) {
        return (ProtocolProviderService)bundleContext.getService(serRef);
      }
    }
  }
  return null;
}
Program: 103598
Project: 103598
Buggy source:
/** 
 * Returns the <tt>NotificationService</tt> obtained from the bundle context.
 * @return the <tt>NotificationService</tt> obtained from the bundle context
 */
public static NotificationService getNotificationService(){
  if (notificationService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(NotificationService.class.getName());
    notificationService=(NotificationService)bundleContext.getService(serviceReference);
  }
  return notificationService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>NotificationService</tt> obtained from the bundle context.
 * @return the <tt>NotificationService</tt> obtained from the bundle context
 */
public static NotificationService getNotificationService(){
  if (notificationService == null) {
    notificationService=ServiceUtils.getService(bundleContext,NotificationService.class);
  }
  return notificationService;
}
Program: 103599
Project: 103599
Buggy source:
/** 
 * Returns the <tt>SystrayService</tt> obtained from the bundle context.
 * @return the <tt>SystrayService</tt> obtained from the bundle context
 */
public static SystrayService getSystrayService(){
  if (systrayService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(SystrayService.class.getName());
    if (serviceReference == null)     return null;
    systrayService=(SystrayService)bundleContext.getService(serviceReference);
  }
  return systrayService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>SystrayService</tt> obtained from the bundle context.
 * @return the <tt>SystrayService</tt> obtained from the bundle context
 */
public static SystrayService getSystrayService(){
  if (systrayService == null) {
    systrayService=ServiceUtils.getService(bundleContext,SystrayService.class);
  }
  return systrayService;
}
Program: 103600
Project: 103600
Buggy source:
/** 
 * Returns the <tt>DesktopService</tt> obtained from the bundle context.
 * @return the <tt>DesktopService</tt> obtained from the bundle context
 */
public static DesktopService getDesktopService(){
  if (desktopService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(DesktopService.class.getName());
    desktopService=(DesktopService)bundleContext.getService(serviceReference);
  }
  return desktopService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>DesktopService</tt> obtained from the bundle context.
 * @return the <tt>DesktopService</tt> obtained from the bundle context
 */
public static DesktopService getDesktopService(){
  if (desktopService == null) {
    desktopService=ServiceUtils.getService(bundleContext,DesktopService.class);
  }
  return desktopService;
}
Program: 103601
Project: 103601
Buggy source:
/** 
 * Returns the <tt>MetaContactListService</tt> obtained from the bundle context.
 * @return the <tt>MetaContactListService</tt> obtained from the bundlecontext
 */
public static MetaContactListService getContactListService(){
  if (metaCListService == null) {
    ServiceReference clistReference=bundleContext.getServiceReference(MetaContactListService.class.getName());
    metaCListService=(MetaContactListService)bundleContext.getService(clistReference);
  }
  return metaCListService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>MetaContactListService</tt> obtained from the bundle context.
 * @return the <tt>MetaContactListService</tt> obtained from the bundlecontext
 */
public static MetaContactListService getContactListService(){
  if (metaCListService == null) {
    metaCListService=ServiceUtils.getService(bundleContext,MetaContactListService.class);
  }
  return metaCListService;
}
Program: 103602
Project: 103602
Buggy source:
/** 
 * Returns the <tt>CallHistoryService</tt> obtained from the bundle context.
 * @return the <tt>CallHistoryService</tt> obtained from the bundlecontext
 */
public static CallHistoryService getCallHistoryService(){
  if (callHistoryService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(CallHistoryService.class.getName());
    callHistoryService=(CallHistoryService)bundleContext.getService(serviceReference);
  }
  return callHistoryService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>CallHistoryService</tt> obtained from the bundle context.
 * @return the <tt>CallHistoryService</tt> obtained from the bundlecontext
 */
public static CallHistoryService getCallHistoryService(){
  if (callHistoryService == null) {
    callHistoryService=ServiceUtils.getService(bundleContext,CallHistoryService.class);
  }
  return callHistoryService;
}
Program: 103603
Project: 103603
Buggy source:
/** 
 * Returns the <tt>FileAccessService</tt> obtained from the bundle context.
 * @return the <tt>FileAccessService</tt> obtained from the bundle context
 */
public static FileAccessService getFileAccessService(){
  if (fileAccessService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(FileAccessService.class.getName());
    fileAccessService=(FileAccessService)bundleContext.getService(serviceReference);
  }
  return fileAccessService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>FileAccessService</tt> obtained from the bundle context.
 * @return the <tt>FileAccessService</tt> obtained from the bundle context
 */
public static FileAccessService getFileAccessService(){
  if (fileAccessService == null) {
    fileAccessService=ServiceUtils.getService(bundleContext,FileAccessService.class);
  }
  return fileAccessService;
}
Program: 103604
Project: 103604
Buggy source:
/** 
 * Returns the <tt>ResourceManagementService</tt>, through which we will access all resources.
 * @return the <tt>ResourceManagementService</tt>, through which we willaccess all resources.
 */
public static ResourceManagementService getResources(){
  if (resourcesService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(ResourceManagementService.class.getName());
    if (serviceReference == null)     return null;
    resourcesService=(ResourceManagementService)bundleContext.getService(serviceReference);
  }
  return resourcesService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>ResourceManagementService</tt>, through which we will access all resources.
 * @return the <tt>ResourceManagementService</tt>, through which we willaccess all resources.
 */
public static ResourceManagementService getResources(){
  if (resourcesService == null) {
    resourcesService=ServiceUtils.getService(bundleContext,ResourceManagementService.class);
  }
  return resourcesService;
}
Program: 103605
Project: 103605
Buggy source:
/** 
 * Returns the <tt>AudioNotifierService</tt> obtained from the bundle context.
 * @return the <tt>AudioNotifierService</tt> obtained from the bundlecontext
 */
public static AudioNotifierService getAudioNotifier(){
  if (audioNotifierService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(AudioNotifierService.class.getName());
    if (serviceReference != null)     audioNotifierService=(AudioNotifierService)bundleContext.getService(serviceReference);
  }
  return audioNotifierService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>AudioNotifierService</tt> obtained from the bundle context.
 * @return the <tt>AudioNotifierService</tt> obtained from the bundlecontext
 */
public static AudioNotifierService getAudioNotifier(){
  if (audioNotifierService == null) {
    audioNotifierService=ServiceUtils.getService(bundleContext,AudioNotifierService.class);
  }
  return audioNotifierService;
}
Program: 103606
Project: 103606
Buggy source:
/** 
 * Returns all <tt>ProtocolProviderFactory</tt>s obtained from the bundle context.
 * @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundlecontext
 */
public static Map<Object,ProtocolProviderFactory> getProtocolProviderFactories(){
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderFactory.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  if (serRefs != null) {
    for (int i=0; i < serRefs.length; i++) {
      ProtocolProviderFactory providerFactory=(ProtocolProviderFactory)bundleContext.getService(serRefs[i]);
      providerFactoriesMap.put(serRefs[i].getProperty(ProtocolProviderFactory.PROTOCOL),providerFactory);
    }
  }
  return providerFactoriesMap;
}

Fixed version (ground truth):
/** 
 * Returns all <tt>ProtocolProviderFactory</tt>s obtained from the bundle context.
 * @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundlecontext
 */
public static Map<Object,ProtocolProviderFactory> getProtocolProviderFactories(){
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderFactory.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  if (serRefs != null) {
    for (    ServiceReference serRef : serRefs) {
      ProtocolProviderFactory providerFactory=(ProtocolProviderFactory)bundleContext.getService(serRef);
      providerFactoriesMap.put(serRef.getProperty(ProtocolProviderFactory.PROTOCOL),providerFactory);
    }
  }
  return providerFactoriesMap;
}
Program: 103607
Project: 103607
Buggy source:
/** 
 * Returns the <tt>AccountManager</tt> obtained from the bundle context.
 * @return the <tt>AccountManager</tt> obtained from the bundle context
 */
public static AccountManager getAccountManager(){
  if (accountManager == null) {
    ServiceReference accountManagerRef=bundleContext.getServiceReference(AccountManager.class.getName());
    accountManager=(AccountManager)bundleContext.getService(accountManagerRef);
  }
  return accountManager;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>AccountManager</tt> obtained from the bundle context.
 * @return the <tt>AccountManager</tt> obtained from the bundle context
 */
public static AccountManager getAccountManager(){
  if (accountManager == null) {
    accountManager=ServiceUtils.getService(bundleContext,AccountManager.class);
  }
  return accountManager;
}
Program: 103608
Project: 103608
Buggy source:
/** 
 * Returns the <tt>ConfigurationService</tt> obtained from the bundle context.
 * @return the <tt>ConfigurationService</tt> obtained from the bundlecontext
 */
public static ConfigurationService getConfigurationService(){
  if (configService == null) {
    ServiceReference configReference=bundleContext.getServiceReference(ConfigurationService.class.getName());
    configService=(ConfigurationService)bundleContext.getService(configReference);
  }
  return configService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>ConfigurationService</tt> obtained from the bundle context.
 * @return the <tt>ConfigurationService</tt> obtained from the bundlecontext
 */
public static ConfigurationService getConfigurationService(){
  if (configService == null) {
    configService=ServiceUtils.getService(bundleContext,ConfigurationService.class);
  }
  return configService;
}
Program: 103609
Project: 103609
Buggy source:
/** 
 * Returns the <tt>MetaHistoryService</tt> obtained from the bundle context.
 * @return the <tt>MetaHistoryService</tt> obtained from the bundlecontext
 */
public static MetaHistoryService getMetaHistoryService(){
  if (metaHistoryService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(MetaHistoryService.class.getName());
    if (serviceReference != null)     metaHistoryService=(MetaHistoryService)bundleContext.getService(serviceReference);
  }
  return metaHistoryService;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>MetaHistoryService</tt> obtained from the bundle context.
 * @return the <tt>MetaHistoryService</tt> obtained from the bundlecontext
 */
public static MetaHistoryService getMetaHistoryService(){
  if (metaHistoryService == null) {
    metaHistoryService=ServiceUtils.getService(bundleContext,MetaHistoryService.class);
  }
  return metaHistoryService;
}
Program: 103611
Project: 103611
Buggy source:
/** 
 * Creates the error area component.
 */
private void initErrorArea(){
  SimpleAttributeSet attribs=new SimpleAttributeSet();
  StyleConstants.setAlignment(attribs,StyleConstants.ALIGN_RIGHT);
  StyleConstants.setFontFamily(attribs,errorPane.getFont().getFamily());
  StyleConstants.setForeground(attribs,Color.RED);
  errorPane.setParagraphAttributes(attribs,true);
  errorPane.setOpaque(false);
}

Fixed version (ground truth):
/** 
 * Creates the error area component.
 */
private void initErrorArea(){
  SimpleAttributeSet attribs=new SimpleAttributeSet();
  StyleConstants.setAlignment(attribs,StyleConstants.ALIGN_RIGHT);
  StyleConstants.setFontFamily(attribs,errorPane.getFont().getFamily());
  StyleConstants.setForeground(attribs,Color.RED);
  errorPane.setParagraphAttributes(attribs,true);
  errorPane.setPreferredSize(new Dimension(100,50));
  errorPane.setMinimumSize(new Dimension(100,50));
  errorPane.setOpaque(false);
}
Program: 103612
Project: 103612
Buggy source:
/** 
 * Initializes this panel.
 */
private void init(){
  JPanel labelsPanel=new TransparentPanel(new GridLayout(0,1));
  JPanel valuesPanel=new TransparentPanel(new GridLayout(0,1));
  JLabel usernameLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel displayNameLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel passLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel retypePasswordLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel emailLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  labelsPanel.add(usernameLabel);
  labelsPanel.add(displayNameLabel);
  labelsPanel.add(passLabel);
  labelsPanel.add(retypePasswordLabel);
  labelsPanel.add(emailLabel);
  valuesPanel.add(usernameField);
  valuesPanel.add(displayNameField);
  valuesPanel.add(passField);
  valuesPanel.add(retypePassField);
  valuesPanel.add(emailField);
  initErrorArea();
  add(errorPane,BorderLayout.NORTH);
  add(labelsPanel,BorderLayout.WEST);
  add(valuesPanel,BorderLayout.CENTER);
}

Fixed version (ground truth):
/** 
 * Initializes this panel.
 */
private void init(){
  JPanel labelsPanel=new TransparentPanel(new GridLayout(0,1));
  JPanel valuesPanel=new TransparentPanel(new GridLayout(0,1));
  JLabel usernameLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel displayNameLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel passLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel retypePasswordLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  JLabel emailLabel=new JLabel(Sip2SipAccRegWizzActivator.getResources().getI18NString("String_Node_Str"));
  labelsPanel.add(usernameLabel);
  labelsPanel.add(displayNameLabel);
  labelsPanel.add(passLabel);
  labelsPanel.add(retypePasswordLabel);
  labelsPanel.add(emailLabel);
  valuesPanel.add(usernameField);
  valuesPanel.add(displayNameField);
  valuesPanel.add(passField);
  valuesPanel.add(retypePassField);
  valuesPanel.add(emailField);
  initErrorArea();
  add(labelsPanel,BorderLayout.WEST);
  add(valuesPanel,BorderLayout.CENTER);
}
Program: 103613
Project: 103613
Buggy source:
/** 
 * Parses the given http response.
 * @param response the http response to parse
 * @return the new account
 */
private NewAccount parseHttpResponse(String response){
  NewAccount newAccount=null;
  try {
    JSONObject jsonObject=new JSONObject(response);
    boolean isSuccess=jsonObject.getBoolean("String_Node_Str");
    if (isSuccess) {
      newAccount=new NewAccount(jsonObject.getString("String_Node_Str"),passField.getPassword(),null,jsonObject.getString("String_Node_Str"));
    }
 else {
      String errorMessage=jsonObject.getString("String_Node_Str");
      errorPane.setText(errorMessage);
      SwingUtilities.getWindowAncestor(CreateSip2SipAccountForm.this).pack();
    }
  }
 catch (  JSONException e1) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e1);
  }
  return newAccount;
}

Fixed version (ground truth):
/** 
 * Parses the given http response.
 * @param response the http response to parse
 * @return the new account
 */
private NewAccount parseHttpResponse(String response){
  NewAccount newAccount=null;
  try {
    JSONObject jsonObject=new JSONObject(response);
    boolean isSuccess=jsonObject.getBoolean("String_Node_Str");
    if (isSuccess) {
      newAccount=new NewAccount(jsonObject.getString("String_Node_Str"),passField.getPassword(),null,jsonObject.getString("String_Node_Str"));
    }
 else {
      String errorMessage=jsonObject.getString("String_Node_Str");
      errorPane.setText(errorMessage);
      add(errorPane,BorderLayout.NORTH);
      SwingUtilities.getWindowAncestor(CreateSip2SipAccountForm.this).pack();
    }
  }
 catch (  JSONException e1) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e1);
  }
  return newAccount;
}
Program: 103614
Project: 103614
Buggy source:
/** 
 * Clears all the data previously entered in the form.
 */
public void clear(){
  usernameField.setText("String_Node_Str");
  displayNameField.setText("String_Node_Str");
  passField.setText("String_Node_Str");
  retypePassField.setText("String_Node_Str");
  emailField.setText("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Clears all the data previously entered in the form.
 */
public void clear(){
  usernameField.setText("String_Node_Str");
  displayNameField.setText("String_Node_Str");
  passField.setText("String_Node_Str");
  retypePassField.setText("String_Node_Str");
  emailField.setText("String_Node_Str");
  errorPane.setText("String_Node_Str");
  remove(errorPane);
}
Program: 103615
Project: 103615
Buggy source:
/** 
 * Saves the user input when the "Next" wizard buttons is clicked.
 */
public void commitPage(){
  registrationForm.commitPage(wizard.getRegistration());
  nextPageIdentifier=SUMMARY_PAGE_IDENTIFIER;
  this.isCommitted=true;
}

Fixed version (ground truth):
/** 
 * Saves the user input when the "Next" wizard buttons is clicked.
 */
public void commitPage(){
  isCommitted=registrationForm.commitPage(wizard.getRegistration());
  nextPageIdentifier=SUMMARY_PAGE_IDENTIFIER;
}
Program: 103616
Project: 103616
Buggy source:
public Object getSimpleForm(){
  return registrationForm.getSimpleForm();
}

Fixed version (ground truth):
/** 
 * Returns the simple account registration form.
 * @return the simple account registration form
 */
public Object getSimpleForm(){
  return registrationForm.getSimpleForm();
}
Program: 103617
Project: 103617
Buggy source:
public boolean isCommitted(){
  return isCommitted;
}

Fixed version (ground truth):
/** 
 * Returns <tt>true</tt> if the page is committed, <tt>false</tt> - otherwise.
 * @return <tt>true</tt> if the page is committed, <tt>false</tt> -otherwise
 */
public boolean isCommitted(){
  return isCommitted;
}
Program: 103619
Project: 103619
Buggy source:
/** 
 * Returns a simple version of this registration form.
 * @return the simple form component
 */
public Component getSimpleForm(){
  return accountPanel;
}

Fixed version (ground truth):
/** 
 * Returns a simple version of this registration form.
 * @return the simple form component
 */
public Component getSimpleForm(){
  CreateAccountService createAccountService=getCreateAccountService();
  if (createAccountService != null)   createAccountService.clear();
  return accountPanel;
}