nus-yam/ex-repair huggingface dataset:
Program: 111524
Project: 111524
Buggy source:
public void keyTyped(KeyEvent e){
}

Fixed version (ground truth):
public void keyTyped(KeyEvent e){
  int keysym=UnicodeToKeysym.translate(e.getKeyChar());
  if (!cc.viewer.viewOnly.getValue())   if (!e.isActionKey() && keysym > 0)   cc.writeKeyEvent(e,keysym);
}
Program: 111525
Project: 111525
Buggy source:
public void keyReleased(KeyEvent e){
  if (!cc.viewer.viewOnly.getValue())   cc.writeKeyEvent(e);
}

Fixed version (ground truth):
public void keyReleased(KeyEvent e){
  int keysym=UnicodeToKeysym.translate(e.getKeyChar());
  if (!cc.viewer.viewOnly.getValue())   if (e.isActionKey() || keysym < 0)   cc.writeKeyEvent(e);
}
Program: 111526
Project: 111526
Buggy source:
public void keyPressed(KeyEvent e){
  if (e.getKeyCode() == MenuKey.getMenuKeyCode()) {
    int sx=(scaleWidthRatio == 1.00) ? lastX : (int)Math.floor(lastX * scaleWidthRatio);
    int sy=(scaleHeightRatio == 1.00) ? lastY : (int)Math.floor(lastY * scaleHeightRatio);
    java.awt.Point ev=new java.awt.Point(lastX,lastY);
    ev.translate(sx - lastX,sy - lastY);
    cc.showMenu((int)ev.getX(),(int)ev.getY());
    return;
  }
  int ctrlAltShiftMask=Event.SHIFT_MASK | Event.CTRL_MASK | Event.ALT_MASK;
  if ((e.getModifiers() & ctrlAltShiftMask) == ctrlAltShiftMask) {
switch (e.getKeyCode()) {
case KeyEvent.VK_A:
      cc.showAbout();
    return;
case KeyEvent.VK_F:
  cc.toggleFullScreen();
return;
case KeyEvent.VK_H:
cc.refresh();
return;
case KeyEvent.VK_I:
cc.showInfo();
return;
case KeyEvent.VK_O:
cc.options.showDialog(cc.viewport);
return;
case KeyEvent.VK_W:
VncViewer.newViewer(cc.viewer);
return;
case KeyEvent.VK_LEFT:
case KeyEvent.VK_RIGHT:
case KeyEvent.VK_UP:
case KeyEvent.VK_DOWN:
return;
}
}
if ((e.getModifiers() & Event.META_MASK) == Event.META_MASK) {
switch (e.getKeyCode()) {
case KeyEvent.VK_COMMA:
case KeyEvent.VK_N:
case KeyEvent.VK_W:
case KeyEvent.VK_I:
case KeyEvent.VK_R:
case KeyEvent.VK_L:
case KeyEvent.VK_F:
case KeyEvent.VK_Z:
case KeyEvent.VK_T:
return;
}
}
if (!cc.viewer.viewOnly.getValue()) cc.writeKeyEvent(e);
}

Fixed version (ground truth):
public void keyPressed(KeyEvent e){
  if (e.getKeyCode() == MenuKey.getMenuKeyCode()) {
    int sx=(scaleWidthRatio == 1.00) ? lastX : (int)Math.floor(lastX * scaleWidthRatio);
    int sy=(scaleHeightRatio == 1.00) ? lastY : (int)Math.floor(lastY * scaleHeightRatio);
    java.awt.Point ev=new java.awt.Point(lastX,lastY);
    ev.translate(sx - lastX,sy - lastY);
    cc.showMenu((int)ev.getX(),(int)ev.getY());
    return;
  }
  int ctrlAltShiftMask=Event.SHIFT_MASK | Event.CTRL_MASK | Event.ALT_MASK;
  if ((e.getModifiers() & ctrlAltShiftMask) == ctrlAltShiftMask) {
switch (e.getKeyCode()) {
case KeyEvent.VK_A:
      cc.showAbout();
    return;
case KeyEvent.VK_F:
  cc.toggleFullScreen();
return;
case KeyEvent.VK_H:
cc.refresh();
return;
case KeyEvent.VK_I:
cc.showInfo();
return;
case KeyEvent.VK_O:
cc.options.showDialog(cc.viewport);
return;
case KeyEvent.VK_W:
VncViewer.newViewer(cc.viewer);
return;
case KeyEvent.VK_LEFT:
case KeyEvent.VK_RIGHT:
case KeyEvent.VK_UP:
case KeyEvent.VK_DOWN:
return;
}
}
if ((e.getModifiers() & Event.META_MASK) == Event.META_MASK) {
switch (e.getKeyCode()) {
case KeyEvent.VK_COMMA:
case KeyEvent.VK_N:
case KeyEvent.VK_W:
case KeyEvent.VK_I:
case KeyEvent.VK_R:
case KeyEvent.VK_L:
case KeyEvent.VK_F:
case KeyEvent.VK_Z:
case KeyEvent.VK_T:
return;
}
}
int keysym=UnicodeToKeysym.translate(e.getKeyChar());
if (!cc.viewer.viewOnly.getValue()) if (e.isActionKey() || keysym < 0) cc.writeKeyEvent(e);
}
Program: 111527
Project: 111527
Buggy source:
public void toggleFullScreen(){
  fullScreen=!fullScreen;
  if (!fullScreen)   menu.fullScreen.setSelected(false);
  if (viewport != null)   recreateViewport();
}

Fixed version (ground truth):
public void toggleFullScreen(){
  fullScreen=!fullScreen;
  menu.fullScreen.setSelected(fullScreen);
  if (viewport != null)   recreateViewport();
}
Program: 111530
Project: 111530
Buggy source:
public void endDialog(){
  setVisible(false);
  setFocusable(false);
  setAlwaysOnTop(false);
  if (fullScreenWindow != null)   Viewport.setFullScreenWindow(fullScreenWindow);
}

