nus-yam/ex-repair huggingface dataset:
Program: 104259
Project: 104259
Buggy source:
/** 
 * Method for setting the default secure status value for communication Also has the role to trigger going secure from not secure or viceversa Notifies any present CallSession of change in the status value for this purpose
 * @param activator setting for default communication securing
 * @param source the source of changing the secure status (local or remote)
 */
public void setSecureCommunicationStatus(boolean activator,OperationSetSecureTelephony.SecureStatusChangeSource source){
  logger.trace("String_Node_Str");
  usingSRTP=activator;
  if (source != OperationSetSecureTelephony.SecureStatusChangeSource.SECURE_STATUS_REVERTED) {
    SecureEvent secureEvent=null;
    if (activator) {
      secureEvent=new SecureEvent(this,SecureEvent.SECURE_COMMUNICATION,source);
    }
 else {
      secureEvent=new SecureEvent(this,SecureEvent.UNSECURE_COMMUNICATION,source);
    }
    if (selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER) {
      zrtpChangeStatus(this.audioRtpManager,secureEvent);
    }
  }
}

Fixed version (ground truth):
/** 
 * Method for setting the default secure status value for communication Also has the role to trigger going secure from not secure or viceversa Notifies any present CallSession of change in the status value for this purpose
 * @param activator setting for default communication securing
 * @param source the source of changing the secure status (local or remote)
 */
