Program: 111532
Project: 111532
Buggy source:
public Viewport(String name,CConn cc_){
  cc=cc_;
  setTitle(name + "String_Node_Str");
  setFocusable(false);
  setFocusTraversalKeysEnabled(false);
  UIManager.getDefaults().put("String_Node_Str",new UIDefaults.LazyInputMap(new Object[]{}));
  sp=new JScrollPane();
  sp.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
  getContentPane().add(sp);
  addWindowFocusListener(new WindowAdapter(){
    public void windowGainedFocus(    WindowEvent e){
      if (isVisible())       sp.getViewport().getView().requestFocusInWindow();
    }
  }
);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      if (VncViewer.nViewers == 1) {
        cc.viewer.exit(1);
      }
 else {
        cc.close();
      }
    }
  }
);
  addComponentListener(new ComponentAdapter(){
    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 Viewport(String name,CConn cc_){
  cc=cc_;
  setTitle(name + "String_Node_Str");
  setFocusable(false);
  setFocusTraversalKeysEnabled(false);
  UIManager.getDefaults().put("String_Node_Str",new UIDefaults.LazyInputMap(new Object[]{}));
  sp=new JScrollPane();
  sp.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
  getContentPane().add(sp);
  addWindowFocusListener(new WindowAdapter(){
    public void windowGainedFocus(    WindowEvent e){
      if (isVisible())       sp.getViewport().getView().requestFocusInWindow();
    }
  }
);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      if (VncViewer.nViewers == 1) {
        cc.viewer.exit(1);
      }
 else {
        cc.close();
      }
    }
  }
);
  addComponentListener(new ComponentAdapter(){
    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);
      }
    }
  }
);
}