Fixed version (ground truth):
public void endDialog(){
  setVisible(false);
  setFocusable(false);
  setAlwaysOnTop(false);
  fullScreenWindow=Viewport.getFullScreenWindow();
  if (fullScreenWindow != null)   Viewport.setFullScreenWindow(fullScreenWindow);
}
Program: 111531
Project: 111531
Buggy source:
public void componentResized(ComponentEvent e){
  if ((getExtendedState() != JFrame.MAXIMIZED_BOTH) && cc.fullScreen) {
    cc.toggleFullScreen();
  }
  String scaleString=cc.viewer.scalingFactor.getValue();
  if (scaleString.equalsIgnoreCase("String_Node_Str") || scaleString.equalsIgnoreCase("String_Node_Str")) {
    if ((sp.getSize().width != cc.desktop.scaledWidth) || (sp.getSize().height != cc.desktop.scaledHeight)) {
      int policy=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
      sp.setHorizontalScrollBarPolicy(policy);
      cc.desktop.setScaledSize();
      sp.setSize(new Dimension(cc.desktop.scaledWidth,cc.desktop.scaledHeight));
      sp.validate();
      if (getExtendedState() != JFrame.MAXIMIZED_BOTH && scaleString.equalsIgnoreCase("String_Node_Str")) {
        int w=cc.desktop.scaledWidth + getInsets().left + getInsets().right;
        int h=cc.desktop.scaledHeight + getInsets().top + getInsets().bottom;
        setSize(w,h);
      }
      if (cc.desktop.cursor != null) {
        Cursor cursor=cc.desktop.cursor;
        cc.setCursor(cursor.width(),cursor.height(),cursor.hotspot,cursor.data,cursor.mask);
      }
    }
  }
 else {
    int policy=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    sp.setHorizontalScrollBarPolicy(policy);
    sp.validate();
  }
}

Fixed version (ground truth):
public void componentResized(ComponentEvent e){
  String scaleString=cc.viewer.scalingFactor.getValue();
  if (scaleString.equalsIgnoreCase("String_Node_Str") || scaleString.equalsIgnoreCase("String_Node_Str")) {
    if ((sp.getSize().width != cc.desktop.scaledWidth) || (sp.getSize().height != cc.desktop.scaledHeight)) {
      int policy=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
      sp.setHorizontalScrollBarPolicy(policy);
      cc.desktop.setScaledSize();
      sp.setSize(new Dimension(cc.desktop.scaledWidth,cc.desktop.scaledHeight));
      sp.validate();
      if (getExtendedState() != JFrame.MAXIMIZED_BOTH && scaleString.equalsIgnoreCase("String_Node_Str") && !cc.fullScreen) {
        int w=cc.desktop.scaledWidth + getInsets().left + getInsets().right;
        int h=cc.desktop.scaledHeight + getInsets().top + getInsets().bottom;
        setSize(w,h);
      }
    }
  }
 else {
    int policy=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    sp.setHorizontalScrollBarPolicy(policy);
    sp.validate();
  }
  if (cc.desktop.cursor != null) {
    Cursor cursor=cc.desktop.cursor;
    cc.setCursor(cursor.width(),cursor.height(),cursor.hotspot,cursor.data,cursor.mask);
  }
}
Program: 111533
Project: 111533
Buggy source:
public void setPF(PixelFormat pf){
  if (!(pf.bpp == 32) && !(pf.bpp == 16) && !(pf.bpp == 8))   throw new Exception("String_Node_Str" + pf.bpp + "String_Node_Str");
  format=pf;
switch (pf.depth) {
case 3:
case 6:
case 8:
    int rmask=pf.redMax << pf.redShift;
  int gmask=pf.greenMax << pf.greenShift;
int bmask=pf.blueMax << pf.blueShift;
if (pf.trueColour) cm=new DirectColorModel(8,rmask,gmask,bmask);
 else cm=new IndexColorModel(8,256,new byte[256],new byte[256],new byte[256]);
break;
case 16:
cm=new DirectColorModel(32,0xF800,0x07C0,0x003E,(0xff << 24));
break;
case 24:
cm=new DirectColorModel(32,(0xff << 16),(0xff << 8),0xff,(0xff << 24));
break;
case 32:
cm=new DirectColorModel(32,(0xff << pf.redShift),(0xff << pf.greenShift),(0xff << pf.blueShift),(0xff << 24));
break;
default :
throw new Exception("String_Node_Str" + pf.depth + "String_Node_Str");
}
}

Fixed version (ground truth):
public void setPF(PixelFormat pf){
  if (!(pf.bpp == 32) && !(pf.bpp == 16) && !(pf.bpp == 8))   throw new Exception("String_Node_Str" + pf.bpp + "String_Node_Str");
  format=pf;
switch (pf.depth) {
case 3:
case 6:
case 8:
    if (cm != null && cm instanceof IndexColorModel)     break;
  int rmask=pf.redMax << pf.redShift;
int gmask=pf.greenMax << pf.greenShift;
int bmask=pf.blueMax << pf.blueShift;
cm=new DirectColorModel(8,rmask,gmask,bmask);
break;
case 16:
cm=new DirectColorModel(32,0xF800,0x07C0,0x003E,(0xff << 24));
break;
case 24:
cm=new DirectColorModel(32,(0xff << 16),(0xff << 8),0xff,(0xff << 24));
break;
case 32:
cm=new DirectColorModel(32,(0xff << pf.redShift),(0xff << pf.greenShift),(0xff << pf.blueShift),(0xff << 24));
break;
default :
throw new Exception("String_Node_Str" + pf.depth + "String_Node_Str");
}
}
Program: 111534
Project: 111534
Buggy source:
public void updateColourMap(){
  cm=new IndexColorModel(8,nColours,reds,greens,blues);
  createImage(width_,height_);
}

Fixed version (ground truth):
public void updateColourMap(){
  super.updateColourMap();
  createImage(width_,height_);
}
Program: 111535
Project: 111535
Buggy source:
final public void fillRect(int x,int y,int w,int h,int pix){
  if (overlapsCursor(x,y,w,h))   hideLocalCursor();
  im.fillRect(x,y,w,h,pix);
  damageRect(new Rect(x,y,x + w,y + h));
  if (softCursor == null)   showLocalCursor();
}

Fixed version (ground truth):
final public void fillRect(int x,int y,int w,int h,int pix){
  if (overlapsCursor(x,y,w,h))   hideLocalCursor();
  im.fillRect(x,y,w,h,pix);
  damageRect(new Rect(x,y,x + w,y + h));
  if (!cc.cp.supportsLocalCursor)   showLocalCursor();
}
Program: 111536
Project: 111536
Buggy source:
synchronized private void showLocalCursor(){
  if (cursorAvailable && !cursorVisible) {
    if (!im.getPF().equal(cursor.getPF()) || cursor.width() == 0 || cursor.height() == 0) {
      vlog.debug("String_Node_Str");
      cursorAvailable=false;
      return;
    }
    cursorVisible=true;
    if (softCursor != null)     return;
    int cursorLeft=cursor.hotspot.x;
    int cursorTop=cursor.hotspot.y;
    int cursorRight=cursorLeft + cursor.width();
    int cursorBottom=cursorTop + cursor.height();
    int x=(cursorLeft >= 0 ? cursorLeft : 0);
    int y=(cursorTop >= 0 ? cursorTop : 0);
    int w=((cursorRight < im.width() ? cursorRight : im.width()) - x);
    int h=((cursorBottom < im.height() ? cursorBottom : im.height()) - y);
    cursorBackingX=x;
    cursorBackingY=y;
    cursorBacking.setSize(w,h);
    for (int j=0; j < h; j++)     System.arraycopy(im.data,(y + j) * im.width() + x,cursorBacking.data,j * w,w);
    im.maskRect(cursorLeft,cursorTop,cursor.width(),cursor.height(),cursor.data,cursor.mask);
  }
}

