nus-yam/ex-repair huggingface dataset:
Program: 104437
Project: 104437
Buggy source:
/** 
 * Formats all links in the given message.
 * @param message The source message string.
 * @return The message string with properly formatted links.
 */
private String processLinks(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType.equals(HTML_CONTENT_TYPE)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  String wwwURL="String_Node_Str";
  String protocolURL="String_Node_Str";
  String url="String_Node_Str" + wwwURL + "String_Node_Str"+ protocolURL+ "String_Node_Str";
  Pattern p=Pattern.compile(url);
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement;
    if (matchGroup.startsWith("String_Node_Str")) {
      replacement=endPlainTextTag + "String_Node_Str" + "String_Node_Str"+ matchGroup+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    }
 else {
      replacement=endPlainTextTag + "String_Node_Str" + matchGroup+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    }
    m.appendReplacement(msgBuffer,replacement);
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Formats all links in the given message.
 * @param message The source message string.
 * @return The message string with properly formatted links.
 */
private String processLinks(String message,String contentType){
  String startPlainTextTag;
  String endPlainTextTag;
  if (contentType != null && contentType.equals(HTML_CONTENT_TYPE)) {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
 else {
    startPlainTextTag="String_Node_Str";
    endPlainTextTag="String_Node_Str";
  }
  String wwwURL="String_Node_Str";
  String protocolURL="String_Node_Str";
  String url="String_Node_Str" + wwwURL + "String_Node_Str"+ protocolURL+ "String_Node_Str";
  Pattern p=Pattern.compile(url);
  Matcher m=p.matcher(message);
  StringBuffer msgBuffer=new StringBuffer();
  boolean matchSuccessfull=false;
  while (m.find()) {
    if (!matchSuccessfull)     matchSuccessfull=true;
    String matchGroup=m.group().trim();
    String replacement;
    if (matchGroup.startsWith("String_Node_Str")) {
      replacement=endPlainTextTag + "String_Node_Str" + "String_Node_Str"+ matchGroup+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    }
 else {
      replacement=endPlainTextTag + "String_Node_Str" + matchGroup+ "String_Node_Str"+ matchGroup+ "String_Node_Str"+ startPlainTextTag;
    }
    m.appendReplacement(msgBuffer,replacement);
  }
  m.appendTail(msgBuffer);
  return msgBuffer.toString();
}
Program: 104438
Project: 104438
Buggy source:
/** 
 * Initializes this dialog.
 */
private void init(){
  this.getRootPane().setDefaultButton(okButton);
  this.stackTraceScrollPane.getViewport().add(stackTraceTextArea);
  this.stackTraceScrollPane.setPreferredSize(new Dimension(this.getWidth(),100));
  this.buttonsPanel.add(okButton);
  this.okButton.addActionListener(this);
  this.messagePanel.add(iconLabel,BorderLayout.WEST);
  this.mainPanel.add(messagePanel,BorderLayout.NORTH);
  this.mainPanel.add(buttonsPanel,BorderLayout.CENTER);
  this.getContentPane().add(mainPanel);
}

Fixed version (ground truth):
/** 
 * Initializes this dialog.
 */
private void init(){
  this.getRootPane().setDefaultButton(okButton);
  this.stackTraceScrollPane.getViewport().add(stackTraceTextArea);
  this.stackTraceScrollPane.setPreferredSize(new Dimension(this.getWidth(),100));
  this.buttonsPanel.add(okButton);
  this.okButton.addActionListener(this);
  this.mainPanel.add(iconLabel,BorderLayout.WEST);
  this.mainPanel.add(messagePanel,BorderLayout.CENTER);
  this.mainPanel.add(buttonsPanel,BorderLayout.SOUTH);
  this.getContentPane().add(mainPanel);
}
Program: 104439
Project: 104439
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt>. Depending on the user choice sets the return code to the appropriate value.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  if (button.equals(okButton))   this.dispose();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt>. Depending on the user choice sets the return code to the appropriate value.
 * @param e the <tt>ActionEvent</tt> instance that has just been fired.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  if (button.equals(okButton))   this.dispose();
}
Program: 104440
Project: 104440
Buggy source:
/** 
 * @param owner
 * @param message
 * @param title
 * @param type
 */
public ErrorDialog(Frame owner,String message,String title,int type){
  this(owner,message,title);
  if (type == WARNING)   iconLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.WARNING_ICON)));
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>MessageDialog</tt> by specifying the owner window and the message to be displayed.
 * @param owner The dialog owner.
 * @param message The message to be displayed.
 * @param title the title of the error dialog.
 * @param type the dialog type.
 */
public ErrorDialog(Frame owner,String message,String title,int type){
  this(owner,message,title);
  if (type == WARNING)   iconLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.WARNING_ICON)));
}
Program: 104441
Project: 104441
Buggy source:
public void hyperlinkUpdate(HyperlinkEvent e){
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    this.messagePanel.add(stackTraceScrollPane,BorderLayout.SOUTH);
    this.messagePanel.revalidate();
    this.messagePanel.repaint();
    this.pack();
  }
}

Fixed version (ground truth):
public void hyperlinkUpdate(HyperlinkEvent e){
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    this.messagePanel.add(stackTraceScrollPane,BorderLayout.CENTER);
    this.messagePanel.revalidate();
    this.messagePanel.repaint();
    this.pack();
  }
}
Program: 104442
Project: 104442
Buggy source:
/** 
 * Creates a MetaContactListException with the specified message cause and code.
 * @param message a human readable message describing the exception.
 * @param cause the Exception/Error (if any) that caused this Exception.
 * @param code one of the statuc CODE_XXX variable, describing the natureof the exception.
 */
public MetaContactListException(String message,Exception cause,int code){
  super(message,cause);
  this.errCode=code;
}

