nus-yam/ex-repair huggingface dataset:
Program: 102936
Project: 102936
Buggy source:
/** 
 * starts the service. Check the current registerd protocol providers which supports BasicTelephony and adds calls listener to them
 * @param bc BundleContext
 */
public void start(BundleContext bc){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  this.bundleContext=bc;
  bc.addServiceListener(this);
  Collection<ServiceReference<ProtocolProviderService>> ppsRefs;
  try {
    ppsRefs=bc.getServiceReferences(ProtocolProviderService.class,null);
  }
 catch (  InvalidSyntaxException ex) {
    ppsRefs=null;
    logger.error("String_Node_Str",ex);
  }
  if (ppsRefs != null) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + ppsRefs.size() + "String_Node_Str");
    }
    for (    ServiceReference<ProtocolProviderService> ppsRef : ppsRefs) {
      ProtocolProviderService pps=bc.getService(ppsRef);
      this.handleProviderAdded(pps);
    }
  }
}

Fixed version (ground truth):
/** 
 * starts the service. Check the current registerd protocol providers which supports BasicTelephony and adds calls listener to them
 * @param bc BundleContext
 */
public void start(BundleContext bc){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str");
  this.bundleContext=bc;
  bc.addServiceListener(this);
  Collection<ServiceReference<ProtocolProviderService>> ppsRefs=ServiceUtils.getServiceReferences(bc,ProtocolProviderService.class);
  if (!ppsRefs.isEmpty()) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + ppsRefs.size() + "String_Node_Str");
    }
    for (    ServiceReference<ProtocolProviderService> ppsRef : ppsRefs) {
      ProtocolProviderService pps=bc.getService(ppsRef);
      handleProviderAdded(pps);
    }
  }
}
Program: 102937
Project: 102937
Buggy source:
/** 
 * stops the service.
 * @param bc BundleContext
 */
public void stop(BundleContext bc){
  bc.removeServiceListener(this);
  Collection<ServiceReference<ProtocolProviderService>> ppsRefs;
  try {
    ppsRefs=bc.getServiceReferences(ProtocolProviderService.class,null);
  }
 catch (  InvalidSyntaxException ex) {
    ppsRefs=null;
    logger.error("String_Node_Str",ex);
  }
  if (ppsRefs != null) {
    for (    ServiceReference<ProtocolProviderService> ppsRef : ppsRefs) {
      ProtocolProviderService pps=bc.getService(ppsRef);
      this.handleProviderRemoved(pps);
    }
  }
}

Fixed version (ground truth):
/** 
 * stops the service.
 * @param bc BundleContext
 */
public void stop(BundleContext bc){
  bc.removeServiceListener(this);
  Collection<ServiceReference<ProtocolProviderService>> ppsRefs=ServiceUtils.getServiceReferences(bc,ProtocolProviderService.class);
  if (!ppsRefs.isEmpty()) {
    for (    ServiceReference<ProtocolProviderService> ppsRef : ppsRefs) {
      ProtocolProviderService pps=bc.getService(ppsRef);
      handleProviderRemoved(pps);
    }
  }
}
Program: 102942
Project: 102942
Buggy source:
/** 
 * Test whether this listener corresponds to the chat room.
 * @param chatRoomName chat room name
 * @return returns true if this listener applies, false otherwise
 */
private boolean isThisChatRoom(String chatRoomName){
  return this.chatroom.getIdentifier().equals(chatRoomName);
}

Fixed version (ground truth):
/** 
 * Test whether this listener corresponds to the chat room.
 * @param chatRoomName chat room name
 * @return returns true if this listener applies, false otherwise
 */
private boolean isThisChatRoom(String chatRoomName){
  return this.chatroom.getIdentifier().equalsIgnoreCase(chatRoomName);
}
Program: 102944
Project: 102944
Buggy source:
/** 
 * Returns a reference to an open chat with the specified <tt>jid</tt> if one exists or creates a new one otherwise.
 * @param toAddress the address without the resource, we used to puta reference in jids table.
 * @param jid the Jabber ID that we'd like to obtain a chat instance for.
 * @return a reference to an open chat with the specified<tt>jid</tt> if one exists or creates a new one otherwise.
 */
public Chat obtainChatInstance(String toAddress,String jid){
  XMPPConnection jabberConnection=jabberProvider.getConnection();
  TargetAddress ta=getJidForAddress(toAddress);
  if (ta != null && ta.chat != null && ta.jid.equals(jid)) {
    return ta.chat;
  }
  org.jivesoftware.smack.MessageListener msgListener=new org.jivesoftware.smack.MessageListener(){
    public void processMessage(    Chat chat,    org.jivesoftware.smack.packet.Message message){
    }
  }
;
  Chat chat=jabberConnection.getChatManager().createChat(jid,msgListener);
  return chat;
}

Fixed version (ground truth):
/** 
 * Returns a reference to an open chat with the specified <tt>jid</tt> if one exists or creates a new one otherwise.
 * @param toAddress the address without the resource, we used to puta reference in jids table.
 * @param jid the Jabber ID that we'd like to obtain a chat instance for.
 * @return a reference to an open chat with the specified<tt>jid</tt> if one exists or creates a new one otherwise.
 */
public Chat obtainChatInstance(String toAddress,String jid){
  XMPPConnection jabberConnection=jabberProvider.getConnection();
  TargetAddress ta=getJidForAddress(toAddress);
  if (ta != null && ta.chat != null && ta.jid.equals(jid) && ta.chat.getParticipant().equals(jid)) {
    return ta.chat;
  }
  org.jivesoftware.smack.MessageListener msgListener=new org.jivesoftware.smack.MessageListener(){
    public void processMessage(    Chat chat,    org.jivesoftware.smack.packet.Message message){
    }
  }
;
  Chat chat=jabberConnection.getChatManager().createChat(jid,msgListener);
  return chat;
}
Program: 102946
Project: 102946
Buggy source:
/** 
 * Creates an instance of <tt>SelectScreenDialog</tt> by specifying the list of possible desktop devices to choose from.
 * @param desktopDevices the list of possible desktop devices to choosefrom
 */