Fixed version (ground truth):
synchronized private void showLocalCursor(){
  if (cursorAvailable && !cursorVisible) {
    if (!im.getPF().equal(cursor.getPF()) || cursor.width() == 0 || cursor.height() == 0) {
      vlog.debug("String_Node_Str");
      cursorAvailable=false;
      return;
    }
    cursorVisible=true;
    if (cc.cp.supportsLocalCursor)     return;
    int cursorLeft=cursor.hotspot.x;
    int cursorTop=cursor.hotspot.y;
    int cursorRight=cursorLeft + cursor.width();
    int cursorBottom=cursorTop + cursor.height();
    int x=(cursorLeft >= 0 ? cursorLeft : 0);
    int y=(cursorTop >= 0 ? cursorTop : 0);
    int w=((cursorRight < im.width() ? cursorRight : im.width()) - x);
    int h=((cursorBottom < im.height() ? cursorBottom : im.height()) - y);
    cursorBackingX=x;
    cursorBackingY=y;
    cursorBacking.setSize(w,h);
    for (int j=0; j < h; j++)     System.arraycopy(im.data,(y + j) * im.width() + x,cursorBacking.data,j * w,w);
    im.maskRect(cursorLeft,cursorTop,cursor.width(),cursor.height(),cursor.data,cursor.mask);
  }
}
Program: 111537
Project: 111537
Buggy source:
/** 
 * Mouse-Motion callback function 
 */
private void mouseMotionCB(MouseEvent e){
  if (!cc.viewer.viewOnly.getValue())   cc.writePointerEvent(e);
  if (cursorAvailable) {
    if (e.getX() != cursorPosX || e.getY() != cursorPosY) {
      hideLocalCursor();
      if (e.getX() >= 0 && e.getX() < im.width() && e.getY() >= 0 && e.getY() < im.height()) {
        cursorPosX=e.getX();
        cursorPosY=e.getY();
        if (softCursor == null)         showLocalCursor();
      }
    }
  }
  lastX=e.getX();
  lastY=e.getY();
}

Fixed version (ground truth):
/** 
 * Mouse-Motion callback function 
 */
private void mouseMotionCB(MouseEvent e){
  if (!cc.viewer.viewOnly.getValue())   cc.writePointerEvent(e);
  if (cursorAvailable) {
    if (e.getX() != cursorPosX || e.getY() != cursorPosY) {
      hideLocalCursor();
      if (e.getX() >= 0 && e.getX() < im.width() && e.getY() >= 0 && e.getY() < im.height()) {
        cursorPosX=e.getX();
        cursorPosY=e.getY();
        if (!cc.cp.supportsLocalCursor)         showLocalCursor();
      }
    }
  }
  lastX=e.getX();
  lastY=e.getY();
}
Program: 111538
Project: 111538
Buggy source:
public void paintComponent(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  if (cc.cp.width != scaledWidth || cc.cp.height != scaledHeight) {
    g2.drawImage(im.getImage(),0,0,scaledWidth,scaledHeight,null);
  }
 else {
    g2.drawImage(im.getImage(),0,0,null);
  }
  g2.dispose();
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  if (cc.cp.width != scaledWidth || cc.cp.height != scaledHeight) {
    g2.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
    g2.drawImage(im.getImage(),0,0,scaledWidth,scaledHeight,null);
  }
 else {
    g2.drawImage(im.getImage(),0,0,null);
  }
  g2.dispose();
}
Program: 111539
Project: 111539
Buggy source:
void resetLocalCursor(){
  hideLocalCursor();
  cursorAvailable=false;
}

Fixed version (ground truth):
void resetLocalCursor(){
  if (cc.cp.supportsLocalCursor) {
    if (softCursor != null)     setCursor(softCursor);
  }
 else {
    setCursor(nullCursor);
  }
  hideLocalCursor();
  cursorAvailable=false;
}
Program: 111540
Project: 111540
Buggy source:
public DesktopWindow(int width,int height,PixelFormat serverPF,CConn cc_){
  cc=cc_;
  setSize(width,height);
  setBackground(Color.BLACK);
  setOpaque(true);
  GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice gd=ge.getDefaultScreenDevice();
  GraphicsConfiguration gc=gd.getDefaultConfiguration();
  BufferCapabilities bufCaps=gc.getBufferCapabilities();
  ImageCapabilities imgCaps=gc.getImageCapabilities();
  if (bufCaps.isPageFlipping() || bufCaps.isMultiBufferAvailable() || imgCaps.isAccelerated()) {
    vlog.debug("String_Node_Str");
  }
 else {
    vlog.debug("String_Node_Str");
  }
  im=new BIPixelBuffer(width,height,cc,this);
  cursor=new Cursor();
  cursorBacking=new ManagedPixelBuffer();
  addMouseListener(this);
  addMouseWheelListener(this);
  addMouseMotionListener(this);
  addKeyListener(this);
  addFocusListener(new FocusAdapter(){
    public void focusGained(    FocusEvent e){
      checkClipboard();
    }
  }
);
  setFocusTraversalKeysEnabled(false);
  setFocusable(true);
}

Fixed version (ground truth):
public DesktopWindow(int width,int height,PixelFormat serverPF,CConn cc_){
  cc=cc_;
  setSize(width,height);
  setBackground(Color.BLACK);
  setOpaque(true);
  GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice gd=ge.getDefaultScreenDevice();
  GraphicsConfiguration gc=gd.getDefaultConfiguration();
  BufferCapabilities bufCaps=gc.getBufferCapabilities();
  ImageCapabilities imgCaps=gc.getImageCapabilities();
  if (bufCaps.isPageFlipping() || bufCaps.isMultiBufferAvailable() || imgCaps.isAccelerated()) {
    vlog.debug("String_Node_Str");
  }
 else {
    vlog.debug("String_Node_Str");
  }
  im=new BIPixelBuffer(width,height,cc,this);
  cursor=new Cursor();
  cursorBacking=new ManagedPixelBuffer();
  Dimension bestSize=tk.getBestCursorSize(16,16);
  BufferedImage cursorImage;
  cursorImage=new BufferedImage(bestSize.width,bestSize.height,BufferedImage.TYPE_INT_ARGB);
  java.awt.Point hotspot=new java.awt.Point(0,0);
  nullCursor=tk.createCustomCursor(cursorImage,hotspot,"String_Node_Str");
  if (!cc.cp.supportsLocalCursor && !bestSize.equals(new Dimension(0,0)))   setCursor(nullCursor);
  addMouseListener(this);
  addMouseWheelListener(this);
  addMouseMotionListener(this);
  addKeyListener(this);
  addFocusListener(new FocusAdapter(){
    public void focusGained(    FocusEvent e){
      checkClipboard();
    }
  }
);
  setFocusTraversalKeysEnabled(false);
  setFocusable(true);
}
Program: 111541
Project: 111541
Buggy source:
public void updateWindow(){
  Rect r=damage;
  if (!r.is_empty()) {
    paintImmediately(r.tl.x,r.tl.y,r.width(),r.height());
    damage.clear();
  }
}