Fixed version (ground truth):
/** 
 * Creates a MetaContactListException with the specified message error code.
 * @param message a human readable message describing the exception.
 * @param code one of the statuc CODE_XXX variable, describing the natureof the exception.
 */
public MetaContactListException(String message,int code){
  super(message);
  this.errCode=code;
}
Program: 104443
Project: 104443
Buggy source:
/** 
 * Compares this meta contact with the specified object for order.  Returns a negative integer, zero, or a positive integer as this meta contact is less than, equal to, or greater than the specified object. <p> The result of this method is calculated the following way: <p> (contactsOnline - o.contactsOnline) * 1 000 000  <br> + getDisplayName().compareTo(o.getDisplayName()) * 100 000 + getMetaUID().compareTo(o.getMetaUID())<br> <p> Or in other words ordering of meta accounts would be first done by presence status, then display name, and finally (in order to avoid equalities) be the fairly random meta contact metaUID. <p>
 * @param o the Object to be compared.
 * @return  a negative integer, zero, or a positive integer as this objectis less than, equal to, or greater than the specified object.
 * @throws ClassCastException if the specified object is nota MetaContactListImpl
 */
public int compareTo(Object o){
  MetaContactImpl target=(MetaContactImpl)o;
  int isOnline=(contactsOnline > 0) ? 1 : 0;
  int targetIsOnline=(target.contactsOnline > 0) ? 1 : 0;
  return ((10 - isOnline) - (10 - targetIsOnline)) * 1000000 + getDisplayName().compareToIgnoreCase(target.getDisplayName()) * 10000 + getMetaUID().compareTo(target.getMetaUID());
}

Fixed version (ground truth):
/** 
 * Compares this meta contact with the specified object for order.  Returns a negative integer, zero, or a positive integer as this meta contact is less than, equal to, or greater than the specified object. <p> The result of this method is calculated the following way: <p> (contactsOnline - o.contactsOnline) * 1 000 000  <br> + getDisplayName().compareTo(o.getDisplayName()) * 100 000 + getMetaUID().compareTo(o.getMetaUID())<br> <p> Or in other words ordering of meta accounts would be first done by presence status, then display name, and finally (in order to avoid equalities) be the fairly random meta contact metaUID. <p>
 * @param o the Object to be compared.
 * @return  a negative integer, zero, or a positive integer as this objectis less than, equal to, or greater than the specified object.
 * @throws ClassCastException if the specified object is nota MetaContactListImpl
 */
public int compareTo(Object o){
  MetaContactImpl target=(MetaContactImpl)o;
  int isOnline=(contactsOnline > 0) ? 1 : 0;
  int targetIsOnline=(target.contactsOnline > 0) ? 1 : 0;
  return ((10 - isOnline) - (10 - targetIsOnline)) * 100000000 + getDisplayName().compareToIgnoreCase(target.getDisplayName()) * 10000 + getMetaUID().compareTo(target.getMetaUID());
}
Program: 104444
Project: 104444
Buggy source:
/** 
 * Removes a given <tt>ChatPanel</tt> from this chat window.
 * @param chatPanel The <tt>ChatPanel</tt> to remove.
 */
public void removeChat(ChatPanel chatPanel){
  logger.debug("String_Node_Str" + chatPanel.getChatName());
  if (getChatTabCount() == 0) {
    this.getContentPane().remove(chatPanel);
    this.setVisible(false);
    return;
  }
  int index=chatTabbedPane.indexOfComponent(chatPanel);
  if (index != -1) {
    if (chatTabbedPane.getTabCount() > 1)     chatTabbedPane.removeTabAt(index);
    if (chatTabbedPane.getTabCount() == 1) {
      ChatPanel currentChatPanel=(ChatPanel)this.chatTabbedPane.getComponentAt(0);
      this.chatTabbedPane.removeAll();
      this.getContentPane().remove(chatTabbedPane);
      this.getContentPane().add(currentChatPanel,BorderLayout.CENTER);
      this.setCurrentChatPanel(currentChatPanel);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes a given <tt>ChatPanel</tt> from this chat window.
 * @param chatPanel The <tt>ChatPanel</tt> to remove.
 */
public void removeChat(ChatPanel chatPanel){
  logger.debug("String_Node_Str" + chatPanel.getChatName());
  if (getChatTabCount() == 0) {
    this.getContentPane().remove(chatPanel);
    this.getContentPane().validate();
    this.getContentPane().repaint();
    this.setVisible(false);
    return;
  }
  int index=chatTabbedPane.indexOfComponent(chatPanel);
  if (index != -1) {
    if (chatTabbedPane.getTabCount() > 1)     chatTabbedPane.removeTabAt(index);
    if (chatTabbedPane.getTabCount() == 1) {
      ChatPanel currentChatPanel=(ChatPanel)this.chatTabbedPane.getComponentAt(0);
      this.chatTabbedPane.removeAll();
      this.getContentPane().remove(chatTabbedPane);
      this.getContentPane().add(currentChatPanel,BorderLayout.CENTER);
      this.setCurrentChatPanel(currentChatPanel);
    }
  }
}
Program: 104445
Project: 104445
Buggy source:
public void actionPerformed(ActionEvent e){
  Object selectedObject=getContactListPanel().getContactList().getSelectedValue();
  if (selectedObject instanceof MetaContact) {
    RenameContactDialog dialog=new RenameContactDialog(MainFrame.this,(MetaContact)selectedObject);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
 else   if (selectedObject instanceof MetaContactGroup) {
    RenameGroupDialog dialog=new RenameGroupDialog(MainFrame.this,(MetaContactGroup)selectedObject);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  ContactList clist=getContactListPanel().getContactList();
  Object selectedValue=clist.getSelectedValue();
  if (selectedValue instanceof MetaContact) {
    MetaContact contact=(MetaContact)selectedValue;
    SwingUtilities.invokeLater(getContactListPanel().new RunMessageWindow(contact));
  }
 else   if (selectedValue instanceof MetaContactGroup) {
    MetaContactGroup group=(MetaContactGroup)selectedValue;
    ContactListModel model=(ContactListModel)clist.getModel();
    if (model.isGroupClosed(group)) {
      model.openGroup(group);
    }
  }
}
Program: 104446
Project: 104446
Buggy source:
/** 
 * Initiates the content of this frame.
 */
private void init(){
  this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2,0),new RenameAction());
  this.setJMenuBar(menu);
  this.contactListPanel.add(tabbedPane,BorderLayout.CENTER);
  this.contactListPanel.add(callManager,BorderLayout.SOUTH);
  this.mainPanel.add(quickMenu,BorderLayout.NORTH);
  this.mainPanel.add(contactListPanel,BorderLayout.CENTER);
  this.mainPanel.add(statusPanel,BorderLayout.SOUTH);
  this.getContentPane().add(mainPanel);
}

Fixed version (ground truth):
/** 
 * Initiates the content of this frame.
 */
private void init(){
  this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2,0),new RenameAction());
  this.setJMenuBar(menu);
  this.contactListPanel.add(tabbedPane,BorderLayout.CENTER);
  this.contactListPanel.add(callManager,BorderLayout.SOUTH);
  this.mainPanel.add(quickMenu,BorderLayout.NORTH);
  this.mainPanel.add(contactListPanel,BorderLayout.CENTER);
  this.mainPanel.add(statusPanel,BorderLayout.SOUTH);
  this.mainPanel.getActionMap().put("String_Node_Str",new RunMessageWindowAction());
  InputMap imap=this.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"String_Node_Str");
  this.getContentPane().add(mainPanel);
}
Program: 104447
Project: 104447
Buggy source:
/** 
 * Returns a PresenceStatus instance representing the state this provider is currently in.
 * @return PresenceStatus
 */