public SelectScreenDialog(List<MediaDevice> desktopDevices){
  setModal(true);
  setPreferredSize(new Dimension(400,300));
  Container contentPane=getContentPane();
  contentPane.setLayout(new BorderLayout());
  deviceComboBox=new JComboBox(desktopDevices.toArray());
  contentPane.add(deviceComboBox,BorderLayout.NORTH);
  deviceComboBox.setRenderer(new ComboRenderer());
  contentPane.add(createPreview(deviceComboBox));
  contentPane.add(createButtonsPanel(),BorderLayout.SOUTH);
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>SelectScreenDialog</tt> by specifying the list of possible desktop devices to choose from.
 * @param desktopDevices the list of possible desktop devices to choosefrom
 */
public SelectScreenDialog(List<MediaDevice> desktopDevices){
  setModal(true);
  setPreferredSize(new Dimension(400,300));
  Container contentPane=getContentPane();
  contentPane.setLayout(new BorderLayout());
  deviceComboBox=new DeviceComboBoxField(contentPane,desktopDevices);
  contentPane.add(createPreview(deviceComboBox));
  contentPane.add(createButtonsPanel(),BorderLayout.SOUTH);
}
Program: 102947
Project: 102947
Buggy source:
public void actionPerformed(ActionEvent event){
  MediaDevice device=(MediaDevice)comboBox.getSelectedItem();
  if ((device != null) && device.equals(videoDeviceInPreview))   return;
  Exception exception;
  try {
    createPreview(device,preview);
    exception=null;
  }
 catch (  IOException ex) {
    exception=ex;
  }
catch (  MediaException ex) {
    exception=ex;
  }
  if (exception != null) {
    logger.error("String_Node_Str" + device,exception);
    device=null;
  }
  videoDeviceInPreview=device;
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  selectedDevice=null;
  dispose();
}
Program: 102948
Project: 102948
Buggy source:
public void hierarchyChanged(HierarchyEvent event){
  if (((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) && comboBox.isDisplayable()) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        comboBoxListener.actionPerformed(null);
      }
    }
);
  }
 else {
    if (!comboBox.isDisplayable())     videoDeviceInPreview=null;
  }
}

Fixed version (ground truth):
public void hierarchyChanged(HierarchyEvent event){
  if (((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) && comboBox.getComponent().isDisplayable()) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        comboBoxListener.onAction();
      }
    }
);
  }
 else {
    if (!comboBox.getComponent().isDisplayable())     videoDeviceInPreview=null;
  }
}
Program: 102949
Project: 102949
Buggy source:
public void run(){
  comboBoxListener.actionPerformed(null);
}

Fixed version (ground truth):
public void run(){
  comboBoxListener.onAction();
}
Program: 102950
Project: 102950
Buggy source:
/** 
 * Joins this chat room with the nickname of the local user so that the user would start receiving events and messages for it.
 * @throws OperationFailedException with the corresponding code if anerror occurs while joining the room.
 */
public void join() throws OperationFailedException {
  joinAs(getOurDisplayName());
}

Fixed version (ground truth):
/** 
 * Joins this chat room with the nickname of the local user so that the user would start receiving events and messages for it.
 * @throws OperationFailedException with the corresponding code if anerror occurs while joining the room.
 */
public void join() throws OperationFailedException {
  joinAs(JabberActivator.getGlobalDisplayDetailsService().getDisplayName(getParentProvider()));
}
Program: 102952
Project: 102952
Buggy source:
/** 
 * Checks if the contact address is associated with private messaging  contact or not.
 * @return <tt>true</tt> if the contact address is associated with privatemessaging contact and <tt>false</tt> if not.
 */
public boolean isPrivateMessagingContact(String contactAddress){
  return opSetPersPresence.isPrivateMessagingContact(contactAddress);
}

Fixed version (ground truth):
/** 
 * Checks if the contact address is associated with private messaging contact or not.
 * @return <tt>true</tt> if the contact address is associated with privatemessaging contact and <tt>false</tt> if not.
 */
public boolean isPrivateMessagingContact(String contactAddress){
  return opSetPersPresence.isPrivateMessagingContact(contactAddress);
}
Program: 102953
Project: 102953
Buggy source:
/** 
 * Returns a reference to a chatRoom named <tt>roomName</tt>. If the room  doesn't exists in the cache it creates it.
 * @param roomName the name of the <tt>ChatRoom</tt> that we're lookingfor.
 * @return the <tt>ChatRoom</tt> named <tt>roomName</tt>
 * @throws OperationFailedException if an error occurs while trying todiscover the room on the server.
 * @throws OperationNotSupportedException if the server does not supportmulti user chat
 */
public synchronized ChatRoom findRoom(String roomName) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  String canonicalRoomName=getCanonicalRoomName(roomName);
  ChatRoom room=chatRoomCache.get(canonicalRoomName);
  if (room != null)   return room;
  MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
  room=new ChatRoomJabberImpl(muc,jabberProvider);
  chatRoomCache.put(canonicalRoomName,room);
  return room;
}

Fixed version (ground truth):
/** 
 * Returns a reference to a chatRoom named <tt>roomName</tt>. If the room doesn't exists in the cache it creates it.
 * @param roomName the name of the <tt>ChatRoom</tt> that we're lookingfor.
 * @return the <tt>ChatRoom</tt> named <tt>roomName</tt>
 * @throws OperationFailedException if an error occurs while trying todiscover the room on the server.
 * @throws OperationNotSupportedException if the server does not supportmulti user chat
 */