Fixed version (ground truth):
public void updateWindow(){
  Rect r=damage;
  if (!r.is_empty()) {
    if (cc.cp.width != scaledWidth || cc.cp.height != scaledHeight) {
      int x=(int)Math.floor(r.tl.x * scaleWidthRatio);
      int y=(int)Math.floor(r.tl.y * scaleHeightRatio);
      int width=(int)Math.ceil(r.width() * scaleWidthRatio) + 1;
      int height=(int)Math.ceil(r.height() * scaleHeightRatio) + 1;
      paintImmediately(x,y,width,height);
    }
 else {
      paintImmediately(r.tl.x,r.tl.y,r.width(),r.height());
    }
    damage.clear();
  }
}
Program: 111542
Project: 111542
Buggy source:
final public void imageRect(int x,int y,int w,int h,Object pix){
  if (overlapsCursor(x,y,w,h))   hideLocalCursor();
  im.imageRect(x,y,w,h,pix);
  damageRect(new Rect(x,y,x + w,y + h));
  if (softCursor == null)   showLocalCursor();
}

Fixed version (ground truth):
final public void imageRect(int x,int y,int w,int h,Object pix){
  if (overlapsCursor(x,y,w,h))   hideLocalCursor();
  im.imageRect(x,y,w,h,pix);
  damageRect(new Rect(x,y,x + w,y + h));
  if (!cc.cp.supportsLocalCursor)   showLocalCursor();
}
Program: 111545
Project: 111545
Buggy source:
public void resize(int w,int h){
  if (w == width() && h == height())   return;
  width_=w;
  height_=h;
  GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice gd=ge.getDefaultScreenDevice();
  GraphicsConfiguration gc=gd.getDefaultConfiguration();
  image=gc.createCompatibleImage(w,h,Transparency.OPAQUE);
  image.setAccelerationPriority(1);
  image.createGraphics();
}

Fixed version (ground truth):
public void resize(int w,int h){
  if (w == width() && h == height())   return;
  width_=w;
  height_=h;
  GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice gd=ge.getDefaultScreenDevice();
  GraphicsConfiguration gc=gd.getDefaultConfiguration();
  image=gc.createCompatibleImage(w,h,Transparency.TRANSLUCENT);
  image.setAccelerationPriority(1);
  image.createGraphics();
}
Program: 111547
Project: 111547
Buggy source:
public SocketDescriptor() throws Exception {
  super(SelectorProvider.provider());
  try {
    channel=SocketChannel.open();
    channel.configureBlocking(false);
    selector=Selector.open();
  }
 catch (  IOException e) {
    throw new Exception(e.toString());
  }
  try {
    channel.register(selector,SelectionKey.OP_READ | SelectionKey.OP_WRITE);
  }
 catch (  java.nio.channels.ClosedChannelException e) {
    throw new Exception(e.toString());
  }
}

Fixed version (ground truth):
public SocketDescriptor() throws Exception {
  super(DefaultSelectorProvider());
  try {
    channel=SocketChannel.open();
    channel.configureBlocking(false);
    selector=Selector.open();
  }
 catch (  IOException e) {
    throw new Exception(e.toString());
  }
  try {
    channel.register(selector,SelectionKey.OP_READ | SelectionKey.OP_WRITE);
  }
 catch (  java.nio.channels.ClosedChannelException e) {
    throw new Exception(e.toString());
  }
}
Program: 111549
Project: 111549
Buggy source:
public void start(){
  vlog.debug("String_Node_Str");
  if (version == null || build == null) {
    ClassLoader cl=this.getClass().getClassLoader();
    InputStream stream=cl.getResourceAsStream("String_Node_Str");
    try {
      Manifest manifest=new Manifest(stream);
      Attributes attributes=manifest.getMainAttributes();
      version=attributes.getValue("String_Node_Str");
      build=attributes.getValue("String_Node_Str");
    }
 catch (    java.io.IOException e) {
    }
  }
  nViewers++;
  if (firstApplet) {
    alwaysShowServerDialog.setParam(true);
    Configuration.readAppletParams(this);
    String host=getCodeBase().getHost();
    if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
      int port=vncServerPort.getValue();
      vncServerName.setParam(host + ((port >= 5900 && port <= 5999) ? ("String_Node_Str" + (port - 5900)) : ("String_Node_Str" + port)));
    }
  }
  thread=new Thread(this);
  thread.start();
}

Fixed version (ground truth):
public void start(){
  vlog.debug("String_Node_Str");
  if (version == null || build == null) {
    ClassLoader cl=this.getClass().getClassLoader();
    InputStream stream=cl.getResourceAsStream("String_Node_Str");
    try {
      Manifest manifest=new Manifest(stream);
      Attributes attributes=manifest.getMainAttributes();
      version=attributes.getValue("String_Node_Str");
      build=attributes.getValue("String_Node_Str");
    }
 catch (    java.io.IOException e) {
    }
  }
  nViewers++;
  if (applet && firstApplet) {
    alwaysShowServerDialog.setParam(true);
    Configuration.readAppletParams(this);
    String host=getCodeBase().getHost();
    if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
      int port=vncServerPort.getValue();
      vncServerName.setParam(host + ((port >= 5900 && port <= 5999) ? ("String_Node_Str" + (port - 5900)) : ("String_Node_Str" + port)));
    }
  }
  thread=new Thread(this);
  thread.start();
}
Program: 111550
Project: 111550
Buggy source:
public static void main(String[] argv){
  try {
    String os=System.getProperty("String_Node_Str");
    if (os.startsWith("String_Node_Str")) {
      String laf="String_Node_Str";
      UIManager.setLookAndFeel(laf);
    }
 else {
      UIManager.put("String_Node_Str",Boolean.FALSE);
      javax.swing.plaf.FontUIResource f=new javax.swing.plaf.FontUIResource("String_Node_Str",Font.PLAIN,11);
      java.util.Enumeration keys=UIManager.getDefaults().keys();
      while (keys.hasMoreElements()) {
        Object key=keys.nextElement();
        Object value=UIManager.get(key);
        if (value instanceof javax.swing.plaf.FontUIResource)         UIManager.put(key,f);
      }
    }
    UIManager.put("String_Node_Str",Color.blue);
  }
 catch (  java.lang.Exception exc) {
  }
  VncViewer viewer=new VncViewer(argv);
  viewer.start();
}