public PresenceStatus getPresenceStatus(){
  if (currentIcqStatus == -1)   return IcqStatusEnum.OFFLINE;
  return icqStatusLongToPresenceStatus(currentIcqStatus);
}

Fixed version (ground truth):
/** 
 * Returns a PresenceStatus instance representing the state this provider is currently in.
 * @return PresenceStatus
 */
public PresenceStatus getPresenceStatus(){
  return icqStatusLongToPresenceStatus(currentIcqStatus);
}
Program: 104448
Project: 104448
Buggy source:
/** 
 * Converts the specified icqstatus to one of the status fields of the IcqStatusEnum class.
 * @param icqStatus the icqStatus as retured in FullUserInfo by the joscarstack
 * @return a PresenceStatus instance representation of the "long" icqStatusparameter. The returned result is one of the IcqStatusEnum fields.
 */
private IcqStatusEnum icqStatusLongToPresenceStatus(long icqStatus){
  if ((icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE) != 0) {
    return IcqStatusEnum.INVISIBLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_DND) != 0) {
    return IcqStatusEnum.DO_NOT_DISTURB;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED) != 0) {
    return IcqStatusEnum.OCCUPIED;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_NA) != 0) {
    return IcqStatusEnum.NOT_AVAILABLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_AWAY) != 0) {
    return IcqStatusEnum.AWAY;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_FFC) != 0) {
    return IcqStatusEnum.FREE_FOR_CHAT;
  }
  return IcqStatusEnum.ONLINE;
}

Fixed version (ground truth):
/** 
 * Converts the specified icqstatus to one of the status fields of the IcqStatusEnum class.
 * @param icqStatus the icqStatus as retured in FullUserInfo by the joscarstack
 * @return a PresenceStatus instance representation of the "long" icqStatusparameter. The returned result is one of the IcqStatusEnum fields.
 */
private IcqStatusEnum icqStatusLongToPresenceStatus(long icqStatus){
  if (icqStatus == -1) {
    return IcqStatusEnum.OFFLINE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE) != 0) {
    return IcqStatusEnum.INVISIBLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_DND) != 0) {
    return IcqStatusEnum.DO_NOT_DISTURB;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED) != 0) {
    return IcqStatusEnum.OCCUPIED;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_NA) != 0) {
    return IcqStatusEnum.NOT_AVAILABLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_AWAY) != 0) {
    return IcqStatusEnum.AWAY;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_FFC) != 0) {
    return IcqStatusEnum.FREE_FOR_CHAT;
  }
  return IcqStatusEnum.ONLINE;
}
Program: 104449
Project: 104449
Buggy source:
/** 
 * Get the PresenceStatus for a particular contact. This method is not meant to be used by the user interface (which would simply register as a presence listener and always follow contact status) but rather by other plugins that may for some reason need to know the status of a particular contact. <p>
 * @param contactIdentifier the dientifier of the contact whose status we'reinterested in.
 * @return PresenceStatus the <tt>PresenceStatus</tt> of the specified<tt>contact</tt>
 * @throws java.lang.IllegalStateException if the provider is not signedon ICQ
 * @throws java.lang.IllegalArgumentException if <tt>contact</tt> is nota valid <tt>IcqContact</tt>
 */