public void setSecureCommunicationStatus(boolean activator,OperationSetSecureTelephony.SecureStatusChangeSource source){
  logger.trace("String_Node_Str");
  usingZRTP=activator;
  if (source != OperationSetSecureTelephony.SecureStatusChangeSource.SECURE_STATUS_REVERTED) {
    SecureEvent secureEvent=null;
    if (activator) {
      secureEvent=new SecureEvent(this,SecureEvent.SECURE_COMMUNICATION,source);
    }
 else {
      secureEvent=new SecureEvent(this,SecureEvent.UNSECURE_COMMUNICATION,source);
    }
    if (selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER) {
      zrtpChangeStatus(this.audioRtpManager,secureEvent);
    }
  }
}
Program: 104260
Project: 104260
Buggy source:
public void run(){
  while (!stop) {
synchronized (sync) {
      while (!newTask && !stop) {
        try {
          sync.wait();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
    long endTime=System.currentTimeMillis() + nextDelay;
    long currentTime=System.currentTimeMillis();
synchronized (sync) {
      while ((currentTime <= endTime) && newTask && !stop) {
        try {
          sync.wait(endTime - currentTime);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        currentTime=System.currentTimeMillis();
      }
    }
    if (newTask && !stop) {
      newTask=false;
      executor.handleTimeout();
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!stop) {
synchronized (sync) {
      while (!newTask && !stop) {
        try {
          sync.wait();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
    long endTime=System.currentTimeMillis() + nextDelay;
    long currentTime=System.currentTimeMillis();
synchronized (sync) {
      while ((currentTime < endTime) && newTask && !stop) {
        try {
          sync.wait(endTime - currentTime);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        currentTime=System.currentTimeMillis();
      }
    }
    if (newTask && !stop) {
      newTask=false;
      executor.handleTimeout();
    }
  }
}
Program: 104261
Project: 104261
Buggy source:
protected void initClassDefaults(UIDefaults table){
  super.initClassDefaults(table);
  String lfPackageName="String_Node_Str";
  Object[] uiDefaults={"String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str"};
  table.putDefaults(uiDefaults);
}

Fixed version (ground truth):
protected void initClassDefaults(UIDefaults table){
  super.initClassDefaults(table);
  String lfPackageName="String_Node_Str";
  Object[] uiDefaults={"String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str","String_Node_Str",lfPackageName + "String_Node_Str"};
  table.putDefaults(uiDefaults);
}
Program: 104262
Project: 104262
Buggy source:
private void closeActionPerformed(){
  try {
    GuiActivator.bundleContext.getBundle(0).stop();
  }
 catch (  BundleException ex) {
    logger.error("String_Node_Str",ex);
    System.exit(0);
  }
  parentWindow.dispose();
}

Fixed version (ground truth):
void closeActionPerformed(){
  try {
    GuiActivator.bundleContext.getBundle(0).stop();
  }
 catch (  BundleException ex) {
    logger.error("String_Node_Str",ex);
    System.exit(0);
  }
  parentWindow.dispose();
}
Program: 104263
Project: 104263
Buggy source:
private boolean registerCloseMenuItemMacOSX(){
  return false;
}

Fixed version (ground truth):
private boolean registerCloseMenuItemMacOSX(){
  return registerMenuItemMacOSX("String_Node_Str",this);
}
Program: 104264
Project: 104264
Buggy source:
private void configActionPerformed(){
  ExportedWindow configDialog=GuiActivator.getUIService().getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW);
  configDialog.setVisible(true);
}

Fixed version (ground truth):
void configActionPerformed(){
  ExportedWindow configDialog=GuiActivator.getUIService().getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW);
  configDialog.setVisible(true);
}
Program: 104265
Project: 104265
Buggy source:
private boolean registerConfigMenuItemMacOSX(){
  return false;
}

Fixed version (ground truth):
private boolean registerConfigMenuItemMacOSX(){
  return FileMenu.registerMenuItemMacOSX("String_Node_Str",this);
}
Program: 104266
Project: 104266
Buggy source:
private boolean registerMenuEntryMacOSX(UIService uiService){
  return false;
}

Fixed version (ground truth):
private boolean registerMenuEntryMacOSX(UIService uiService){
  Exception exception=null;
  try {
    Class<?> clazz=Class.forName("String_Node_Str");
    Method method=clazz.getMethod("String_Node_Str",(Class<?>[])null);
    Object result=method.invoke(null,(Object[])null);
    if (result instanceof Boolean)     return ((Boolean)result).booleanValue();
  }
 catch (  ClassNotFoundException ex) {
    exception=ex;
  }
catch (  IllegalAccessException ex) {
    exception=ex;
  }
catch (  InvocationTargetException ex) {
    exception=ex;
  }
catch (  NoSuchMethodException ex) {
    exception=ex;
  }
  if (exception != null)   logger.error("String_Node_Str",exception);
  return false;
}
Program: 104267
Project: 104267
Buggy source:
private boolean registerCloseMenuItemMacOSX(){
  Application application=Application.getApplication();
  if (application != null) {
    application.addApplicationListener(new ApplicationAdapter(){
      public void handleQuit(      ApplicationEvent event){
        closeActionPerformed();
        event.setHandled(true);
      }
    }
);
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean registerCloseMenuItemMacOSX(){
  return false;
}
Program: 104268
Project: 104268
Buggy source:
private boolean registerConfigMenuItemMacOSX(){
  Application application=Application.getApplication();
  if (application != null) {
    application.addPreferencesMenuItem();
    if (application.isPreferencesMenuItemPresent()) {
      application.setEnabledPreferencesMenu(true);
      application.addApplicationListener(new ApplicationAdapter(){
        public void handlePreferences(        ApplicationEvent event){
          configActionPerformed();
          event.setHandled(true);
        }
      }
);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean registerConfigMenuItemMacOSX(){
  return false;
}
Program: 104269
Project: 104269
Buggy source:
private boolean registerMenuEntryMacOSX(UIService uiService){
  Application application=Application.getApplication();
  if (application != null) {
    application.addAboutMenuItem();
    if (application.isAboutMenuItemPresent()) {
      application.setEnabledAboutMenu(true);
      application.addApplicationListener(new ApplicationAdapter(){
        public void handleAbout(        ApplicationEvent event){
          AboutWindowPluginComponent.actionPerformed();
          event.setHandled(true);
        }
      }
);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean registerMenuEntryMacOSX(UIService uiService){
  return false;
}
Program: 104270
Project: 104270
Buggy source:
public void actionPerformed(ActionEvent evt){
  JButton button=(JButton)evt.getSource();
  String buttonName=button.getName();
  if (buttonName.equals(HANGUP_BUTTON)) {
    Call call=callPanel.getCall();
    CallManager.hangupCall(call);
    this.dispose();
  }
 else   if (buttonName.equals(DIAL_BUTTON)) {
    if (dialpadDialog == null) {
      Call call=callPanel.getCall();
      Iterator<CallParticipant> callParticipants=(call == null) ? new Vector<CallParticipant>().iterator() : callPanel.getCall().getCallParticipants();
      dialpadDialog=new DialpadDialog(callParticipants);
    }
    if (!dialpadDialog.isVisible()) {
      dialpadDialog.setSize(this.getWidth() - 20,dialpadDialog.getHeight());
      dialpadDialog.setLocation(this.getX() + 10,getLocationOnScreen().y + getHeight());
      dialpadDialog.setVisible(true);
      dialpadDialog.requestFocus();
    }
 else {
      dialpadDialog.setVisible(false);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent evt){
  JButton button=(JButton)evt.getSource();
  String buttonName=button.getName();
  if (buttonName.equals(HANGUP_BUTTON)) {
    actionPerformedOnHangupButton();
  }
 else   if (buttonName.equals(DIAL_BUTTON)) {
    if (dialpadDialog == null) {
      Call call=callPanel.getCall();
      Iterator<CallParticipant> callParticipants=(call == null) ? new Vector<CallParticipant>().iterator() : callPanel.getCall().getCallParticipants();
      dialpadDialog=new DialpadDialog(callParticipants);
    }
    if (!dialpadDialog.isVisible()) {
      dialpadDialog.setSize(this.getWidth() - 20,dialpadDialog.getHeight());
      dialpadDialog.setLocation(this.getX() + 10,getLocationOnScreen().y + getHeight());
      dialpadDialog.setVisible(true);
      dialpadDialog.requestFocus();
    }
 else {
      dialpadDialog.setVisible(false);
    }
  }
}
Program: 104271
Project: 104271
Buggy source:
/** 
 * Returns the <tt>Call</tt> corresponding to this CallDialog.
 * @return the <tt>Call</tt> corresponding to this CallDialog.
 */
public Call getCall(){
  if (callPanel != null) {
    return callPanel.getCall();
  }
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>Call</tt> corresponding to this CallDialog.
 * @return the <tt>Call</tt> corresponding to this CallDialog.
 */
public Call getCall(){
  return (callPanel != null) ? callPanel.getCall() : null;
}
Program: 104272
Project: 104272
Buggy source:
@Override protected void close(boolean isEscaped){
}

Fixed version (ground truth):
@Override protected void close(boolean isEscaped){
  if (!isEscaped) {
    actionPerformedOnHangupButton();
  }
}
Program: 104273
Project: 104273
Buggy source:
/** 
 * Initializes all components in this panel.
 */
private void initComponents(){
  JPanel mainPanel=new JPanel(new BorderLayout());
  JLabel callLabel=new JLabel();
  JPanel buttonsPanel=new JPanel(new FlowLayout(FlowLayout.CENTER));
  SIPCommButton callButton=new SIPCommButton(ImageLoader.getImage(ImageLoader.CALL_BUTTON_BG));
  SIPCommButton hangupButton=new SIPCommButton(ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG));
  mainPanel.setPreferredSize(new Dimension(400,90));
  mainPanel.setOpaque(false);
  mainPanel.setBorder(BorderFactory.createCompoundBorder(SIPCommBorders.getRoundBorder(),BorderFactory.createEmptyBorder(20,20,20,20)));
  callButton.setName(CALL_BUTTON);
  hangupButton.setName(HANGUP_BUTTON);
  callButton.addActionListener(this);
  hangupButton.addActionListener(this);
  this.initCallLabel(callLabel);
  this.getContentPane().add(mainPanel);
  mainPanel.add(callLabel,BorderLayout.CENTER);
  mainPanel.add(buttonsPanel,BorderLayout.EAST);
  buttonsPanel.add(callButton);
  buttonsPanel.add(hangupButton);
}

Fixed version (ground truth):
/** 
 * Initializes all components in this panel.
 */
private void initComponents(){
  JPanel mainPanel=new JPanel(new GridBagLayout());
  JLabel callLabel=new JLabel();
  JPanel buttonsPanel=new TransparentPanel(new GridBagLayout());
  SIPCommButton callButton=new SIPCommButton(ImageLoader.getImage(ImageLoader.CALL_BUTTON_BG));
  SIPCommButton hangupButton=new SIPCommButton(ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG));
  mainPanel.setPreferredSize(new Dimension(400,90));
  mainPanel.setOpaque(false);
  mainPanel.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
  callButton.setName(CALL_BUTTON);
  hangupButton.setName(HANGUP_BUTTON);
  callButton.addActionListener(this);
  hangupButton.addActionListener(this);
  this.initCallLabel(callLabel);
  this.getContentPane().add(mainPanel);
  GridBagConstraints mainConstraints=new GridBagConstraints();
  mainConstraints.anchor=GridBagConstraints.WEST;
  mainConstraints.gridx=0;
  mainConstraints.gridy=0;
  mainConstraints.weightx=1;
  mainPanel.add(callLabel,mainConstraints);
  mainConstraints.anchor=GridBagConstraints.CENTER;
  mainConstraints.gridx=1;
  mainConstraints.weightx=0;
  mainPanel.add(Box.createHorizontalStrut(HGAP),mainConstraints);
  mainConstraints.anchor=GridBagConstraints.CENTER;
  mainConstraints.gridx=2;
  mainConstraints.weightx=0;
  mainPanel.add(buttonsPanel,mainConstraints);
  GridBagConstraints buttonConstraints=new GridBagConstraints();
  buttonConstraints.gridx=0;
  buttonConstraints.gridy=0;
  buttonsPanel.add(callButton,buttonConstraints);
  buttonConstraints.gridx=1;
  buttonsPanel.add(Box.createHorizontalStrut(HGAP));
  buttonConstraints.gridx=2;
  buttonsPanel.add(hangupButton,buttonConstraints);
}
Program: 104275
Project: 104275
Buggy source:
public void componentRemoved(ContainerEvent event){
  Component child=event.getChild();
  child.removeMouseMotionListener(this);
  child.removeKeyListener(this);
}

Fixed version (ground truth):
public void componentRemoved(ContainerEvent event){
  Component child=event.getChild();
  child.removeKeyListener(this);
}
Program: 104276
Project: 104276
Buggy source:
public void componentAdded(ContainerEvent event){
  Component child=event.getChild();
  child.addKeyListener(this);
  child.addMouseMotionListener(this);
}

Fixed version (ground truth):
public void componentAdded(ContainerEvent event){
  Component child=event.getChild();
  child.addKeyListener(this);
}
Program: 104277
Project: 104277
Buggy source:
/** 
 * Paint a round background for all selected cells.
 */
public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2=(Graphics2D)g;
  AntialiasingManager.activateAntialiasing(g2);
  if (this.isSelected) {
    g2.setColor(Constants.SELECTED_COLOR);
    g2.fillRoundRect(0,0,this.getWidth(),this.getHeight(),7,7);
    g2.setColor(Constants.LIST_SELECTION_BORDER_COLOR);
    g2.setStroke(new BasicStroke(1.5f));
    g2.drawRoundRect(0,0,this.getWidth() - 1,this.getHeight() - 1,7,7);
  }
}

Fixed version (ground truth):
/** 
 * Paint a round background for all selected cells.
 */
public void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    if (this.isSelected) {
      Graphics2D g2=(Graphics2D)g;
      int width=getWidth();
      int height=getHeight();
      g2.setColor(Constants.SELECTED_COLOR);
      g2.fillRoundRect(0,0,width,height,7,7);
      g2.setColor(Constants.LIST_SELECTION_BORDER_COLOR);
      g2.setStroke(new BasicStroke(1.5f));
      g2.drawRoundRect(0,0,width - 1,height - 1,7,7);
    }
  }
  finally {
    g.dispose();
  }
}
Program: 104278
Project: 104278
Buggy source:
public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2=(Graphics2D)g;
  AntialiasingManager.activateAntialiasing(g2);
  g2.setColor(Color.WHITE);
  g2.fillRoundRect(0,0,this.getWidth() - 1,this.getHeight() - 1,15,15);
  g2.setColor(Color.GRAY);
  g2.drawRoundRect(0,0,this.getWidth() - 1,this.getHeight() - 1,15,15);
  if (isWindowImageBgEnabled && bgImage != null) {
    if (isTextureBackground) {
      g2.setPaint(texture);
      g2.fillRect(0,0,this.getWidth(),this.getHeight());
    }
 else {
      g.setColor(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
      g.fillRect(0,0,getWidth(),getHeight());
      g2.drawImage(bgImage,this.getWidth() - bgImage.getWidth(),this.getHeight() - bgImage.getHeight(),this);
    }
  }
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    Graphics2D g2=(Graphics2D)g;
    int width=getWidth();
    int height=getHeight();
    g2.setColor(Color.WHITE);
    g2.fillRoundRect(0,0,width - 1,height - 1,15,15);
    g2.setColor(Color.GRAY);
    g2.drawRoundRect(0,0,width - 1,height - 1,15,15);
    if (isWindowImageBgEnabled && bgImage != null) {
      if (isTextureBackground) {
        g2.setPaint(texture);
        g2.fillRect(0,0,width,height);
      }
 else {
        g.setColor(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
        g.fillRect(0,0,width,height);
        g2.drawImage(bgImage,width - bgImage.getWidth(),height - bgImage.getHeight(),this);
      }
    }
  }
  finally {
    g.dispose();
  }
}
Program: 104279
Project: 104279
Buggy source:
/** 
 * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button background and icon, and all additional effects of this configururable button.
 * @param g The Graphics object.
 */
public void paintComponent(Graphics g){
  AntialiasingManager.activateAntialiasing(g);
  if (isOpaque()) {
    g.setColor(getBackground());
    g.fillRect(0,0,getWidth(),getHeight());
  }
  if (this.bgImage != null) {
    Image paintBgImage;
    if (this.iconImage == null && !isEnabled()) {
      paintBgImage=new ImageIcon(LightGrayFilter.createDisabledImage(bgImage)).getImage();
    }
 else     paintBgImage=bgImage;
    g.drawImage(paintBgImage,this.getWidth() / 2 - this.bgImage.getWidth(null) / 2,this.getHeight() / 2 - this.bgImage.getHeight(null) / 2,this);
  }
  if (this.iconImage != null) {
    Image paintIconImage;
    if (!isEnabled()) {
      paintIconImage=new ImageIcon(LightGrayFilter.createDisabledImage(iconImage)).getImage();
    }
 else     paintIconImage=iconImage;
    g.drawImage(paintIconImage,this.getWidth() / 2 - this.iconImage.getWidth(null) / 2,this.getHeight() / 2 - this.iconImage.getHeight(null) / 2,this);
  }
  FadeTracker fadeTracker=FadeTracker.getInstance();
  float visibility=this.getModel().isRollover() ? 1.0f : 0.0f;
  if (fadeTracker.isTracked(this,FadeKind.ROLLOVER)) {
    visibility=fadeTracker.getFade(this,FadeKind.ROLLOVER);
  }
  g.setColor(new Color(1.0f,1.0f,1.0f,visibility / 2));
  if (this.bgImage != null) {
    g.fillRoundRect(this.getWidth() / 2 - this.bgImage.getWidth(null) / 2,this.getHeight() / 2 - this.bgImage.getHeight(null) / 2,bgImage.getWidth(null),bgImage.getHeight(null),10,10);
  }
 else {
    g.fillRoundRect(0,0,this.getWidth(),this.getHeight(),10,10);
  }
  if (this.getModel().isPressed()) {
    if (this.pressedImage != null) {
      g.drawImage(this.pressedImage,0,0,this);
    }
 else     if (this.iconImage != null) {
      g.drawImage(this.iconImage,this.getWidth() / 2 - this.iconImage.getWidth(null) / 2 + 1,this.getHeight() / 2 - this.iconImage.getHeight(null) / 2 + 1,this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button background and icon, and all additional effects of this configurable button.
 * @param g The Graphics object.
 */
protected void paintComponent(Graphics g){
  g=g.create();
  try {
    internalPaintComponent(g);
  }
  finally {
    g.dispose();
  }
}
Program: 104280
Project: 104280
Buggy source:
public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (!isColorBgEnabled)   return;
  Graphics2D g2=(Graphics2D)g;
  AntialiasingManager.activateAntialiasing(g2);
  GradientPaint bgGradientColor=new GradientPaint(this.getWidth() / 2,0,bgStartColor,this.getWidth() / 2,80,bgEndColor);
  g2.setPaint(bgGradientColor);
  g2.fillRect(0,0,this.getWidth(),80);
  g2.setColor(bgEndColor);
  g2.fillRect(0,78,this.getWidth(),this.getHeight());
  GradientPaint curveShadow=new GradientPaint(0,0,new Color(255,255,255,150),this.getWidth(),this.getHeight(),new Color(255,255,255,50));
  g2.setPaint(curveShadow);
  g2.setStroke(new BasicStroke(1f));
  CubicCurve2D curve1=new CubicCurve2D.Float(50,-1,250,30,50,150,0,300);
  g2.draw(curve1);
  CubicCurve2D curve2=new CubicCurve2D.Float(this.getWidth() - 20,0,this.getWidth(),100,this.getWidth() / 2,100,0,150);
  g2.draw(curve2);
  CubicCurve2D curve3=new CubicCurve2D.Float(0,90,this.getWidth() / 3,60,2 * this.getWidth() / 3,60,this.getWidth(),90);
  g2.draw(curve3);
}

Fixed version (ground truth):
protected void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    internalPaintComponent(g);
  }
  finally {
    g.dispose();
  }
}
Program: 104281
Project: 104281
Buggy source:
public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (!isColorBgEnabled)   return;
  Graphics2D g2=(Graphics2D)g;
  AntialiasingManager.activateAntialiasing(g2);
  GradientPaint bgGradientColor=new GradientPaint(this.getWidth() / 2,0,bgStartColor,this.getWidth() / 2,80,bgEndColor);
  g2.setPaint(bgGradientColor);
  g2.fillRect(0,0,this.getWidth(),80);
  g2.setColor(bgEndColor);
  g2.fillRect(0,78,this.getWidth(),this.getHeight());
  GradientPaint curveShadow=new GradientPaint(0,0,new Color(255,255,255,150),this.getWidth(),this.getHeight(),new Color(255,255,255,50));
  g2.setPaint(curveShadow);
  g2.setStroke(new BasicStroke(1f));
  CubicCurve2D curve1=new CubicCurve2D.Float(50,-1,250,30,50,150,0,300);
  g2.draw(curve1);
  CubicCurve2D curve2=new CubicCurve2D.Float(this.getWidth() - 20,0,this.getWidth(),100,this.getWidth() / 2,100,0,150);
  g2.draw(curve2);
  CubicCurve2D curve3=new CubicCurve2D.Float(0,90,this.getWidth() / 3,60,2 * this.getWidth() / 3,60,this.getWidth(),90);
  g2.draw(curve3);
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    internalPaintComponent(g);
  }
  finally {
    g.dispose();
  }
}
Program: 104282
Project: 104282
Buggy source:
/** 
 * Overwrites the <tt>paintComponent(Graphics g)</tt> method in order to provide a new look and the mouse moves over this component.
 */
public void paintComponent(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  AntialiasingManager.activateAntialiasing(g2);
  super.paintComponent(g2);
}

Fixed version (ground truth):
/** 
 * Overwrites the <tt>paintComponent(Graphics g)</tt> method in order to provide a new look and the mouse moves over this component.
 */
public void paintComponent(Graphics g){
  super.paintComponent(g);
}
Program: 104283
Project: 104283
Buggy source:
/** 
 * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button background and icon, and all additional effects of this configururable button.
 * @param g The Graphics object.
 */
public void paintComponent(Graphics g){
  AntialiasingManager.activateAntialiasing(g);
  if (this.bgImage != null) {
    if (this.iconImage == null && !isEnabled()) {
      Image disabledImage=new ImageIcon(LightGrayFilter.createDisabledImage(bgImage)).getImage();
      g.drawImage(disabledImage,0,0,this);
    }
 else {
      g.drawImage(this.bgImage,0,0,this);
    }
  }
  if (this.getModel().isRollover() && this.bgRolloverImage != null) {
    g.drawImage(this.bgRolloverImage,0,0,this);
  }
  if (this.getModel().isSelected() && this.pressedImage != null) {
    g.drawImage(this.pressedImage,0,0,this);
  }
  if (this.iconImage != null) {
    if (!isEnabled()) {
      Image disabledImage=new ImageIcon(LightGrayFilter.createDisabledImage(iconImage)).getImage();
      g.drawImage(disabledImage,(this.bgImage.getWidth(null) - disabledImage.getWidth(null)) / 2,(this.bgImage.getHeight(null) - disabledImage.getHeight(null)) / 2,this);
    }
 else {
      g.drawImage(this.iconImage,(this.bgImage.getWidth(null) - this.iconImage.getWidth(null)) / 2,(this.bgImage.getHeight(null) - this.iconImage.getHeight(null)) / 2,this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button background and icon, and all additional effects of this configururable button.
 * @param g The Graphics object.
 */
public void paintComponent(Graphics g){
  g=g.create();
  try {
    internalPaintComponent(g);
  }
  finally {
    g.dispose();
  }
}
Program: 104284
Project: 104284
Buggy source:
/** 
 * Overrides the <code>paintComponent</code> method in <tt>JComponent</tt> to paint the screen capture image as a background of this component.
 */
protected void paintComponent(Graphics g){
  AntialiasingManager.activateAntialiasing(g);
  Graphics2D g2=(Graphics2D)g;
  g2.drawImage(this.background,0,0,null);
  g2.setColor(new Color(255,255,255,180));
  g2.fillRoundRect(0,0,getWidth(),getHeight(),10,10);
  g2.setColor(Constants.BORDER_COLOR);
  g2.drawRoundRect(0,0,getWidth() - 1,getHeight() - 1,10,10);
}

Fixed version (ground truth):
/** 
 * Overrides the <code>paintComponent</code> method in <tt>JComponent</tt> to paint the screen capture image as a background of this component.
 */
protected void paintComponent(Graphics g){
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    Graphics2D g2=(Graphics2D)g;
    int width=getWidth();
    int height=getHeight();
    g2.drawImage(this.background,0,0,null);
    g2.setColor(new Color(255,255,255,180));
    g2.fillRoundRect(0,0,width,height,10,10);
    g2.setColor(Constants.BORDER_COLOR);
    g2.drawRoundRect(0,0,width - 1,height - 1,10,10);
  }
  finally {
    g.dispose();
  }
}
Program: 104288
Project: 104288
Buggy source:
/** 
 * Returns a string that could be directly used (or easily converted to) an address that other users of the procotol can use to communicate with us. By default this string is set to userid@servicename. Protocol implementors should override it if they'd need it to respect a different syntax.
 * @return a String in the form of userid@service that other protocol usersshould be able to parse into a meaningful address and use it to communicate with us.
 */
public String getAccountAddress(){
  return "String_Node_Str" + getUserID() + "String_Node_Str"+ getService();
}

Fixed version (ground truth):
/** 
 * Returns a string that could be directly used (or easily converted to) an address that other users of the procotol can use to communicate with us. By default this string is set to userid@servicename. Protocol implementors should override it if they'd need it to respect a different syntax.
 * @return a String in the form of userid@service that other protocol usersshould be able to parse into a meaningful address and use it to communicate with us.
 */
public String getAccountAddress(){
  StringBuffer accountAddress=new StringBuffer();
  accountAddress.append("String_Node_Str");
  accountAddress.append(getUserID());
  String service=getService();
  if (service != null) {
    accountAddress.append('@');
    accountAddress.append(service);
  }
  return accountAddress.toString();
}
Program: 104289
Project: 104289
Buggy source:
/** 
 * Creates a SIP account id from the specified ide and account properties.
 * @param userID the user id part of the SIP uri identifying this contact.
 * @param accountProperties any other properties necessary for the account.
 * @param serverName the name of the server that the user belongs to.
 */
protected SipAccountID(String userID,Map accountProperties,String serverName){
  super((userID.indexOf("String_Node_Str") > -1) ? userID.substring(0,userID.indexOf("String_Node_Str")) : userID,accountProperties,(String)accountProperties.get(ProtocolProviderFactory.PROTOCOL),serverName);
}

Fixed version (ground truth):
/** 
 * Creates a SIP account id from the specified ide and account properties.
 * @param userID the user id part of the SIP uri identifying this contact.
 * @param accountProperties any other properties necessary for the account.
 * @param serverName the name of the server that the user belongs to.
 */
protected SipAccountID(String userID,Map accountProperties,String serverName){
  super(getUserIDWithoutServerName(userID),accountProperties,(String)accountProperties.get(ProtocolProviderFactory.PROTOCOL),serverName);
}
Program: 104292
Project: 104292
Buggy source:
/** 
 * Called when this bundle is started.
 * @param bundleContext The execution context of the bundle being started.
 */
public void start(BundleContext bundleContext) throws Exception {
  isStarted=true;
  GuiActivator.bundleContext=bundleContext;
  NotificationManager.registerGuiNotifications();
  notificationServiceListener=new NotificationServiceListener();
  bundleContext.addServiceListener(notificationServiceListener);
  ConfigurationManager.loadGuiConfigurations();
  try {
    this.uiService=new UIServiceImpl();
    logger.info("String_Node_Str");
    bundleContext.registerService(UIService.class.getName(),this.uiService,null);
    logger.info("String_Node_Str");
    uiService.loadApplicationGui();
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
  GuiActivator.getConfigurationService().addPropertyChangeListener(uiService);
  bundleContext.addServiceListener(uiService);
}

Fixed version (ground truth):
/** 
 * Called when this bundle is started.
 * @param bundleContext The execution context of the bundle being started.
 */
public void start(BundleContext bundleContext) throws Exception {
  isStarted=true;
  GuiActivator.bundleContext=bundleContext;
  NotificationManager.registerGuiNotifications();
  notificationServiceListener=new NotificationServiceListener();
  bundleContext.addServiceListener(notificationServiceListener);
  ConfigurationManager.loadGuiConfigurations();
  try {
    uiService=new UIServiceImpl();
    logger.info("String_Node_Str");
    bundleContext.registerService(UIService.class.getName(),uiService,null);
    logger.info("String_Node_Str");
    uiService.loadApplicationGui();
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
  GuiActivator.getConfigurationService().addPropertyChangeListener(uiService);
  bundleContext.addServiceListener(uiService);
}
Program: 104293
Project: 104293
Buggy source:
/** 
 * Returns all <tt>ProtocolProviderFactory</tt>s obtained from the bundle context.
 * @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundlecontext
 */
public static Map getProtocolProviderFactories(){
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderFactory.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  for (int i=0; i < serRefs.length; i++) {
    ProtocolProviderFactory providerFactory=(ProtocolProviderFactory)bundleContext.getService(serRefs[i]);
    providerFactoriesMap.put(serRefs[i].getProperty(ProtocolProviderFactory.PROTOCOL),providerFactory);
  }
  return providerFactoriesMap;
}

Fixed version (ground truth):
/** 
 * Returns all <tt>ProtocolProviderFactory</tt>s obtained from the bundle context.
 * @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundlecontext
 */
public static Map<Object,ProtocolProviderFactory> getProtocolProviderFactories(){
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderFactory.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  for (int i=0; i < serRefs.length; i++) {
    ProtocolProviderFactory providerFactory=(ProtocolProviderFactory)bundleContext.getService(serRefs[i]);
    providerFactoriesMap.put(serRefs[i].getProperty(ProtocolProviderFactory.PROTOCOL),providerFactory);
  }
  return providerFactoriesMap;
}
Program: 104294
Project: 104294
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)) {
    if (doNotAskAgain.isSelected()) {
      this.returnCode=OK_DONT_ASK_CODE;
    }
 else {
      this.returnCode=OK_RETURN_CODE;
    }
  }
 else {
    this.returnCode=CANCEL_RETURN_CODE;
  }
synchronized (lock) {
    lock.notify();
  }
  this.dispose();
}

Fixed version (ground truth):
/** 
 * 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)) {
    if (doNotAskAgain.isSelected()) {
      this.returnCode=OK_DONT_ASK_CODE;
    }
 else {
      this.returnCode=OK_RETURN_CODE;
    }
  }
 else {
    this.returnCode=CANCEL_RETURN_CODE;
  }
  this.dispose();
}
Program: 104295
Project: 104295
Buggy source:
/** 
 * Shows the dialog.
 * @return The return code that should indicate what was the choice ofthe user. If the user chooses cancel, the return code is the  CANCEL_RETURN_CODE.
 */
public int showDialog(){
  this.pack();
  this.setVisible(true);
synchronized (lock) {
    try {
      lock.wait();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  return returnCode;
}

Fixed version (ground truth):
/** 
 * Shows the dialog.
 * @return The return code that should indicate what was the choice ofthe user. If the user chooses cancel, the return code is the  CANCEL_RETURN_CODE.
 */
public int showDialog(){
  if (!SwingUtilities.isEventDispatchThread()) {
    final int[] returnCodes=new int[1];
    Exception exception=null;
    try {
      SwingUtilities.invokeAndWait(new Runnable(){
        public void run(){
          returnCodes[0]=showDialog();
        }
      }
);
    }
 catch (    InterruptedException ex) {
      exception=ex;
    }
catch (    InvocationTargetException ex) {
      exception=ex;
    }
    if (exception != null)     throw new UndeclaredThrowableException(exception);
    return returnCodes[0];
  }
  pack();
  setModal(true);
  setVisible(true);
  return returnCode;
}
Program: 104296
Project: 104296
Buggy source:
/** 
 * Removes the associated with this <tt>PluginComponentEvent</tt> component from this container.
 */
public void pluginComponentRemoved(PluginComponentEvent event){
  final PluginComponent pluginComponent=event.getPluginComponent();
  Container containerID=pluginComponent.getContainer();
  if (containerID.equals(Container.CONTAINER_MAIN_WINDOW)) {
    Object constraints=UIServiceImpl.getBorderLayoutConstraintsFromContainer(pluginComponent.getConstraints());
    if (constraints == null)     constraints=BorderLayout.SOUTH;
    if (pluginComponent.isNativeComponent()) {
      if (nativePluginsTable.containsKey(pluginComponent)) {
        final Component c=(Component)nativePluginsTable.get(pluginComponent);
        final Object finalConstraints=constraints;
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            removePluginComponent(c,pluginComponent.getContainer(),finalConstraints);
            getContentPane().repaint();
          }
        }
);
      }
    }
 else {
      this.removePluginComponent((Component)pluginComponent.getComponent(),pluginComponent.getContainer(),constraints);
    }
    nativePluginsTable.remove(pluginComponent);
  }
}

Fixed version (ground truth):
/** 
 * Removes the associated with this <tt>PluginComponentEvent</tt> component from this container.
 */
public void pluginComponentRemoved(PluginComponentEvent event){
  final PluginComponent pluginComponent=event.getPluginComponent();
  Container containerID=pluginComponent.getContainer();
  if (containerID.equals(Container.CONTAINER_MAIN_WINDOW)) {
    Object constraints=UIServiceImpl.getBorderLayoutConstraintsFromContainer(pluginComponent.getConstraints());
    if (constraints == null)     constraints=BorderLayout.SOUTH;
    if (pluginComponent.isNativeComponent()) {
      if (nativePluginsTable.containsKey(pluginComponent)) {
        final Component c=nativePluginsTable.get(pluginComponent);
        final Object finalConstraints=constraints;
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            removePluginComponent(c,pluginComponent.getContainer(),finalConstraints);
            getContentPane().repaint();
          }
        }
);
      }
    }
 else {
      this.removePluginComponent((Component)pluginComponent.getComponent(),pluginComponent.getContainer(),constraints);
    }
    nativePluginsTable.remove(pluginComponent);
  }
}
Program: 104297
Project: 104297
Buggy source:
/** 
 * Removes all native plugins from this container.
 */
private void removeNativePlugins(){
  Iterator pluginIterator=nativePluginsTable.entrySet().iterator();
  Object constraints;
  while (pluginIterator.hasNext()) {
    Map.Entry<PluginComponent,Component> entry=(Map.Entry<PluginComponent,Component>)pluginIterator.next();
    PluginComponent pluginComponent=(PluginComponent)entry.getKey();
    Component c=(Component)entry.getValue();
    constraints=UIServiceImpl.getBorderLayoutConstraintsFromContainer(pluginComponent.getConstraints());
    if (constraints == null)     constraints=BorderLayout.SOUTH;
    this.removePluginComponent(c,pluginComponent.getContainer(),constraints);
    this.getContentPane().repaint();
  }
}

Fixed version (ground truth):
/** 
 * Removes all native plugins from this container.
 */
private void removeNativePlugins(){
  Object constraints;
  for (  Map.Entry<PluginComponent,Component> entry : nativePluginsTable.entrySet()) {
    PluginComponent pluginComponent=entry.getKey();
    Component c=entry.getValue();
    constraints=UIServiceImpl.getBorderLayoutConstraintsFromContainer(pluginComponent.getConstraints());
    if (constraints == null)     constraints=BorderLayout.SOUTH;
    this.removePluginComponent(c,pluginComponent.getContainer(),constraints);
    this.getContentPane().repaint();
  }
}
Program: 104298
Project: 104298
Buggy source:
public void run(){
  if (isVisible) {
    MainFrame.this.addNativePlugins();
    MainFrame.super.setVisible(isVisible);
    MainFrame.super.setExtendedState(MainFrame.NORMAL);
    MainFrame.super.toFront();
  }
 else {
    MainFrame.super.setVisible(isVisible);
  }
}

Fixed version (ground truth):
public void run(){
  if (ConfigurationManager.isQuitWarningShown()) {
    MessageDialog dialog=new MessageDialog(null,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str").getText(),false);
    if (dialog.showDialog() == MessageDialog.OK_DONT_ASK_CODE)     ConfigurationManager.setQuitWarningShown(false);
  }
}
Program: 104299
Project: 104299
Buggy source:
/** 
 * Creates an instance of <tt>MainFrame</tt>.
 */
public MainFrame(){
  if (!ConfigurationManager.isWindowDecorated()) {
    this.setUndecorated(true);
  }
  this.mainCallPanel=new MainCallPanel(this);
  this.contactListPanel=new ContactListPane(this);
  this.accountStatusPanel=new AccountStatusPanel(this);
  menu=new MainMenu(this);
  this.addWindowListener(new MainFrameWindowAdapter());
  this.initTitleFont();
  String applicationName=GuiActivator.getResources().getSettingsString("String_Node_Str");
  this.setTitle(applicationName);
  this.mainPanel.setBackground(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
  this.init();
  this.initPluginComponents();
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>MainFrame</tt>.
 */
public MainFrame(){
  if (!ConfigurationManager.isWindowDecorated()) {
    this.setUndecorated(true);
  }
  this.mainCallPanel=new MainCallPanel(this);
  this.contactListPanel=new ContactListPane(this);
  this.accountStatusPanel=new AccountStatusPanel(this);
  menu=new MainMenu(this);
  this.addWindowListener(new WindowAdapter(){
    public void windowClosed(    WindowEvent event){
      MainFrame.this.windowClosed(event);
    }
    public void windowClosing(    WindowEvent event){
      MainFrame.this.windowClosing(event);
    }
  }
);
  this.initTitleFont();
  String applicationName=GuiActivator.getResources().getSettingsString("String_Node_Str");
  this.setTitle(applicationName);
  this.mainPanel.setBackground(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
  this.init();
  this.initPluginComponents();
}
Program: 104300
Project: 104300
Buggy source:
public void windowClosed(WindowEvent e){
  if (GuiActivator.getUIService().getExitOnMainWindowClose()) {
    try {
      GuiActivator.bundleContext.getBundle(0).stop();
    }
 catch (    BundleException ex) {
      logger.error("String_Node_Str",ex);
      System.exit(0);
    }
  }
}

Fixed version (ground truth):
protected void windowClosed(WindowEvent event){
  if (GuiActivator.getUIService().getExitOnMainWindowClose()) {
    try {
      GuiActivator.bundleContext.getBundle(0).stop();
    }
 catch (    BundleException ex) {
      logger.error("String_Node_Str",ex);
      System.exit(0);
    }
  }
}
Program: 104301
Project: 104301
Buggy source:
public void windowClosing(WindowEvent e){
  if (!GuiActivator.getUIService().getExitOnMainWindowClose()) {
    new Thread(){
      public void run(){
        if (ConfigurationManager.isQuitWarningShown()) {
          MessageDialog dialog=new MessageDialog(MainFrame.this,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str").getText(),false);
          int returnCode=dialog.showDialog();
          if (returnCode == MessageDialog.OK_DONT_ASK_CODE) {
            ConfigurationManager.setQuitWarningShown(false);
          }
        }
      }
    }
.start();
    ConfigurationManager.setApplicationVisible(false);
  }
}

Fixed version (ground truth):
protected void windowClosing(WindowEvent event){
  if (!GuiActivator.getUIService().getExitOnMainWindowClose()) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        if (ConfigurationManager.isQuitWarningShown()) {
          MessageDialog dialog=new MessageDialog(null,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str").getText(),false);
          if (dialog.showDialog() == MessageDialog.OK_DONT_ASK_CODE)           ConfigurationManager.setQuitWarningShown(false);
        }
      }
    }
);
    ConfigurationManager.setApplicationVisible(false);
  }
}
Program: 104302
Project: 104302
Buggy source:
/** 
 * Writes the symbol corresponding to a choosen smiley icon to the write message area at the end of the current text.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem smileyItem=(JMenuItem)e.getSource();
  String buttonText=smileyItem.getToolTipText();
  for (int i=0; i < this.imageList.size(); i++) {
    Smiley smiley=(Smiley)this.imageList.get(i);
    String smileyString=smiley.getSmileyStrings()[0];
    if (buttonText.equals(smileyString)) {
      chatWritePanel.appendText(smileyString);
      chatWritePanel.getEditorPane().requestFocus();
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the symbol corresponding to a choosen smiley icon to the write message area at the end of the current text.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem smileyItem=(JMenuItem)e.getSource();
  String buttonText=smileyItem.getToolTipText();
  for (  Smiley smiley : imageList) {
    String smileyString=smiley.getSmileyStrings()[0];
    if (buttonText.equals(smileyString)) {
      chatWritePanel.appendText(smileyString);
      chatWritePanel.getEditorPane().requestFocus();
    }
  }
}
Program: 104303
Project: 104303
Buggy source:
/** 
 * In order to have a popup which is at the form closest to sqware.
 * @param itemsCount the count of items that will be laied out.
 */
private void calculateGridDimensions(int itemsCount){
  this.gridRowCount=(int)Math.round(Math.sqrt(itemsCount));
  this.gridColCount=(int)Math.round(itemsCount / gridRowCount);
}

Fixed version (ground truth):
/** 
 * In order to have a popup which is at the form closest to sqware.
 * @param itemsCount the count of items that will be laied out.
 */
private void calculateGridDimensions(int itemsCount){
  this.gridRowCount=(int)Math.round(Math.sqrt(itemsCount));
  this.gridColCount=(int)Math.ceil(itemsCount / gridRowCount);
}