Fixed version (ground truth):
public static void main(String[] argv){
  try {
    String os=System.getProperty("String_Node_Str");
    if (os.startsWith("String_Node_Str")) {
      String laf="String_Node_Str";
      UIManager.setLookAndFeel(laf);
    }
 else {
      UIManager.put("String_Node_Str",Boolean.FALSE);
      javax.swing.plaf.FontUIResource f=new javax.swing.plaf.FontUIResource("String_Node_Str",Font.PLAIN,11);
      java.util.Enumeration keys=UIManager.getDefaults().keys();
      while (keys.hasMoreElements()) {
        Object key=keys.nextElement();
        Object value=UIManager.get(key);
        if (value instanceof javax.swing.plaf.FontUIResource)         UIManager.put(key,f);
      }
    }
    UIManager.put("String_Node_Str",Color.blue);
  }
 catch (  java.lang.Exception exc) {
  }
  VncViewer viewer=new VncViewer(argv);
  viewer.firstApplet=true;
  viewer.stop=false;
  viewer.start();
}
Program: 111552
Project: 111552
Buggy source:
public void readRect(Rect r,CMsgHandler handler){
  int x=r.tl.x;
  int y=r.tl.y;
  int w=r.width();
  int h=r.height();
  int[] imageBuf=reader.getImageBuf(w * h);
  int nPixels=imageBuf.length / (reader.bpp() / 8);
  while (h > 0) {
    int nRows=nPixels / w;
    if (nRows > h)     nRows=h;
    reader.is.readPixels(imageBuf,w * h,(reader.bpp() / 8),handler.cp.pf().bigEndian);
    handler.imageRect(new Rect(x,y,x + w,y + nRows),imageBuf);
    h-=nRows;
    y+=nRows;
  }
}

Fixed version (ground truth):
public void readRect(Rect r,CMsgHandler handler){
  int x=r.tl.x;
  int y=r.tl.y;
  int w=r.width();
  int h=r.height();
  int[] imageBuf=new int[w * h];
  int nPixels=imageBuf.length;
  int bytesPerRow=w * (reader.bpp() / 8);
  while (h > 0) {
    int nRows=nPixels / w;
    if (nRows > h)     nRows=h;
    reader.getInStream().readPixels(imageBuf,nPixels,(reader.bpp() / 8),handler.cp.pf().bigEndian);
    handler.imageRect(new Rect(x,y,x + w,y + nRows),imageBuf);
    h-=nRows;
    y+=nRows;
  }
}
Program: 111554
Project: 111554
Buggy source:
public int[] getImageBuf(int required,int requested,int nPixels){
  int requiredBytes=required * (handler.cp.pf().bpp / 8);
  int requestedBytes=requested * (handler.cp.pf().bpp / 8);
  int size=requestedBytes;
  if (size > imageBufIdealSize)   size=imageBufIdealSize;
  if (size < requiredBytes)   size=requiredBytes;
  if (imageBufSize < size) {
    imageBufSize=size;
    imageBuf=new int[imageBufSize];
  }
  if (nPixels != 0)   nPixels=imageBufSize / (handler.cp.pf().bpp / 8);
  return imageBuf;
}

Fixed version (ground truth):
public int[] getImageBuf(int required,int requested,int nPixels){
  int requiredBytes=required;
  int requestedBytes=requested;
  int size=requestedBytes;
  if (size > imageBufIdealSize)   size=imageBufIdealSize;
  if (size < requiredBytes)   size=requiredBytes;
  if (imageBufSize < size) {
    imageBufSize=size;
    imageBuf=new int[imageBufSize];
  }
  if (nPixels != 0)   nPixels=imageBufSize / (handler.cp.pf().bpp / 8);
  return imageBuf;
}
Program: 111556
Project: 111556
Buggy source:
final private void DECOMPRESS_JPEG_RECT(Rect r,InStream is,CMsgHandler handler){
  int compressedLen=is.readCompactLength();
  if (compressedLen <= 0)   vlog.info("String_Node_Str");
  byte[] netbuf=new byte[compressedLen];
  is.readBytes(netbuf,0,compressedLen);
  int imageType=BufferedImage.TYPE_4BYTE_ABGR_PRE;
  BufferedImage jpeg=new BufferedImage(r.width(),r.height(),imageType);
  jpeg.setAccelerationPriority(1);
  try {
    jpeg=ImageIO.read(new ByteArrayInputStream(netbuf));
  }
 catch (  java.io.IOException e) {
    e.printStackTrace();
  }
  int[] buf=reader.getImageBuf(r.area());
  jpeg.getRGB(0,0,r.width(),r.height(),buf,0,r.width());
  jpeg=null;
  handler.imageRect(r,buf);
}

Fixed version (ground truth):
final private void DECOMPRESS_JPEG_RECT(Rect r,InStream is,CMsgHandler handler){
  int compressedLen=is.readCompactLength();
  if (compressedLen <= 0)   vlog.info("String_Node_Str");
  byte[] netbuf=new byte[compressedLen];
  is.readBytes(netbuf,0,compressedLen);
  int imageType=BufferedImage.TYPE_4BYTE_ABGR_PRE;
  int w=r.width();
  int h=r.height();
  BufferedImage jpeg=new BufferedImage(w,h,imageType);
  jpeg.setAccelerationPriority(1);
  try {
    jpeg=ImageIO.read(new ByteArrayInputStream(netbuf));
  }
 catch (  java.io.IOException e) {
    e.printStackTrace();
  }
  int[] buf=reader.getImageBuf(w * h);
  jpeg.getRGB(0,0,w,h,buf,0,w);
  jpeg=null;
  handler.imageRect(r,buf);
}
Program: 111557
Project: 111557
Buggy source:
private void initGlobal(){
  try {
    SSLSocketFactory sslfactory;
    SSLContext ctx=SSLContext.getInstance("String_Node_Str");
    if (anon) {
      ctx.init(null,null,null);
    }
 else {
      TrustManager[] myTM=new TrustManager[]{new MyX509TrustManager()};
      ctx.init(null,myTM,null);
    }
    sslfactory=ctx.getSocketFactory();
    try {
      ssl=(SSLSocket)sslfactory.createSocket(cc.sock,cc.sock.getInetAddress().getHostName(),cc.sock.getPort(),true);
    }
 catch (    java.io.IOException e) {
      throw new Exception(e.toString());
    }
    if (anon) {
      String[] supported;
      ArrayList enabled=new ArrayList();
      supported=ssl.getSupportedCipherSuites();
      for (int i=0; i < supported.length; i++)       if (supported[i].matches("String_Node_Str"))       enabled.add(supported[i]);
      ssl.setEnabledCipherSuites((String[])enabled.toArray(new String[0]));
    }
 else {
      ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites());
    }
    ssl.setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str"});
    ssl.addHandshakeCompletedListener(new MyHandshakeListener());
  }
 catch (  java.security.GeneralSecurityException e) {
    vlog.error("String_Node_Str" + e.toString());
    return;
  }
}