public PresenceStatus queryContactStatus(String contactIdentifier) throws IllegalStateException, IllegalArgumentException {
  assertConnected();
  StatusResponseRetriever responseRetriever=new StatusResponseRetriever();
  GetInfoCmd getInfoCmd=new GetInfoCmd(GetInfoCmd.CMD_USER_INFO,contactIdentifier);
  icqProvider.getAimConnection().getInfoService().getOscarConnection().sendSnacRequest(getInfoCmd,responseRetriever);
synchronized (responseRetriever) {
    try {
      responseRetriever.wait(10000);
    }
 catch (    InterruptedException ex) {
    }
  }
  if (responseRetriever.status == -1)   return IcqStatusEnum.OFFLINE;
  return icqStatusLongToPresenceStatus(responseRetriever.status);
}

Fixed version (ground truth):
/** 
 * Get the PresenceStatus for a particular contact. This method is not meant to be used by the user interface (which would simply register as a presence listener and always follow contact status) but rather by other plugins that may for some reason need to know the status of a particular contact. <p>
 * @param contactIdentifier the dientifier of the contact whose status we'reinterested in.
 * @return PresenceStatus the <tt>PresenceStatus</tt> of the specified<tt>contact</tt>
 * @throws java.lang.IllegalStateException if the provider is not signedon ICQ
 * @throws java.lang.IllegalArgumentException if <tt>contact</tt> is nota valid <tt>IcqContact</tt>
 */
public PresenceStatus queryContactStatus(String contactIdentifier) throws IllegalStateException, IllegalArgumentException {
  assertConnected();
  StatusResponseRetriever responseRetriever=new StatusResponseRetriever();
  GetInfoCmd getInfoCmd=new GetInfoCmd(GetInfoCmd.CMD_USER_INFO,contactIdentifier);
  icqProvider.getAimConnection().getInfoService().getOscarConnection().sendSnacRequest(getInfoCmd,responseRetriever);
synchronized (responseRetriever) {
    try {
      responseRetriever.wait(10000);
    }
 catch (    InterruptedException ex) {
    }
  }
  return icqStatusLongToPresenceStatus(responseRetriever.status);
}
Program: 104453
Project: 104453
Buggy source:
/** 
 * Returns a PresenceStatus instance representing the state this provider is currently in.
 * @return PresenceStatus
 */
public PresenceStatus getPresenceStatus(){
  return icqStatusLongToPresenceStatus(currentIcqStatus);
}

Fixed version (ground truth):
/** 
 * Returns a PresenceStatus instance representing the state this provider is currently in.
 * @return PresenceStatus
 */
public PresenceStatus getPresenceStatus(){
  if (currentIcqStatus == -1)   return IcqStatusEnum.OFFLINE;
  return icqStatusLongToPresenceStatus(currentIcqStatus);
}
Program: 104454
Project: 104454
Buggy source:
/** 
 * Get the PresenceStatus for a particular contact. This method is not meant to be used by the user interface (which would simply register as a presence listener and always follow contact status) but rather by other plugins that may for some reason need to know the status of a particular contact. <p>
 * @param contactIdentifier the dientifier of the contact whose status we'reinterested in.
 * @return PresenceStatus the <tt>PresenceStatus</tt> of the specified<tt>contact</tt>
 * @throws java.lang.IllegalStateException if the provider is not signedon ICQ
 * @throws java.lang.IllegalArgumentException if <tt>contact</tt> is nota valid <tt>IcqContact</tt>
 */
public PresenceStatus queryContactStatus(String contactIdentifier) throws IllegalStateException, IllegalArgumentException {
  assertConnected();
  StatusResponseRetriever responseRetriever=new StatusResponseRetriever();
  GetInfoCmd getInfoCmd=new GetInfoCmd(GetInfoCmd.CMD_USER_INFO,contactIdentifier);
  icqProvider.getAimConnection().getInfoService().getOscarConnection().sendSnacRequest(getInfoCmd,responseRetriever);
synchronized (responseRetriever) {
    try {
      responseRetriever.wait(10000);
    }
 catch (    InterruptedException ex) {
    }
  }
  return icqStatusLongToPresenceStatus(responseRetriever.status);
}

Fixed version (ground truth):
/** 
 * Get the PresenceStatus for a particular contact. This method is not meant to be used by the user interface (which would simply register as a presence listener and always follow contact status) but rather by other plugins that may for some reason need to know the status of a particular contact. <p>
 * @param contactIdentifier the dientifier of the contact whose status we'reinterested in.
 * @return PresenceStatus the <tt>PresenceStatus</tt> of the specified<tt>contact</tt>
 * @throws java.lang.IllegalStateException if the provider is not signedon ICQ
 * @throws java.lang.IllegalArgumentException if <tt>contact</tt> is nota valid <tt>IcqContact</tt>
 */
public PresenceStatus queryContactStatus(String contactIdentifier) throws IllegalStateException, IllegalArgumentException {
  assertConnected();
  StatusResponseRetriever responseRetriever=new StatusResponseRetriever();
  GetInfoCmd getInfoCmd=new GetInfoCmd(GetInfoCmd.CMD_USER_INFO,contactIdentifier);
  icqProvider.getAimConnection().getInfoService().getOscarConnection().sendSnacRequest(getInfoCmd,responseRetriever);
synchronized (responseRetriever) {
    try {
      responseRetriever.wait(10000);
    }
 catch (    InterruptedException ex) {
    }
  }
  if (responseRetriever.status == -1)   return IcqStatusEnum.OFFLINE;
  return icqStatusLongToPresenceStatus(responseRetriever.status);
}
Program: 104455
Project: 104455
Buggy source:
/** 
 * Saves the last status for all accounts. This information is used on loging. Each time user logs in he's logged with the same status as he was the last time before closing the application.
 */