public synchronized ChatRoom findRoom(String roomName) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  String canonicalRoomName=getCanonicalRoomName(roomName);
  ChatRoom room=chatRoomCache.get(canonicalRoomName);
  if (room != null)   return room;
  MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
  room=new ChatRoomJabberImpl(muc,jabberProvider);
  chatRoomCache.put(canonicalRoomName,room);
  return room;
}
Program: 102955
Project: 102955
Buggy source:
/** 
 * request the full info for the given uin waits and return this details
 * @param contact Contact
 * @return Iterator
 */
public Iterator<GenericDetail> getAllDetailsForContact(Contact contact){
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  if (details == null)   return new LinkedList<GenericDetail>().iterator();
 else   return new LinkedList<GenericDetail>(details).iterator();
}

Fixed version (ground truth):
/** 
 * request the full info for the given uin waits and return this details
 * @param contact Contact
 * @return Iterator
 */
public Iterator<GenericDetail> getAllDetailsForContact(Contact contact){
  if (isPrivateMessagingContact(contact))   return new LinkedList<GenericDetail>().iterator();
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  if (details == null)   return new LinkedList<GenericDetail>().iterator();
 else   return new LinkedList<GenericDetail>(details).iterator();
}
Program: 102956
Project: 102956
Buggy source:
/** 
 * returns the user details from the specified class or its descendants the class is one from the net.java.sip.communicator.service.protocol.ServerStoredDetails or implemented one in the operation set for the user info
 * @param contact Contact
 * @param detailClass Class
 * @return Iterator
 */
public <T extends GenericDetail>Iterator<T> getDetailsAndDescendants(Contact contact,Class<T> detailClass){
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  List<T> result=new LinkedList<T>();
  if (details == null)   return result.iterator();
  for (  GenericDetail item : details)   if (detailClass.isInstance(item)) {
    @SuppressWarnings("String_Node_Str") T t=(T)item;
    result.add(t);
  }
  return result.iterator();
}

Fixed version (ground truth):
/** 
 * returns the user details from the specified class or its descendants the class is one from the net.java.sip.communicator.service.protocol.ServerStoredDetails or implemented one in the operation set for the user info
 * @param contact Contact
 * @param detailClass Class
 * @return Iterator
 */
public <T extends GenericDetail>Iterator<T> getDetailsAndDescendants(Contact contact,Class<T> detailClass){
  if (isPrivateMessagingContact(contact))   return new LinkedList<T>().iterator();
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  List<T> result=new LinkedList<T>();
  if (details == null)   return result.iterator();
  for (  GenericDetail item : details)   if (detailClass.isInstance(item)) {
    @SuppressWarnings("String_Node_Str") T t=(T)item;
    result.add(t);
  }
  return result.iterator();
}
Program: 102957
Project: 102957
Buggy source:
/** 
 * returns the user details from the specified class exactly that class not its descendants
 * @param contact Contact
 * @param detailClass Class
 * @return Iterator
 */
public Iterator<GenericDetail> getDetails(Contact contact,Class<? extends GenericDetail> detailClass){
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  List<GenericDetail> result=new LinkedList<GenericDetail>();
  if (details == null)   return result.iterator();
  for (  GenericDetail item : details)   if (detailClass.equals(item.getClass()))   result.add(item);
  return result.iterator();
}

Fixed version (ground truth):
/** 
 * returns the user details from the specified class exactly that class not its descendants
 * @param contact Contact
 * @param detailClass Class
 * @return Iterator
 */
public Iterator<GenericDetail> getDetails(Contact contact,Class<? extends GenericDetail> detailClass){
  if (isPrivateMessagingContact(contact))   return new LinkedList<GenericDetail>().iterator();
  List<GenericDetail> details=infoRetreiver.getContactDetails(contact.getAddress());
  List<GenericDetail> result=new LinkedList<GenericDetail>();
  if (details == null)   return result.iterator();
  for (  GenericDetail item : details)   if (detailClass.equals(item.getClass()))   result.add(item);
  return result.iterator();
}
Program: 102959
Project: 102959
Buggy source:
/** 
 * when there is no image for contact we must retrieve it add contacts for image update
 * @param c ContactJabberImpl
 */
protected void addContactForImageUpdate(ContactJabberImpl c){
  if (imageRetriever == null) {
    imageRetriever=new ImageRetriever();
    imageRetriever.start();
  }
  imageRetriever.addContact(c);
}

Fixed version (ground truth):
/** 
 * when there is no image for contact we must retrieve it add contacts for image update
 * @param contact ContactJabberImpl
 */
protected void addContactForImageUpdate(ContactJabberImpl contact){
  if (contact instanceof VolatileContactJabberImpl && ((VolatileContactJabberImpl)contact).isPrivateMessagingContact())   return;
  if (imageRetriever == null) {
    imageRetriever=new ImageRetriever();
    imageRetriever.start();
  }
  imageRetriever.addContact(contact);
}
Program: 102960
Project: 102960
Buggy source:
/** 
 * Handles the un-registration of a <tt>ProtocolProviderService</tt>. Removes the given <tt>protocolProvider</tt> from the list of queried providers.
 * @param protocolProvider the <tt>ProtocolProviderService</tt> to remove
 */
private static void handleProviderRemoved(ProtocolProviderService protocolProvider){
  if (phoneProviders.contains(protocolProvider))   phoneProviders.remove(protocolProvider);
}

Fixed version (ground truth):
/** 
 * Handles the un-registration of a <tt>ProtocolProviderService</tt>. Removes the given <tt>protocolProvider</tt> from the list of queried providers.
 * @param protocolProvider the <tt>ProtocolProviderService</tt> to remove
 */
private static void handleProviderRemoved(ProtocolProviderService protocolProvider){
  if (phoneProviders.contains(protocolProvider))   phoneProviders.remove(protocolProvider);
  protocolProvider.removeRegistrationStateChangeListener(ppRegListener);
}
Program: 102961
Project: 102961
Buggy source:
/** 
 * Handles the registration of a new <tt>ProtocolProviderService</tt>. Adds the given <tt>protocolProvider</tt> to the list of queried providers.
 * @param protocolProvider the <tt>ProtocolProviderService</tt> to add
 */