Fixed version (ground truth):
private void initGlobal(){
  try {
    SSLSocketFactory sslfactory;
    SSLContext ctx=SSLContext.getInstance("String_Node_Str");
    if (anon) {
      ctx.init(null,null,null);
    }
 else {
      TrustManager[] myTM=new TrustManager[]{new MyX509TrustManager()};
      ctx.init(null,myTM,null);
    }
    sslfactory=ctx.getSocketFactory();
    try {
      ssl=(SSLSocket)sslfactory.createSocket(cc.sock,cc.sock.getInetAddress().getHostName(),cc.sock.getPort(),true);
    }
 catch (    java.io.IOException e) {
      throw new Exception(e.toString());
    }
    if (anon) {
      String[] supported;
      ArrayList<String> enabled=new ArrayList<String>();
      supported=ssl.getSupportedCipherSuites();
      for (int i=0; i < supported.length; i++)       if (supported[i].matches("String_Node_Str"))       enabled.add(supported[i]);
      ssl.setEnabledCipherSuites(enabled.toArray(new String[0]));
    }
 else {
      ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites());
    }
    ssl.setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str"});
    ssl.addHandshakeCompletedListener(new MyHandshakeListener());
  }
 catch (  java.security.GeneralSecurityException e) {
    vlog.error("String_Node_Str" + e.toString());
    return;
  }
}
Program: 111559
Project: 111559
Buggy source:
synchronized public void writePointerEvent(MouseEvent ev){
  if (state() != RFBSTATE_NORMAL)   return;
  int x, y;
switch (ev.getID()) {
case MouseEvent.MOUSE_PRESSED:
    buttonMask=1;
  if ((ev.getModifiers() & KeyEvent.ALT_MASK) != 0)   buttonMask=2;
if ((ev.getModifiers() & KeyEvent.META_MASK) != 0) buttonMask=4;
break;
case MouseEvent.MOUSE_RELEASED:
buttonMask=0;
break;
}
writeModifiers(ev.getModifiers() & ~KeyEvent.ALT_MASK & ~KeyEvent.META_MASK);
if (cp.width != desktop.scaledWidth || cp.height != desktop.scaledHeight) {
int sx=(desktop.scaleWidthRatio == 1.00) ? ev.getX() : (int)Math.floor(ev.getX() / (float)desktop.scaleWidthRatio);
int sy=(desktop.scaleHeightRatio == 1.00) ? ev.getY() : (int)Math.floor(ev.getY() / (float)desktop.scaleHeightRatio);
ev.translatePoint(sx - ev.getX(),sy - ev.getY());
writer().writePointerEvent(new Point(ev.getX(),ev.getY()),buttonMask);
}
 else {
writer().writePointerEvent(new Point(ev.getX(),ev.getY()),buttonMask);
}
if (buttonMask == 0) writeModifiers(0);
}

Fixed version (ground truth):
synchronized public void writePointerEvent(MouseEvent ev){
  if (state() != RFBSTATE_NORMAL)   return;
  int x, y;
switch (ev.getID()) {
case MouseEvent.MOUSE_PRESSED:
    buttonMask=1;
  if ((ev.getModifiers() & KeyEvent.ALT_MASK) != 0)   buttonMask=2;
if ((ev.getModifiers() & KeyEvent.META_MASK) != 0) buttonMask=4;
break;
case MouseEvent.MOUSE_RELEASED:
buttonMask=0;
break;
}
writeModifiers(ev.getModifiers() & ~KeyEvent.ALT_MASK & ~KeyEvent.META_MASK);
if (cp.width != desktop.scaledWidth || cp.height != desktop.scaledHeight) {
int sx=(desktop.scaleWidthRatio == 1.00) ? ev.getX() : (int)Math.floor(ev.getX() / desktop.scaleWidthRatio);
int sy=(desktop.scaleHeightRatio == 1.00) ? ev.getY() : (int)Math.floor(ev.getY() / desktop.scaleHeightRatio);
ev.translatePoint(sx - ev.getX(),sy - ev.getY());
writer().writePointerEvent(new Point(ev.getX(),ev.getY()),buttonMask);
}
 else {
writer().writePointerEvent(new Point(ev.getX(),ev.getY()),buttonMask);
}
if (buttonMask == 0) writeModifiers(0);
}
Program: 111560
Project: 111560
Buggy source:
private void showLocalCursor(){
  if (cursorAvailable && !cursorVisible) {
    if (!im.getPF().equal(cursor.getPF()) || cursor.width() == 0 || cursor.height() == 0) {
      vlog.debug("String_Node_Str");
      cursorAvailable=false;
      return;
    }
    cursorVisible=true;
    if (softCursor != null)     return;
    int cursorLeft=(int)cursor.hotspot.x;
    int cursorTop=(int)cursor.hotspot.y;
    int cursorRight=cursorLeft + cursor.width();
    int cursorBottom=cursorTop + cursor.height();
    int x=(cursorLeft >= 0 ? cursorLeft : 0);
    int y=(cursorTop >= 0 ? cursorTop : 0);
    int w=((cursorRight < im.width() ? cursorRight : im.width()) - x);
    int h=((cursorBottom < im.height() ? cursorBottom : im.height()) - y);
    cursorBackingX=x;
    cursorBackingY=y;
    cursorBacking.setSize(w,h);
    for (int j=0; j < h; j++)     System.arraycopy(im.data,(y + j) * im.width() + x,cursorBacking.data,j * w,w);
    im.maskRect(cursorLeft,cursorTop,cursor.width(),cursor.height(),cursor.data,cursor.mask);
    im.put(x,y,w,h,graphics);
  }
}