public void saveStatusInformation(ProtocolProviderService protocolProvider,String statusName){
  ServiceReference configReference=SystrayActivator.bundleContext.getServiceReference(ConfigurationService.class.getName());
  ConfigurationService configService=(ConfigurationService)SystrayActivator.bundleContext.getService(configReference);
  if (configService != null) {
    String prefix="String_Node_Str";
    List accounts=configService.getPropertyNamesByPrefix(prefix,true);
    boolean savedAccount=false;
    Iterator accountsIter=accounts.iterator();
    while (accountsIter.hasNext()) {
      String accountRootPropName=(String)accountsIter.next();
      String accountUID=configService.getString(accountRootPropName);
      if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
        configService.setProperty(accountRootPropName + "String_Node_Str",statusName);
        savedAccount=true;
      }
    }
    if (!savedAccount) {
      String accNodeName="String_Node_Str" + Long.toString(System.currentTimeMillis());
      String accountPackage="String_Node_Str" + accNodeName;
      configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
      configService.setProperty(accountPackage + "String_Node_Str",statusName);
    }
  }
}

Fixed version (ground truth):
/** 
 * Saves the last status for all accounts. This information is used on loging. Each time user logs in he's logged with the same status as he was the last time before closing the application.
 */
public void saveStatusInformation(ProtocolProviderService protocolProvider,String statusName){
  ConfigurationService configService=SystrayActivator.getConfigurationService();
  if (configService != null) {
    String prefix="String_Node_Str";
    List accounts=configService.getPropertyNamesByPrefix(prefix,true);
    boolean savedAccount=false;
    Iterator accountsIter=accounts.iterator();
    while (accountsIter.hasNext()) {
      String accountRootPropName=(String)accountsIter.next();
      String accountUID=configService.getString(accountRootPropName);
      if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
        configService.setProperty(accountRootPropName + "String_Node_Str",statusName);
        savedAccount=true;
      }
    }
    if (!savedAccount) {
      String accNodeName="String_Node_Str" + Long.toString(System.currentTimeMillis());
      String accountPackage="String_Node_Str" + accNodeName;
      configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
      configService.setProperty(accountPackage + "String_Node_Str",statusName);
    }
  }
}
Program: 104456
Project: 104456
Buggy source:
/** 
 * Initializes the systray icon and related listeners.
 */
private void initSystray(){
  menu=new TrayMenu(uiService,this);
  String osName=System.getProperty("String_Node_Str");
  if (osName.startsWith("String_Node_Str")) {
    logoIcon=new ImageIcon(Resources.getImage("String_Node_Str"));
  }
 else {
    logoIcon=new ImageIcon(Resources.getImage("String_Node_Str"));
  }
  trayIcon=new TrayIcon(logoIcon,"String_Node_Str",menu);
  trayIcon.setIconAutoSize(true);
  trayIcon.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      if (uiService.isVisible()) {
        uiService.setVisible(false);
      }
 else {
        uiService.setVisible(true);
      }
    }
  }
);
  trayIcon.addBalloonActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      firePopupMessageEvent(e.getSource());
      ExportedWindow chatWindow=uiService.getExportedWindow(ExportedWindow.CHAT_WINDOW);
      if (chatWindow != null && chatWindow.isVisible()) {
        chatWindow.bringToFront();
      }
    }
  }
);
  systray.addTrayIcon(trayIcon);
}

Fixed version (ground truth):
/** 
 * Initializes the systray icon and related listeners.
 */
private void initSystray(){
  menu=new TrayMenu(uiService,this);
  String osName=System.getProperty("String_Node_Str");
  if (osName.startsWith("String_Node_Str")) {
    logoIcon=new ImageIcon(Resources.getImage("String_Node_Str"));
  }
 else {
    logoIcon=new ImageIcon(Resources.getImage("String_Node_Str"));
  }
  trayIcon=new TrayIcon(logoIcon,"String_Node_Str",menu);
  trayIcon.setIconAutoSize(true);
  trayIcon.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      boolean isVisible;
      isVisible=!uiService.isVisible();
      uiService.setVisible(isVisible);
      ConfigurationService configService=SystrayActivator.getConfigurationService();
      configService.setProperty("String_Node_Str",new Boolean(isVisible));
    }
  }
);
  trayIcon.addBalloonActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      firePopupMessageEvent(e.getSource());
      ExportedWindow chatWindow=uiService.getExportedWindow(ExportedWindow.CHAT_WINDOW);
      if (chatWindow != null && chatWindow.isVisible()) {
        chatWindow.bringToFront();
      }
    }
  }
);
  systray.addTrayIcon(trayIcon);
}
Program: 104458
Project: 104458
Buggy source:
/** 
 * Returns the last status that was stored in the configuration xml for the given protocol provider.
 * @param protocolProvider the protocol provider 
 * @return the last status that was stored in the configuration xml for thegiven protocol provider
 */