private static void handleProviderAdded(ProtocolProviderService protocolProvider){
  if (protocolProvider.getOperationSet(OperationSetServerStoredContactInfo.class) != null && protocolProvider.isRegistered() && !phoneProviders.contains(protocolProvider)) {
    phoneProviders.add(protocolProvider);
  }
}

Fixed version (ground truth):
/** 
 * Handles the registration of a new <tt>ProtocolProviderService</tt>. Adds the given <tt>protocolProvider</tt> to the list of queried providers.
 * @param protocolProvider the <tt>ProtocolProviderService</tt> to add
 */
private static void handleProviderAdded(ProtocolProviderService protocolProvider){
  if (protocolProvider.getOperationSet(OperationSetServerStoredContactInfo.class) != null && !phoneProviders.contains(protocolProvider)) {
    if (protocolProvider.isRegistered()) {
      phoneProviders.add(protocolProvider);
    }
 else {
      protocolProvider.addRegistrationStateChangeListener(ppRegListener);
    }
  }
}
Program: 102962
Project: 102962
Buggy source:
/** 
 * Returns a list of all currently registered server stored contact info providers.
 * @return a list of all currently registered server stored contact infoproviders
 */
public static List<ProtocolProviderService> getPhoneNumberProviders(){
  if (phoneProviders != null)   return phoneProviders;
  phoneProviders=new LinkedList<ProtocolProviderService>();
  bundleContext.addServiceListener(new ProtocolProviderRegListener());
  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);
      ProtocolProviderService protocolProvider;
      for (      AccountID accountID : providerFactory.getRegisteredAccounts()) {
        serRef=providerFactory.getProviderForAccount(accountID);
        protocolProvider=(ProtocolProviderService)bundleContext.getService(serRef);
        handleProviderAdded(protocolProvider);
      }
    }
  }
  return phoneProviders;
}

Fixed version (ground truth):
/** 
 * Returns a list of all currently registered server stored contact info providers.
 * @return a list of all currently registered server stored contact infoproviders
 */
public static List<ProtocolProviderService> getPhoneNumberProviders(){
  if (phoneProviders != null)   return phoneProviders;
  phoneProviders=new LinkedList<ProtocolProviderService>();
  ppRegListener=new ProtocolProviderRegistrationListener();
  bundleContext.addServiceListener(new ProtocolProviderServiceRegListener());
  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);
      ProtocolProviderService protocolProvider;
      for (      AccountID accountID : providerFactory.getRegisteredAccounts()) {
        serRef=providerFactory.getProviderForAccount(accountID);
        protocolProvider=(ProtocolProviderService)bundleContext.getService(serRef);
        handleProviderAdded(protocolProvider);
      }
    }
  }
  return phoneProviders;
}
Program: 102963
Project: 102963
Buggy source:
public void run(){
  deviceComboBoxActionListener.actionPerformed(null);
}

Fixed version (ground truth):
public void run(){
  deviceComboBoxActionListener.onAction();
}
Program: 102964
Project: 102964
Buggy source:
public void hierarchyChanged(HierarchyEvent event){
  if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        deviceComboBoxActionListener.actionPerformed(null);
      }
    }
);
  }
}

Fixed version (ground truth):
public void hierarchyChanged(HierarchyEvent event){
  if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        deviceComboBoxActionListener.onAction();
      }
    }
);
  }
}
Program: 102967
Project: 102967
Buggy source:
/** 
 * (Re)Sets the all the port allocators to reflect current values specified in the <tt>ConfigurationService</tt>. Calling this method may very well result in creating new port allocators or destroying existing ones.
 */
protected static void initializePortNumbers(){
  ConfigurationService cfg=ProtocolMediaActivator.getConfigurationService();
  String minPortNumberStr=cfg.getString(OperationSetBasicTelephony.MIN_MEDIA_PORT_NUMBER_PROPERTY_NAME);
  String maxPortNumberStr=cfg.getString(OperationSetBasicTelephony.MAX_MEDIA_PORT_NUMBER_PROPERTY_NAME);
  defaultPortTracker.tryRange(minPortNumberStr,maxPortNumberStr);
  minPortNumberStr=cfg.getString(OperationSetBasicTelephony.MIN_VIDEO_PORT_NUMBER_PROPERTY_NAME);
  maxPortNumberStr=cfg.getString(OperationSetBasicTelephony.MAX_VIDEO_PORT_NUMBER_PROPERTY_NAME);
  videoPortTracker=PortTracker.createTracker(minPortNumberStr,maxPortNumberStr);
  minPortNumberStr=cfg.getString(OperationSetBasicTelephony.MIN_AUDIO_PORT_NUMBER_PROPERTY_NAME);
  maxPortNumberStr=cfg.getString(OperationSetBasicTelephony.MAX_AUDIO_PORT_NUMBER_PROPERTY_NAME);
  audioPortTracker=PortTracker.createTracker(minPortNumberStr,maxPortNumberStr);
  minPortNumberStr=cfg.getString(OperationSetBasicTelephony.MIN_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME);
  maxPortNumberStr=cfg.getString(OperationSetBasicTelephony.MAX_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME);
  dataChannelPortTracker=PortTracker.createTracker(minPortNumberStr,maxPortNumberStr);
}

Fixed version (ground truth):
/** 
 * Tries to set the ranges of the <tt>PortTracker</tt>s (e.g. default, audio, video, data channel) to the values specified in the <tt>ConfigurationService</tt>.
 */