Fixed version (ground truth):
private void showLocalCursor(){
  if (cursorAvailable && !cursorVisible) {
    if (!im.getPF().equal(cursor.getPF()) || cursor.width() == 0 || cursor.height() == 0) {
      vlog.debug("String_Node_Str");
      cursorAvailable=false;
      return;
    }
    cursorVisible=true;
    if (softCursor != null)     return;
    int cursorLeft=cursor.hotspot.x;
    int cursorTop=cursor.hotspot.y;
    int cursorRight=cursorLeft + cursor.width();
    int cursorBottom=cursorTop + cursor.height();
    int x=(cursorLeft >= 0 ? cursorLeft : 0);
    int y=(cursorTop >= 0 ? cursorTop : 0);
    int w=((cursorRight < im.width() ? cursorRight : im.width()) - x);
    int h=((cursorBottom < im.height() ? cursorBottom : im.height()) - y);
    cursorBackingX=x;
    cursorBackingY=y;
    cursorBacking.setSize(w,h);
    for (int j=0; j < h; j++)     System.arraycopy(im.data,(y + j) * im.width() + x,cursorBacking.data,j * w,w);
    im.maskRect(cursorLeft,cursorTop,cursor.width(),cursor.height(),cursor.data,cursor.mask);
    im.put(x,y,w,h,graphics);
  }
}
Program: 111561
Project: 111561
Buggy source:
public void setScaledSize(){
  if (!cc.options.autoScale && !cc.options.fixedRatioScale) {
    scaledWidth=(int)Math.floor((float)cc.cp.width * (float)cc.scaleFactor / 100.0);
    scaledHeight=(int)Math.floor((float)cc.cp.height * (float)cc.scaleFactor / 100.0);
  }
 else {
    if (cc.viewport == null) {
      scaledWidth=cc.cp.width;
      scaledHeight=cc.cp.height;
    }
 else {
      Dimension availableSize=cc.viewport.sp.getSize();
      if (availableSize.width == 0 || availableSize.height == 0)       availableSize=new Dimension(cc.cp.width,cc.cp.height);
      if (cc.options.fixedRatioScale) {
        float widthRatio=(float)availableSize.width / (float)cc.cp.width;
        float heightRatio=(float)availableSize.height / (float)cc.cp.height;
        float ratio=Math.min(widthRatio,heightRatio);
        scaledWidth=(int)Math.floor(cc.cp.width * ratio);
        scaledHeight=(int)Math.floor(cc.cp.height * ratio);
      }
 else {
        scaledWidth=availableSize.width;
        scaledHeight=availableSize.height;
      }
    }
  }
  scaleWidthRatio=(float)((float)scaledWidth / (float)cc.cp.width);
  scaleHeightRatio=(float)((float)scaledHeight / (float)cc.cp.height);
}

Fixed version (ground truth):
public void setScaledSize(){
  if (!cc.options.autoScale && !cc.options.fixedRatioScale) {
    scaledWidth=(int)Math.floor((float)cc.cp.width * (float)cc.scaleFactor / 100.0);
    scaledHeight=(int)Math.floor((float)cc.cp.height * (float)cc.scaleFactor / 100.0);
  }
 else {
    if (cc.viewport == null) {
      scaledWidth=cc.cp.width;
      scaledHeight=cc.cp.height;
    }
 else {
      Dimension availableSize=cc.viewport.sp.getSize();
      if (availableSize.width == 0 || availableSize.height == 0)       availableSize=new Dimension(cc.cp.width,cc.cp.height);
      if (cc.options.fixedRatioScale) {
        float widthRatio=(float)availableSize.width / (float)cc.cp.width;
        float heightRatio=(float)availableSize.height / (float)cc.cp.height;
        float ratio=Math.min(widthRatio,heightRatio);
        scaledWidth=(int)Math.floor(cc.cp.width * ratio);
        scaledHeight=(int)Math.floor(cc.cp.height * ratio);
      }
 else {
        scaledWidth=availableSize.width;
        scaledHeight=availableSize.height;
      }
    }
  }
  scaleWidthRatio=(float)scaledWidth / (float)cc.cp.width;
  scaleHeightRatio=(float)scaledHeight / (float)cc.cp.height;
}
Program: 111563
Project: 111563
Buggy source:
public void serverCutText(String str,int len){
  setContents(str);
  Clipboard cb=Toolkit.getDefaultToolkit().getSystemClipboard();
  if (cb != null) {
    StringSelection ss=new StringSelection(str);
    try {
      cb.setContents(ss,ss);
    }
 catch (    Exception e) {
      vlog.debug(e.toString());
    }
  }
}