public PresenceStatus getLastPresenceStatus(ProtocolProviderService protocolProvider){
  String lastStatus=getLastStatusString(protocolProvider);
  OperationSetPresence presence=mainFrame.getProtocolPresence(protocolProvider);
  if (presence == null)   return null;
  Iterator i=presence.getSupportedStatusSet();
  if (lastStatus != null) {
    PresenceStatus status;
    while (i.hasNext()) {
      status=(PresenceStatus)i.next();
      if (status.getStatusName().equals(lastStatus)) {
        return status;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the last status that was stored in the configuration xml for the given protocol provider.
 * @param protocolProvider the protocol provider 
 * @return the last status that was stored in the configuration xml for thegiven protocol provider
 */
public PresenceStatus getLastPresenceStatus(ProtocolProviderService protocolProvider){
  String lastStatus=getLastStatusString(protocolProvider);
  OperationSetPresence presence=mainFrame.getProtocolPresenceOpSet(protocolProvider);
  if (presence == null)   return null;
  Iterator i=presence.getSupportedStatusSet();
  if (lastStatus != null) {
    PresenceStatus status;
    while (i.hasNext()) {
      status=(PresenceStatus)i.next();
      if (status.getStatusName().equals(lastStatus)) {
        return status;
      }
    }
  }
  return null;
}
Program: 104459
Project: 104459
Buggy source:
/** 
 * Creates the selector box, containing all protocol statuses, adds it to  the StatusPanel and refreshes the panel.
 * @param protocolProvider The protocol provider.
 */
public void addAccount(ProtocolProviderService protocolProvider){
  StatusSelectorBox protocolStatusCombo;
  int providerIndex=this.mainFrame.getProviderIndex(protocolProvider);
  if (mainFrame.getProtocolPresence(protocolProvider) != null) {
    protocolStatusCombo=new PresenceStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
 else {
    protocolStatusCombo=new SimpleStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
  protocolStatusCombo.addComponentListener(this);
  this.protocolStatusCombos.put(protocolProvider,protocolStatusCombo);
  if (protocolProvider.getProtocolName().equals("String_Node_Str"))   this.add(protocolStatusCombo,FlowLayout.LEFT);
 else   this.add(protocolStatusCombo);
  this.getParent().validate();
}

Fixed version (ground truth):
/** 
 * Creates the selector box, containing all protocol statuses, adds it to  the StatusPanel and refreshes the panel.
 * @param protocolProvider The protocol provider.
 */
public void addAccount(ProtocolProviderService protocolProvider){
  StatusSelectorBox protocolStatusCombo;
  int providerIndex=this.mainFrame.getProviderIndex(protocolProvider);
  if (mainFrame.getProtocolPresenceOpSet(protocolProvider) != null) {
    protocolStatusCombo=new PresenceStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
 else {
    protocolStatusCombo=new SimpleStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
  protocolStatusCombo.addComponentListener(this);
  this.protocolStatusCombos.put(protocolProvider,protocolStatusCombo);
  if (protocolProvider.getProtocolName().equals("String_Node_Str"))   this.add(protocolStatusCombo,FlowLayout.LEFT);
 else   this.add(protocolStatusCombo);
  this.getParent().validate();
}
Program: 104460
Project: 104460
Buggy source:
/** 
 * Opens a the specified chatPanel and brings it to the front if so specified.
 * @param chatPanel the chat panel that we will be opening
 * @param setSelected specifies whether we should bring the chat to frontafter creating it.
 */
public void openChat(ChatPanel chatPanel,boolean setSelected){
synchronized (syncChat) {
    ChatWindow chatWindow=chatPanel.getChatWindow();
    boolean isChatVisible=chatPanel.isWindowVisible();
    if (!isChatVisible)     chatWindow.addChat(chatPanel);
    if (chatWindow.isVisible()) {
      if ((ConfigurationManager.isAutoPopupNewMessage() && chatWindow.getExtendedState() != JFrame.ICONIFIED) || setSelected) {
        if (chatWindow.getState() == JFrame.ICONIFIED)         chatWindow.setExtendedState(JFrame.NORMAL);
        chatWindow.toFront();
        chatWindow.setCurrentChatPanel(chatPanel);
      }
 else {
        if (chatWindow.getState() == JFrame.ICONIFIED && !chatWindow.getTitle().startsWith("String_Node_Str")) {
          chatWindow.setTitle("String_Node_Str" + chatWindow.getTitle());
        }
      }
    }
 else {
      chatWindow.setVisible(true);
      chatWindow.setCurrentChatPanel(chatPanel);
    }
    chatPanel.setCaretToEnd();
    if (!chatWindow.getCurrentChatPanel().equals(chatPanel) && chatWindow.getChatTabCount() > 0) {
      chatPanel.getChatWindow().highlightTab(chatPanel);
    }
  }
}

Fixed version (ground truth):
/** 
 * Opens a the specified chatPanel and brings it to the front if so specified.
 * @param chatPanel the chat panel that we will be opening
 * @param setSelected specifies whether we should bring the chat to frontafter creating it.
 */
public void openChat(ChatPanel chatPanel,boolean setSelected){
synchronized (syncChat) {
    ChatWindow chatWindow=chatPanel.getChatWindow();
    boolean isChatVisible=chatPanel.isWindowVisible();
    if (!isChatVisible)     chatWindow.addChat(chatPanel);
    if (chatWindow.isVisible()) {
      if (chatWindow.getExtendedState() != JFrame.ICONIFIED) {
        if (ConfigurationManager.isAutoPopupNewMessage() || setSelected)         chatWindow.toFront();
      }
 else {
        if (setSelected) {
          chatWindow.setExtendedState(JFrame.NORMAL);
          chatWindow.toFront();
        }
        if (!chatWindow.getTitle().startsWith("String_Node_Str"))         chatWindow.setTitle("String_Node_Str" + chatWindow.getTitle());
      }
      if (setSelected) {
        chatWindow.setCurrentChatPanel(chatPanel);
      }
 else       if (!chatWindow.getCurrentChatPanel().equals(chatPanel) && chatWindow.getChatTabCount() > 0) {
        chatPanel.getChatWindow().highlightTab(chatPanel);
      }
    }
 else {
      chatWindow.setVisible(true);
      chatWindow.setCurrentChatPanel(chatPanel);
    }
    chatPanel.setCaretToEnd();
  }
}
Program: 104462
Project: 104462
Buggy source:
/** 
 * Creates a <tt>ChatPanel</tt> which is added to the given chat window.
 * @param chatWindow The parent window of this chat panel.
 * @param metaContact the meta contact that this chat is about.
 * @param protocolContact The subContact which is selected insthe chat.
 */
public ChatPanel(ChatWindow chatWindow,MetaContact metaContact,Contact protocolContact){
  super(new BorderLayout());
  this.chatWindow=chatWindow;
  this.metaContact=metaContact;
  this.imOperationSet=this.chatWindow.getMainFrame().getProtocolIM(protocolContact.getProtocolProvider());
  this.tnOperationSet=this.chatWindow.getMainFrame().getTypingNotifications(protocolContact.getProtocolProvider());
  this.conversationPanel=new ChatConversationPanel(this);
  this.chatConferencePanel=new ChatConferencePanel(this,metaContact,protocolContact);
  this.sendPanel=new ChatSendPanel(this,metaContact,protocolContact);
  this.writeMessagePanel=new ChatWritePanel(this);
  this.topSplitPane.setResizeWeight(1.0D);
  this.messagePane.setResizeWeight(1.0D);
  this.chatConferencePanel.setPreferredSize(new Dimension(120,100));
  this.chatConferencePanel.setMinimumSize(new Dimension(120,100));
  this.writeMessagePanel.setPreferredSize(new Dimension(500,100));
  this.writeMessagePanel.setMinimumSize(new Dimension(500,100));
  this.conversationPanel.setPreferredSize(new Dimension(400,200));
  this.init();
  addComponentListener(new TabSelectionComponentListener());
  new Thread(){
    public void run(){
      loadHistoryPeriod();
    }
  }
.start();
}

Fixed version (ground truth):
/** 
 * Creates a <tt>ChatPanel</tt> which is added to the given chat window.
 * @param chatWindow The parent window of this chat panel.
 * @param metaContact the meta contact that this chat is about.
 * @param protocolContact The subContact which is selected insthe chat.
 */
public ChatPanel(ChatWindow chatWindow,MetaContact metaContact,Contact protocolContact){
  super(new BorderLayout());
  this.chatWindow=chatWindow;
  this.metaContact=metaContact;
  this.conversationPanel=new ChatConversationPanel(this);
  this.chatConferencePanel=new ChatConferencePanel(this,metaContact,protocolContact);
  this.sendPanel=new ChatSendPanel(this,metaContact,protocolContact);
  this.writeMessagePanel=new ChatWritePanel(this);
  this.topSplitPane.setResizeWeight(1.0D);
  this.messagePane.setResizeWeight(1.0D);
  this.chatConferencePanel.setPreferredSize(new Dimension(120,100));
  this.chatConferencePanel.setMinimumSize(new Dimension(120,100));
  this.writeMessagePanel.setPreferredSize(new Dimension(500,100));
  this.writeMessagePanel.setMinimumSize(new Dimension(500,100));
  this.conversationPanel.setPreferredSize(new Dimension(400,200));
  this.init();
  addComponentListener(new TabSelectionComponentListener());
  new Thread(){
    public void run(){
      loadHistoryPeriod();
    }
  }
.start();
}
Program: 104463
Project: 104463
Buggy source:
/** 
 * Defines actions when send button is pressed.
 * @param e The <tt>ActionEvent</tt> object.
 */
public void actionPerformed(ActionEvent e){
  if (!this.chatPanel.isWriteAreaEmpty()) {
    OperationSetBasicInstantMessaging im=this.chatPanel.getImOperationSet();
    String body=chatPanel.getTextFromWriteArea();
    Message msg=im.createMessage(body);
    this.chatPanel.getChatWindow().getMainFrame().getWaitToBeDeliveredMsgs().put(msg.getMessageUID(),this.chatPanel);
    Contact contact=(Contact)contactSelectorBox.getMenu().getSelectedObject();
    if (chatPanel.getTnOperationSet() != null) {
      chatPanel.stopTypingNotifications();
    }
    try {
      im.sendInstantMessage(contact,msg);
    }
 catch (    IllegalStateException ex) {
      chatPanel.refreshWriteArea();
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent());
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str").getText());
    }
  }
  chatPanel.requestFocusInWriteArea();
}

Fixed version (ground truth):
/** 
 * Defines actions when send button is pressed.
 * @param e The <tt>ActionEvent</tt> object.
 */
public void actionPerformed(ActionEvent e){
  if (!this.chatPanel.isWriteAreaEmpty()) {
    Contact contact=(Contact)contactSelectorBox.getMenu().getSelectedObject();
    OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)contact.getProtocolProvider().getOperationSet(OperationSetBasicInstantMessaging.class);
    OperationSetTypingNotifications tn=(OperationSetTypingNotifications)contact.getProtocolProvider().getOperationSet(OperationSetTypingNotifications.class);
    String body=chatPanel.getTextFromWriteArea();
    Message msg=im.createMessage(body);
    this.chatPanel.getChatWindow().getMainFrame().getWaitToBeDeliveredMsgs().put(msg.getMessageUID(),this.chatPanel);
    if (tn != null) {
      chatPanel.stopTypingNotifications();
    }
    try {
      im.sendInstantMessage(contact,msg);
    }
 catch (    IllegalStateException ex) {
      logger.error("String_Node_Str",ex);
      chatPanel.refreshWriteArea();
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent());
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str").getText());
    }
catch (    Exception ex) {
      logger.error("String_Node_Str",ex);
      chatPanel.refreshWriteArea();
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.OUTGOING_MESSAGE,msg.getContent());
      chatPanel.processMessage(contact.getDisplayName(),new Date(System.currentTimeMillis()),Constants.ERROR_MESSAGE,Messages.getI18NString("String_Node_Str").getText());
    }
  }
  chatPanel.requestFocusInWriteArea();
}
Program: 104465
Project: 104465
Buggy source:
/** 
 * Creates a <tt>ChatPanel</tt> for the given contact and saves it in the list ot created <tt>ChatPanel</tt>s.
 * @param contact The MetaContact for this chat.
 * @param status The current status.
 * @param protocolContact The protocol contact.
 * @return The <code>ChatPanel</code> newly created.
 */
public ChatPanel createChat(MetaContact contact,Contact protocolContact){
synchronized (syncChat) {
    ChatWindow chatWindow;
    if (Constants.TABBED_CHAT_WINDOW && this.chatWindow != null)     chatWindow=this.chatWindow;
 else {
      chatWindow=new ChatWindow(mainFrame);
      this.chatWindow=chatWindow;
    }
    ChatPanel chatPanel=new ChatPanel(chatWindow,contact,protocolContact);
synchronized (chats) {
      this.chats.put(contact,chatPanel);
    }
    chatPanel.loadHistory();
    return chatPanel;
  }
}

Fixed version (ground truth):
/** 
 * Creates a <tt>ChatPanel</tt> for the given contact and saves it in the list ot created <tt>ChatPanel</tt>s.
 * @param contact The MetaContact for this chat.
 * @param protocolContact The protocol contact.
 * @param the message ID of the message that should be excluded from thehistory when the last one is loaded in the chat.
 * @return The <code>ChatPanel</code> newly created.
 */
public ChatPanel createChat(MetaContact contact,Contact protocolContact,String escapedMessageID){
synchronized (syncChat) {
    ChatWindow chatWindow;
    if (Constants.TABBED_CHAT_WINDOW && this.chatWindow != null)     chatWindow=this.chatWindow;
 else {
      chatWindow=new ChatWindow(mainFrame);
      this.chatWindow=chatWindow;
    }
    ChatPanel chatPanel=new ChatPanel(chatWindow,contact,protocolContact);
synchronized (chats) {
      this.chats.put(contact,chatPanel);
    }
    chatPanel.loadHistory(escapedMessageID);
    return chatPanel;
  }
}
Program: 104466
Project: 104466
Buggy source:
/** 
 * Returns the chat panel corresponding to the given meta contact.
 * @param metaContact the meta contact.
 * @return the chat panel corresponding to the given meta contact
 */
public ChatPanel getContactChat(MetaContact metaContact){
synchronized (chats) {
    return (ChatPanel)chats.get(metaContact);
  }
}

Fixed version (ground truth):
/** 
 * Returns the chat panel corresponding to the given meta contact
 * @param metaContact the meta contact.
 * @return the chat panel corresponding to the given meta contact
 */
public ChatPanel getContactChat(MetaContact metaContact){
synchronized (chats) {
    return (ChatPanel)chats.get(metaContact);
  }
}
Program: 104467
Project: 104467
Buggy source:
/** 
 * When a right button click is performed in the editor pane, a popup menu is opened.
 * @param e The MouseEvent.
 */
public void mouseClicked(MouseEvent e){
  Point p=e.getPoint();
  SwingUtilities.convertPointToScreen(p,e.getComponent());
  if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    openContextMenu(p);
  }
 else   if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
    GuiActivator.getBrowserLauncher().openURL(currentHref);
  }
}

Fixed version (ground truth):
/** 
 * When a right button click is performed in the editor pane, a popup menu is opened.
 * @param e The MouseEvent.
 */
public void mouseClicked(MouseEvent e){
  Point p=e.getPoint();
  SwingUtilities.convertPointToScreen(p,e.getComponent());
  if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    openContextMenu(p);
  }
 else   if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && currentHref != null && currentHref != "String_Node_Str") {
    GuiActivator.getBrowserLauncher().openURL(currentHref);
  }
}
Program: 104468
Project: 104468
Buggy source:
public void authorizationAccepted(Screenname screenname,String reason){
  logger.trace("String_Node_Str" + screenname);
  Contact srcContact=findContactByID(screenname.getFormatted());
  authorizationHandler.processAuthorizationResponse(new AuthorizationResponse(AuthorizationResponse.REJECT,reason),srcContact);
}