protected synchronized static void initializePortNumbers(){
  ConfigurationService cfg=ProtocolMediaActivator.getConfigurationService();
  String minPort=cfg.getString(OperationSetBasicTelephony.MIN_MEDIA_PORT_NUMBER_PROPERTY_NAME);
  String maxPort=cfg.getString(OperationSetBasicTelephony.MAX_MEDIA_PORT_NUMBER_PROPERTY_NAME);
  defaultPortTracker.tryRange(minPort,maxPort);
  minPort=cfg.getString(OperationSetBasicTelephony.MIN_VIDEO_PORT_NUMBER_PROPERTY_NAME);
  maxPort=cfg.getString(OperationSetBasicTelephony.MAX_VIDEO_PORT_NUMBER_PROPERTY_NAME);
  if (videoPortTracker == null)   videoPortTracker=PortTracker.createTracker(minPort,maxPort);
 else   videoPortTracker.tryRange(minPort,maxPort);
  minPort=cfg.getString(OperationSetBasicTelephony.MIN_AUDIO_PORT_NUMBER_PROPERTY_NAME);
  maxPort=cfg.getString(OperationSetBasicTelephony.MAX_AUDIO_PORT_NUMBER_PROPERTY_NAME);
  if (audioPortTracker == null)   audioPortTracker=PortTracker.createTracker(minPort,maxPort);
 else   audioPortTracker.tryRange(minPort,maxPort);
  minPort=cfg.getString(OperationSetBasicTelephony.MIN_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME);
  maxPort=cfg.getString(OperationSetBasicTelephony.MAX_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME);
  if (dataPortTracker == null)   dataPortTracker=PortTracker.createTracker(minPort,maxPort);
 else   dataPortTracker.tryRange(minPort,maxPort);
}
Program: 102968
Project: 102968
Buggy source:
/** 
 * Constructs <tt>DeviceComboBoxField</tt> instance. 
 * @param type the type of the configuration panel
 * @param devicePanel the container of the field.
 */
public DeviceComboBoxField(final int type,Container devicePanel){
  model=new DeviceConfigurationComboBoxModel(mediaService.getDeviceConfiguration(),type);
  if (!OSUtils.IS_WINDOWS || type != DeviceConfigurationComboBoxModel.VIDEO) {
    deviceComboBox=new JComboBox();
    deviceComboBox.setEditable(false);
    deviceComboBox.setModel(model);
    devicePanel.add(deviceComboBox);
    deviceComponent=deviceComboBox;
  }
 else {
    deviceList=new JList<CaptureDevice>();
    deviceList.setModel(model);
    JScrollPane listScroller=new JScrollPane(deviceComboBox);
    listScroller.setPreferredSize(new Dimension(200,38));
    deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    deviceList.setLayoutOrientation(JList.VERTICAL);
    deviceList.setVisibleRowCount(-1);
    deviceList.setSelectedValue(model.getSelectedItem(),true);
    devicePanel.add(deviceList);
    deviceComponent=deviceList;
  }
}

Fixed version (ground truth):
/** 
 * Constructs <tt>DeviceComboBoxField</tt> instance.
 * @param type the type of the configuration panel
 * @param devicePanel the container of the field.
 */
public DeviceComboBoxField(final int type,Container devicePanel){
  model=new DeviceConfigurationComboBoxModel(mediaService.getDeviceConfiguration(),type);
  if (!OSUtils.IS_WINDOWS || type != DeviceConfigurationComboBoxModel.VIDEO) {
    deviceComboBox=new JComboBox();
    deviceComboBox.setEditable(false);
    deviceComboBox.setModel(model);
    devicePanel.add(deviceComboBox);
    deviceComponent=deviceComboBox;
  }
 else {
    deviceList=new JList();
    deviceList.setModel(model);
    JScrollPane listScroller=new JScrollPane(deviceComboBox);
    listScroller.setPreferredSize(new Dimension(200,38));
    deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    deviceList.setLayoutOrientation(JList.VERTICAL);
    deviceList.setVisibleRowCount(-1);
    deviceList.setSelectedValue(model.getSelectedItem(),true);
    devicePanel.add(deviceList);
    deviceComponent=deviceList;
  }
}
Program: 102971
Project: 102971
Buggy source:
/** 
 * {@inheritDoc}If this telephony conference switches from being a conference focus to not being such, disposes of the mixers used by this instance when it was a conference focus
 */
@Override protected void conferenceFocusChanged(boolean oldValue,boolean newValue){
  if (oldValue && !newValue) {
    Arrays.fill(mixers,null);
    if (videoRTPTranslator != null) {
      videoRTPTranslator.dispose();
      videoRTPTranslator=null;
    }
  }
  super.conferenceFocusChanged(oldValue,newValue);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}If this telephony conference switches from being a conference focus to not being such, disposes of the mixers used by this instance when it was a conference focus
 */
@Override protected void conferenceFocusChanged(boolean oldValue,boolean newValue){
  if (oldValue && !newValue) {
    Arrays.fill(mixers,null);
  }
  super.conferenceFocusChanged(oldValue,newValue);
}
Program: 102974
Project: 102974
Buggy source:
/** 
 * Returns -1 to indicate that this group doesn't have a source index.
 * @return -1
 */
@Override public int getSourceIndex(){
  if (contactSourceIndex >= 0)   return contactSourceIndex * MAX_GROUPS;
  if (contactSource.getType() == ContactSourceService.HISTORY_TYPE)   return Integer.MAX_VALUE;
  return Integer.MAX_VALUE - 1;
}

Fixed version (ground truth):
/** 
 * Returns -1 to indicate that this group doesn't have a source index.
 * @return -1
 */
@Override public int getSourceIndex(){
  if (contactSourceIndex >= 0)   return contactSourceIndex * MAX_GROUPS;
  if (contactSource.getType() == ContactSourceService.HISTORY_TYPE)   return Integer.MAX_VALUE - MAX_GROUPS;
  return Integer.MAX_VALUE - MAX_GROUPS - 1;
}
Program: 102975
Project: 102975
Buggy source:
/** 
 * Indicates if the given <tt>ContactActionMenuItem</tt> should be visible  for the given <tt>SourceContact</tt>.
 * @param contactAction the <tt>ContactActionMenuItem</tt> to verifyif the given action should be visible
 * @return <tt>true</tt> if the given <tt>ContactActionMenuItem</tt> is visible for the given <tt>SourceContact</tt>, <tt>false</tt> - otherwise
 */