Fixed version (ground truth):
public void serverCutText(String str,int len){
  setContents(str);
  Clipboard cb=null;
  if (!cc.viewer.applet)   cb=Toolkit.getDefaultToolkit().getSystemClipboard();
  if (cb != null) {
    StringSelection ss=new StringSelection(str);
    try {
      cb.setContents(ss,ss);
    }
 catch (    Exception e) {
      vlog.debug(e.toString());
    }
  }
}
Program: 111564
Project: 111564
Buggy source:
public void actionPerformed(ActionEvent e){
  Object s=e.getSource();
  if (s instanceof JButton && (JButton)s == okButton) {
    ok=true;
    if (cb != null)     cb.getOptions();
    endDialog();
  }
 else   if (s instanceof JButton && (JButton)s == cancelButton) {
    ok=false;
    endDialog();
  }
 else   if (s instanceof JButton && (JButton)s == defSaveButton) {
    try {
      defaults.Save();
    }
 catch (    java.lang.Exception x) {
    }
  }
 else   if (s instanceof JButton && (JButton)s == ca) {
    JFileChooser fc=new JFileChooser();
    fc.setDialogTitle("String_Node_Str");
    int ret=fc.showOpenDialog(this);
    if (ret == JFileChooser.APPROVE_OPTION)     CSecurityTLS.x509ca.setParam(fc.getSelectedFile().toString());
  }
 else   if (s instanceof JButton && (JButton)s == crl) {
    JFileChooser fc=new JFileChooser();
    fc.setDialogTitle("String_Node_Str");
    int ret=fc.showOpenDialog(this);
    if (ret == JFileChooser.APPROVE_OPTION)     CSecurityTLS.x509crl.setParam(fc.getSelectedFile().toString());
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  Object s=e.getSource();
  if (s instanceof JButton && (JButton)s == okButton) {
    ok=true;
    if (cb != null)     cb.getOptions();
    endDialog();
  }
 else   if (s instanceof JButton && (JButton)s == cancelButton) {
    ok=false;
    endDialog();
  }
 else   if (s instanceof JButton && (JButton)s == defSaveButton) {
    try {
      if (!applet)       defaults.Save();
    }
 catch (    java.lang.Exception x) {
    }
  }
 else   if (s instanceof JButton && (JButton)s == ca) {
    JFileChooser fc=new JFileChooser();
    fc.setDialogTitle("String_Node_Str");
    int ret=fc.showOpenDialog(this);
    if (ret == JFileChooser.APPROVE_OPTION)     CSecurityTLS.x509ca.setParam(fc.getSelectedFile().toString());
  }
 else   if (s instanceof JButton && (JButton)s == crl) {
    JFileChooser fc=new JFileChooser();
    fc.setDialogTitle("String_Node_Str");
    int ret=fc.showOpenDialog(this);
    if (ret == JFileChooser.APPROVE_OPTION)     CSecurityTLS.x509crl.setParam(fc.getSelectedFile().toString());
  }
}
Program: 111567
Project: 111567
Buggy source:
public void endDialog(){
  if (ok) {
    options.defaults.setPref("String_Node_Str",(encryption.getSelectedIndex() == 1) ? "String_Node_Str" : "String_Node_Str");
    if (!server.getSelectedItem().toString().equals("String_Node_Str")) {
      String t=(options.defaults.getString("String_Node_Str") == null) ? "String_Node_Str" : options.defaults.getString("String_Node_Str");
      StringTokenizer st=new StringTokenizer(t,"String_Node_Str");
      StringBuffer sb=new StringBuffer().append((String)server.getSelectedItem());
      while (st.hasMoreTokens()) {
        String s=st.nextToken();
        if (!s.equals((String)server.getSelectedItem()) && !s.equals("String_Node_Str")) {
          sb.append(',');
          sb.append(s);
        }
      }
      options.defaults.setPref("String_Node_Str",sb.toString());
    }
    try {
      options.defaults.Save();
    }
 catch (    java.lang.Exception x) {
    }
  }
  done=true;
  if (modal) {
synchronized (this) {
      notify();
    }
  }
  this.dispose();
}

Fixed version (ground truth):
public void endDialog(){
  if (ok && !cc.viewer.applet) {
    options.defaults.setPref("String_Node_Str",(encryption.getSelectedIndex() == 1) ? "String_Node_Str" : "String_Node_Str");
    if (!server.getSelectedItem().toString().equals("String_Node_Str")) {
      String t=(options.defaults.getString("String_Node_Str") == null) ? "String_Node_Str" : options.defaults.getString("String_Node_Str");
      StringTokenizer st=new StringTokenizer(t,"String_Node_Str");
      StringBuffer sb=new StringBuffer().append((String)server.getSelectedItem());
      while (st.hasMoreTokens()) {
        String s=st.nextToken();
        if (!s.equals((String)server.getSelectedItem()) && !s.equals("String_Node_Str")) {
          sb.append(',');
          sb.append(s);
        }
      }
      options.defaults.setPref("String_Node_Str",sb.toString());
    }
    try {
      options.defaults.Save();
    }
 catch (    java.lang.Exception x) {
    }
  }
  done=true;
  if (modal) {
synchronized (this) {
      notify();
    }
  }
  this.dispose();
}
Program: 111568
Project: 111568
Buggy source:
public void init(){
  vlog.debug("String_Node_Str");
  setBackground(Color.white);
  logo=getImage(getDocumentBase(),"String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  vlog.debug("String_Node_Str");
  setBackground(Color.white);
  ClassLoader cl=this.getClass().getClassLoader();
  ImageIcon icon=new ImageIcon(cl.getResource("String_Node_Str"));
  logo=icon.getImage();
}
Program: 111569
Project: 111569
Buggy source:
public static void setDefaults(){
  String homeDir=null;
  if ((homeDir=UserPrefs.getHomeDir()) == null) {
    vlog.error("String_Node_Str");
    return;
  }
  String vnchomedir=homeDir + UserPrefs.getFileSeperator() + "String_Node_Str"+ UserPrefs.getFileSeperator();
  String caDefault=new String(vnchomedir + "String_Node_Str");
  String crlDefault=new String(vnchomedir + "String_Node_Str");
  if (new File(caDefault).exists())   x509ca.setDefaultStr(caDefault);
  if (new File(crlDefault).exists())   x509crl.setDefaultStr(crlDefault);
}

Fixed version (ground truth):
public static void setDefaults(){
  String homeDir=null;
  if ((homeDir=UserPrefs.getHomeDir()) == null) {
    vlog.error("String_Node_Str");
    return;
  }
  String vnchomedir=homeDir + UserPrefs.getFileSeparator() + "String_Node_Str"+ UserPrefs.getFileSeparator();
  String caDefault=new String(vnchomedir + "String_Node_Str");
  String crlDefault=new String(vnchomedir + "String_Node_Str");
  if (new File(caDefault).exists())   x509ca.setDefaultStr(caDefault);
  if (new File(crlDefault).exists())   x509crl.setDefaultStr(crlDefault);
}
Program: 111570
Project: 111570
Buggy source:
/** 
 * We try to read in a preferences file, from the user's "HOME" directory. We base the name of the file, on the name of the application we are in. Use the getHomeDir() call if you want to know what directory this is in.
 * @param appName_ name of application calling this class
 */
public UserPrefs(String appName_){
  appName=appName_;
  try {
    systemprops=System.getProperties();
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
  prefFile=getHomeDir() + getFileSeperator() + "String_Node_Str"+ appName;
  try {
    load(new java.io.FileInputStream(prefFile));
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception err) {
    if (err instanceof java.io.FileNotFoundException) {
      try {
        store(new FileOutputStream(prefFile),appName + "String_Node_Str");
      }
 catch (      Exception e) {
      }
    }
 else {
      System.out.println("String_Node_Str" + err.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * We try to read in a preferences file, from the user's "HOME" directory. We base the name of the file, on the name of the application we are in. Use the getHomeDir() call if you want to know what directory this is in.
 * @param appName_ name of application calling this class
 */
public UserPrefs(String appName_){
  appName=appName_;
  try {
    systemprops=System.getProperties();
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
  prefFile=getHomeDir() + getFileSeparator() + "String_Node_Str"+ appName;
  try {
    load(new java.io.FileInputStream(prefFile));
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception err) {
    if (err instanceof java.io.FileNotFoundException) {
      try {
        store(new FileOutputStream(prefFile),appName + "String_Node_Str");
      }
 catch (      Exception e) {
      }
    }
 else {
      System.out.println("String_Node_Str" + err.getMessage());
    }
  }
}
Program: 111571
Project: 111571
Buggy source:
final public static String getFileSeperator(){
  String seperator=null;
  try {
    seperator=System.getProperties().get("String_Node_Str").toString();
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
  return seperator;
}

Fixed version (ground truth):
final public static String getFileSeperator(){
  String seperator=null;
  try {
    seperator=(String)System.getProperties().get("String_Node_Str");
  }
 catch (  java.security.AccessControlException e) {
    System.out.println("String_Node_Str");
  }
  return seperator;
}
Program: 111573
Project: 111573
Buggy source:
public void serverCutText(String str,int len){
  setContents(str);
  Clipboard cb=null;
  if (!cc.viewer.applet)   cb=Toolkit.getDefaultToolkit().getSystemClipboard();
  if (cb != null) {
    StringSelection ss=new StringSelection(str);
    try {
      cb.setContents(ss,ss);
    }
 catch (    Exception e) {
      vlog.debug(e.toString());
    }
  }
}

Fixed version (ground truth):
public void serverCutText(String str,int len){
  setContents(str);
  SecurityManager sm=System.getSecurityManager();
  try {
    if (sm != null)     sm.checkSystemClipboardAccess();
    Clipboard cb=Toolkit.getDefaultToolkit().getSystemClipboard();
    if (cb != null) {
      StringSelection ss=new StringSelection(str);
      try {
        cb.setContents(ss,ss);
      }
 catch (      Exception e) {
        vlog.debug(e.toString());
      }
    }
  }
 catch (  SecurityException e) {
    System.err.println("String_Node_Str");
  }
}