Fixed version (ground truth):
public void authorizationAccepted(Screenname screenname,String reason){
  logger.trace("String_Node_Str" + screenname);
  Contact srcContact=findContactByID(screenname.getFormatted());
  authorizationHandler.processAuthorizationResponse(new AuthorizationResponse(AuthorizationResponse.ACCEPT,reason),srcContact);
}
Program: 104469
Project: 104469
Buggy source:
/** 
 * Sets window size and position.
 */
private void setSizeAndLocation(){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String className=this.getClass().getName();
  String widthString=configService.getString(className + "String_Node_Str");
  String heightString=configService.getString(className + "String_Node_Str");
  String xString=configService.getString(className + "String_Node_Str");
  String yString=configService.getString(className + "String_Node_Str");
  int width=0;
  int height=0;
  if (widthString != null && heightString != null) {
    width=new Integer(width).intValue();
    height=new Integer(height).intValue();
    if (width > 0 && height > 0)     this.setSize(width,height);
  }
  if (xString != null && yString != null) {
    this.setLocation(new Integer(xString).intValue(),new Integer(yString).intValue());
  }
 else {
    this.setCenterLocation();
  }
}

Fixed version (ground truth):
/** 
 * Sets window size and position.
 */
private void setSizeAndLocation(){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String className=this.getClass().getName();
  String widthString=configService.getString(className + "String_Node_Str");
  String heightString=configService.getString(className + "String_Node_Str");
  String xString=configService.getString(className + "String_Node_Str");
  String yString=configService.getString(className + "String_Node_Str");
  int width=0;
  int height=0;
  if (widthString != null && heightString != null) {
    width=new Integer(widthString).intValue();
    height=new Integer(heightString).intValue();
    if (width > 0 && height > 0)     this.setSize(width,height);
  }
  if (xString != null && yString != null) {
    this.setLocation(new Integer(xString).intValue(),new Integer(yString).intValue());
  }
 else {
    this.setCenterLocation();
  }
}