private static boolean isContactActionVisible(ContactActionMenuItem<SourceContact> contactAction,SourceContact contact){
  if (contactAction.isVisible(contact))   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Indicates if the given <tt>ContactActionMenuItem</tt> should be visible for the given <tt>SourceContact</tt>.
 * @param contactAction the <tt>ContactActionMenuItem</tt> to verifyif the given action should be visible
 * @return <tt>true</tt> if the given <tt>ContactActionMenuItem</tt> isvisible for the given <tt>SourceContact</tt>, <tt>false</tt> - otherwise
 */
private static boolean isContactActionVisible(ContactActionMenuItem<SourceContact> contactAction,SourceContact contact){
  if (contactAction.isVisible(contact))   return true;
  return false;
}
Program: 102976
Project: 102976
Buggy source:
public void run(){
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  bundleContext.registerService(UIService.class.getName(),uiService,null);
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  bundleContext.registerService(ShutdownService.class.getName(),uiService,null);
}

Fixed version (ground truth):
@Override public void run(){
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  bundleContext.registerService(UIService.class.getName(),uiService,null);
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  bundleContext.registerService(ShutdownService.class.getName(),uiService,null);
}
Program: 102977
Project: 102977
Buggy source:
/** 
 * Called when this bundle is started.
 * @param bContext The execution context of the bundle being started.
 * @throws Exception if the bundle is not correctly started
 */
public void start(BundleContext bContext) throws Exception {
  isStarted=true;
  GuiActivator.bundleContext=bContext;
  ConfigurationUtils.loadGuiConfigurations();
  try {
    alertUIService=new AlertUIServiceImpl();
    bundleContext.registerService(AlertUIService.class.getName(),alertUIService,null);
    bundleContext.registerService(ImageLoaderService.class.getName(),new ImageLoaderServiceImpl(),null);
    uiService=new UIServiceImpl();
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        uiService.loadApplicationGui();
        GuiActivator.getConfigurationService().addPropertyChangeListener(uiService);
        bundleContext.addServiceListener(uiService);
        new Thread(new Runnable(){
          public void run(){
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
            bundleContext.registerService(UIService.class.getName(),uiService,null);
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
            bundleContext.registerService(ShutdownService.class.getName(),uiService,null);
          }
        }
).start();
      }
    }
);
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
}

Fixed version (ground truth):
/** 
 * Called when this bundle is started.
 * @param bContext The execution context of the bundle being started.
 * @throws Exception if the bundle is not correctly started
 */
public void start(BundleContext bContext) throws Exception {
  isStarted=true;
  GuiActivator.bundleContext=bContext;
  ConfigurationUtils.loadGuiConfigurations();
  try {
    alertUIService=new AlertUIServiceImpl();
    bundleContext.registerService(AlertUIService.class.getName(),alertUIService,null);
    bundleContext.registerService(ImageLoaderService.class.getName(),new ImageLoaderServiceImpl(),null);
    uiService=new UIServiceImpl();
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        uiService.loadApplicationGui();
        GuiActivator.getConfigurationService().addPropertyChangeListener(uiService);
        bundleContext.addServiceListener(uiService);
        new Thread(){
          @Override public void run(){
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
            bundleContext.registerService(UIService.class.getName(),uiService,null);
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
            bundleContext.registerService(ShutdownService.class.getName(),uiService,null);
          }
        }
.start();
      }
    }
);
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
}
Program: 102978
Project: 102978
Buggy source:
/** 
 * Make the parent persistent presence operation set dispatch a subscription moved event.
 * @param oldParentGroup the group where the source contact was locatedbefore being moved
 * @param newParentGroup the group that the source contact is currently in.
 * @param contact the contact that was added
 */
private void fireContactMoved(ContactGroup oldParentGroup,ContactGroupJabberImpl newParentGroup,ContactJabberImpl contact){
  if (parentOperationSet == null) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    return;
  }
  parentOperationSet.fireSubscriptionMovedEvent(contact,oldParentGroup,newParentGroup);
}

Fixed version (ground truth):
/** 
 * Make the parent persistent presence operation set dispatch a subscription moved event.
 * @param oldParentGroup the group where the source contact was locatedbefore being moved
 * @param newParentGroup the group that the source contact is currently in.
 * @param contact the contact that was added
 */
private void fireContactMoved(ContactGroup oldParentGroup,ContactGroup newParentGroup,ContactJabberImpl contact){
  if (parentOperationSet == null) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    return;
  }
  parentOperationSet.fireSubscriptionMovedEvent(contact,oldParentGroup,newParentGroup);
}
Program: 102980
Project: 102980
Buggy source:
/** 
 * Creates a non persistent contact for the specified address. This would also create (if necessary) a group for volatile contacts that would not be added to the server stored contact list. This method would have no effect on the server stored contact list.
 * @param id the address of the contact to create.
 * @param isPrivateMessagingContact indicates if the contact should be private messaging contact or not.
 * @return the newly created volatile <tt>ContactImpl</tt>
 */
ContactJabberImpl createVolatileContact(String id,boolean isPrivateMessagingContact){
  VolatileContactJabberImpl newVolatileContact=new VolatileContactJabberImpl(id,this,isPrivateMessagingContact);
  ContactGroupJabberImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null) {
    theVolatileGroup=new VolatileContactGroupJabberImpl(JabberActivator.getResources().getI18NString("String_Node_Str"),this);
    theVolatileGroup.addContact(newVolatileContact);
    this.rootGroup.addSubGroup(theVolatileGroup);
    fireGroupEvent(theVolatileGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    theVolatileGroup.addContact(newVolatileContact);
    fireContactAdded(theVolatileGroup,newVolatileContact);
  }
  return newVolatileContact;
}

Fixed version (ground truth):
/** 
 * Creates a non persistent contact for the specified address. This would also create (if necessary) a group for volatile contacts that would not be added to the server stored contact list. This method would have no effect on the server stored contact list.
 * @param id the address of the contact to create.
 * @param isPrivateMessagingContact indicates if the contact should beprivate messaging contact or not.
 * @return the newly created volatile <tt>ContactImpl</tt>
 */
ContactJabberImpl createVolatileContact(String id,boolean isPrivateMessagingContact){
  VolatileContactJabberImpl newVolatileContact=new VolatileContactJabberImpl(id,this,isPrivateMessagingContact);
  ContactGroupJabberImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null) {
    theVolatileGroup=new VolatileContactGroupJabberImpl(JabberActivator.getResources().getI18NString("String_Node_Str"),this);
    theVolatileGroup.addContact(newVolatileContact);
    this.rootGroup.addSubGroup(theVolatileGroup);
    fireGroupEvent(theVolatileGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    theVolatileGroup.addContact(newVolatileContact);
    fireContactAdded(theVolatileGroup,newVolatileContact);
  }
  return newVolatileContact;
}
Program: 102982
Project: 102982
Buggy source:
/** 
 * Checks if the contact address is associated with private messaging  contact or not.
 * @param contactAddress the address of the contact.
 * @return <tt>true</tt> the contact address is associated with private messaging contact and <tt>false</tt> if not.
 */
public boolean isPrivateMessagingContact(String contactAddress){
  ContactGroupJabberImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null)   return false;
  ContactJabberImpl contact=theVolatileGroup.findContact(contactAddress);
  if (contact == null || !(contact instanceof VolatileContactJabberImpl))   return false;
  return ((VolatileContactJabberImpl)contact).isPrivateMessagingContact();
}

Fixed version (ground truth):
/** 
 * Checks if the contact address is associated with private messaging contact or not.
 * @param contactAddress the address of the contact.
 * @return <tt>true</tt> the contact address is associated with privatemessaging contact and <tt>false</tt> if not.
 */
public boolean isPrivateMessagingContact(String contactAddress){
  ContactGroupJabberImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null)   return false;
  ContactJabberImpl contact=theVolatileGroup.findContact(contactAddress);
  if (contact == null || !(contact instanceof VolatileContactJabberImpl))   return false;
  return ((VolatileContactJabberImpl)contact).isPrivateMessagingContact();
}
Program: 102983
Project: 102983
Buggy source:
/** 
 * Delivers the specified event to all registered message listeners.
 * @param evt the <tt>EventObject</tt> that we'd like delivered to allregistered message listeners.
 */
private void fireMessageEvent(EventObject evt){
  Iterable<ChatRoomMessageListener> listeners;
synchronized (messageListeners) {
    listeners=new ArrayList<ChatRoomMessageListener>(messageListeners);
  }
  for (  ChatRoomMessageListener listener : listeners) {
    try {
      if (evt instanceof ChatRoomMessageDeliveredEvent) {
        listener.messageDelivered((ChatRoomMessageDeliveredEvent)evt);
      }
 else       if (evt instanceof ChatRoomMessageReceivedEvent) {
        listener.messageReceived((ChatRoomMessageReceivedEvent)evt);
      }
 else       if (evt instanceof ChatRoomMessageDeliveryFailedEvent) {
        listener.messageDeliveryFailed((ChatRoomMessageDeliveryFailedEvent)evt);
      }
    }
 catch (    Throwable e) {
      logger.error("String_Node_Str" + listener,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Delivers the specified event to all registered message listeners.
 * @param evt the <tt>EventObject</tt> that we'd like delivered to allregistered message listeners.
 */
void fireMessageEvent(EventObject evt){
  Iterable<ChatRoomMessageListener> listeners;
synchronized (messageListeners) {
    listeners=new ArrayList<ChatRoomMessageListener>(messageListeners);
  }
  for (  ChatRoomMessageListener listener : listeners) {
    try {
      if (evt instanceof ChatRoomMessageDeliveredEvent) {
        listener.messageDelivered((ChatRoomMessageDeliveredEvent)evt);
      }
 else       if (evt instanceof ChatRoomMessageReceivedEvent) {
        listener.messageReceived((ChatRoomMessageReceivedEvent)evt);
      }
 else       if (evt instanceof ChatRoomMessageDeliveryFailedEvent) {
        listener.messageDeliveryFailed((ChatRoomMessageDeliveryFailedEvent)evt);
      }
    }
 catch (    Throwable e) {
      logger.error("String_Node_Str" + listener,e);
    }
  }
}
Program: 102984
Project: 102984
Buggy source:
/** 
 * Removes the specified group from the list of groups in this list.
 * @param group the <tt>MetaContactGroup</tt> to remove.
 * @return true if the group has been successfully removed and falseotherwise.
 */
boolean removeSubgroup(MetaContactGroup group){
  return subgroups.remove(group);
}

Fixed version (ground truth):
/** 
 * Removes the specified group from the list of groups in this list.
 * @param group the <tt>MetaContactGroup</tt> to remove.
 * @return true if the group has been successfully removed and falseotherwise.
 */
boolean removeSubgroup(MetaContactGroup group){
  if (subgroups.contains(group)) {
    removeSubgroup(subgroupsOrderedCopy.indexOf(group));
    return true;
  }
 else {
    return false;
  }
}
Program: 102985
Project: 102985
Buggy source:
/** 
 * Indicates that a new plugin component has been added. Adds it to this container if it belongs to it.
 * @param event the <tt>PluginComponentEvent</tt> that notified us
 */
public void pluginComponentAdded(PluginComponentEvent event){
  PluginComponentFactory factory=event.getPluginComponentFactory();
  if (!factory.getContainer().equals(net.java.sip.communicator.service.gui.Container.CONTAINER_CHAT_WRITE_PANEL))   return;
  PluginComponent component=factory.getPluginComponentInstance(this);
  ChatSession chatSession=chatPanel.getChatSession();
  if (chatSession != null) {
    ChatTransport currentTransport=chatSession.getCurrentChatTransport();
    Object currentDescriptor=currentTransport.getDescriptor();
    if (currentDescriptor instanceof Contact) {
      Contact contact=(Contact)currentDescriptor;
      component.setCurrentContact(contact,currentTransport.getResourceName());
    }
  }
  centerPanel.add((Component)component.getComponent());
  this.centerPanel.repaint();
}

Fixed version (ground truth):
/** 
 * Indicates that a new plugin component has been added. Adds it to this container if it belongs to it.
 * @param event the <tt>PluginComponentEvent</tt> that notified us
 */
public void pluginComponentAdded(PluginComponentEvent event){
  PluginComponentFactory factory=event.getPluginComponentFactory();
  if (!factory.getContainer().equals(net.java.sip.communicator.service.gui.Container.CONTAINER_CHAT_WRITE_PANEL))   return;
  PluginComponent component=factory.getPluginComponentInstance(this);
  ChatSession chatSession=chatPanel.getChatSession();
  if (chatSession != null) {
    ChatTransport currentTransport=chatSession.getCurrentChatTransport();
    Object currentDescriptor=currentTransport.getDescriptor();
    if (currentDescriptor instanceof Contact) {
      Contact contact=(Contact)currentDescriptor;
      component.setCurrentContact(contact,currentTransport.getResourceName());
    }
  }
  GridBagConstraints constraints=new GridBagConstraints();
  constraints.anchor=GridBagConstraints.NORTHEAST;
  constraints.fill=GridBagConstraints.NONE;
  constraints.gridy=0;
  constraints.gridheight=1;
  constraints.weightx=0f;
  constraints.weighty=0f;
  constraints.insets=new Insets(0,3,0,0);
  centerPanel.add((Component)component.getComponent(),constraints);
  this.centerPanel.repaint();
}
Program: 102987
Project: 102987
Buggy source:
/** 
 * The OtrContactMenu constructor.
 * @param otrContact the OtrContact this menu refers to.
 * @param inMacOSXScreenMenuBar <tt>true</tt> if the new menu is to bedisplayed in the Mac OS X screen menu bar; <tt>false</tt>, otherwise
 * @param menu the parent menu
 */
public OtrContactMenu(OtrContact otrContact,boolean inMacOSXScreenMenuBar,JMenu menu,boolean isSeparateMenu){
  this.contact=otrContact;
  this.inMacOSXScreenMenuBar=inMacOSXScreenMenuBar;
  this.parentMenu=menu;
  String resourceName=otrContact.resource != null ? "String_Node_Str" + otrContact.resource.getResourceName() : "String_Node_Str";
  separateMenu=isSeparateMenu ? new SIPCommMenu(otrContact.contact.getDisplayName() + resourceName) : null;
  new OtrWeakListener<OtrContactMenu>(this,OtrActivator.scOtrEngine,OtrActivator.scOtrKeyManager);
  setSessionStatus(OtrActivator.scOtrEngine.getSessionStatus(this.contact));
  setOtrPolicy(OtrActivator.scOtrEngine.getContactPolicy(otrContact.contact));
  OtrPolicy policy=OtrActivator.scOtrEngine.getContactPolicy(otrContact.contact);
  if (policy.getAllowV1() && policy.getAllowV2())   policy.setAllowV3(true);
 else   policy.setAllowV3(false);
  OtrActivator.scOtrEngine.setContactPolicy(contact.contact,policy);
  policy=OtrActivator.scOtrEngine.getGlobalPolicy();
  if (policy.getAllowV1() && policy.getAllowV2())   policy.setAllowV3(true);
 else   policy.setAllowV3(false);
  OtrActivator.scOtrEngine.setGlobalPolicy(policy);
  buildMenu();
}

Fixed version (ground truth):
/** 
 * The OtrContactMenu constructor.
 * @param otrContact the OtrContact this menu refers to.
 * @param inMacOSXScreenMenuBar <tt>true</tt> if the new menu is to bedisplayed in the Mac OS X screen menu bar; <tt>false</tt>, otherwise
 * @param menu the parent menu
 */
public OtrContactMenu(OtrContact otrContact,boolean inMacOSXScreenMenuBar,JMenu menu,boolean isSeparateMenu){
  this.contact=otrContact;
  this.inMacOSXScreenMenuBar=inMacOSXScreenMenuBar;
  this.parentMenu=menu;
  String resourceName=otrContact.resource != null ? "String_Node_Str" + otrContact.resource.getResourceName() : "String_Node_Str";
  separateMenu=isSeparateMenu ? new SIPCommMenu(otrContact.contact.getDisplayName() + resourceName) : null;
  new OtrWeakListener<OtrContactMenu>(this,OtrActivator.scOtrEngine,OtrActivator.scOtrKeyManager);
  setSessionStatus(OtrActivator.scOtrEngine.getSessionStatus(this.contact));
  setOtrPolicy(OtrActivator.scOtrEngine.getContactPolicy(otrContact.contact));
  OtrPolicy policy=OtrActivator.scOtrEngine.getContactPolicy(otrContact.contact);
  if (policy.getAllowV1() && policy.getAllowV2() && !policy.getAllowV3()) {
    policy.setAllowV3(true);
    OtrActivator.scOtrEngine.setContactPolicy(contact.contact,policy);
  }
  policy=OtrActivator.scOtrEngine.getGlobalPolicy();
  if (policy.getAllowV1() && policy.getAllowV2() && !policy.getAllowV3()) {
    policy.setAllowV3(true);
    OtrActivator.scOtrEngine.setGlobalPolicy(policy);
  }
  buildMenu();
}