Program: 56231
Project: 56231
Buggy source:
@Override protected void paintInternal(GC gc,Device device){
  if (this.parentNode != null) {
    gc.drawLine(this.rect.x + (rect.width / 2),this.rect.y + (this.rect.height - TEXTBOXHEIGHT) / 2,this.parentNode.getX() + (this.parentNode.getWidth() / 2),this.parentNode.getY() + this.parentNode.getHeight());
  }
  if (this.networkNode.isLeafNode()) {
    if (LEAFNODEIMAGE != null) {
      final int destHeight=(int)((float)LEAFNODEIMAGERECT.height * imageScaleFactor);
      final int destWidth=(int)((float)LEAFNODEIMAGERECT.width * imageScaleFactor);
      final int destX=this.rect.x + (this.rect.width - destWidth) / 2;
      final int destY=this.rect.y + ((this.rect.height - TEXTBOXHEIGHT) - destHeight) / 2;
      gc.drawImage(LEAFNODEIMAGE,LEAFNODEIMAGERECT.x,LEAFNODEIMAGERECT.y,LEAFNODEIMAGERECT.width,LEAFNODEIMAGERECT.height,destX,destY,destWidth,destHeight);
    }
  }
 else {
    if (NODEIMAGE != null) {
      final int destHeight=(int)((float)NODEIMAGERECT.height * imageScaleFactor);
      final int destWidth=(int)((float)NODEIMAGERECT.width * imageScaleFactor);
      final int destX=this.rect.x + (this.rect.width - destWidth) / 2;
      final int destY=this.rect.y + ((this.rect.height - TEXTBOXHEIGHT) - destHeight) / 2;
      gc.drawImage(NODEIMAGE,NODEIMAGERECT.x,NODEIMAGERECT.y,NODEIMAGERECT.width,NODEIMAGERECT.height,destX,destY,destWidth,destHeight);
    }
  }
  String name=this.networkNode.getName();
  Point pt=gc.textExtent(name);
  boolean cropped=false;
  while (pt.x > this.rect.width) {
    cropped=true;
    name=name.substring(0,name.length() - 1);
    pt=gc.textExtent(name + "String_Node_Str");
  }
  if (cropped) {
    name+="String_Node_Str";
  }
  gc.setBackground(ColorScheme.getNetworkNodeBackgroundColor(device));
  gc.fillRectangle(this.rect.x + (this.rect.width - pt.x) / 2 - TEXTBOXSPACING,this.rect.y + this.rect.height - TEXTBOXHEIGHT,pt.x + (2 * TEXTBOXSPACING),TEXTBOXHEIGHT);
  gc.setForeground(ColorScheme.getNetworkNodeBorderColor(device));
  gc.drawRectangle(this.rect.x + (this.rect.width - pt.x) / 2 - TEXTBOXSPACING,this.rect.y + this.rect.height - TEXTBOXHEIGHT,pt.x + (2 * TEXTBOXSPACING),TEXTBOXHEIGHT);
  gc.setForeground(ColorScheme.getNetworkNodeBorderColor(device));
  final int textX=this.rect.x + ((this.rect.width - pt.x) / 2);
  final int textY=this.rect.y + this.rect.height - TEXTBOXHEIGHT + ((TEXTBOXHEIGHT - pt.y) / 2);
  gc.drawText(name,textX,textY);
}

Fixed version (ground truth):
@Override protected void paintInternal(GC gc,Device device){
  if (this.parentNode != null) {
    gc.drawLine(this.rect.x + (rect.width / 2),this.rect.y + (this.rect.height - TEXTBOXHEIGHT) / 2,this.parentNode.getX() + (this.parentNode.getWidth() / 2),this.parentNode.getY() + this.parentNode.getHeight());
  }
  if (this.networkNode.isLeafNode()) {
    if (this.leafNodeImage != null) {
      final int destHeight=(int)((float)this.leafNodeImageRect.height * imageScaleFactor);
      final int destWidth=(int)((float)this.leafNodeImageRect.width * imageScaleFactor);
      final int destX=this.rect.x + (this.rect.width - destWidth) / 2;
      final int destY=this.rect.y + ((this.rect.height - TEXTBOXHEIGHT) - destHeight) / 2;
      gc.drawImage(this.leafNodeImage,this.leafNodeImageRect.x,this.leafNodeImageRect.y,this.leafNodeImageRect.width,this.leafNodeImageRect.height,destX,destY,destWidth,destHeight);
    }
  }
 else {
    if (this.nodeImage != null) {
      final int destHeight=(int)((float)this.nodeImageRect.height * imageScaleFactor);
      final int destWidth=(int)((float)this.nodeImageRect.width * imageScaleFactor);
      final int destX=this.rect.x + (this.rect.width - destWidth) / 2;
      final int destY=this.rect.y + ((this.rect.height - TEXTBOXHEIGHT) - destHeight) / 2;
      gc.drawImage(this.nodeImage,this.nodeImageRect.x,this.nodeImageRect.y,this.nodeImageRect.width,this.nodeImageRect.height,destX,destY,destWidth,destHeight);
    }
  }
  String name=this.networkNode.getName();
  Point pt=gc.textExtent(name);
  boolean cropped=false;
  while (pt.x > this.rect.width) {
    cropped=true;
    name=name.substring(0,name.length() - 1);
    pt=gc.textExtent(name + "String_Node_Str");
  }
  if (cropped) {
    name+="String_Node_Str";
  }
  gc.setBackground(ColorScheme.getNetworkNodeBackgroundColor(device));
  gc.fillRectangle(this.rect.x + (this.rect.width - pt.x) / 2 - TEXTBOXSPACING,this.rect.y + this.rect.height - TEXTBOXHEIGHT,pt.x + (2 * TEXTBOXSPACING),TEXTBOXHEIGHT);
  gc.setForeground(ColorScheme.getNetworkNodeBorderColor(device));
  gc.drawRectangle(this.rect.x + (this.rect.width - pt.x) / 2 - TEXTBOXSPACING,this.rect.y + this.rect.height - TEXTBOXHEIGHT,pt.x + (2 * TEXTBOXSPACING),TEXTBOXHEIGHT);
  gc.setForeground(ColorScheme.getNetworkNodeBorderColor(device));
  final int textX=this.rect.x + ((this.rect.width - pt.x) / 2);
  final int textY=this.rect.y + this.rect.height - TEXTBOXHEIGHT + ((TEXTBOXHEIGHT - pt.y) / 2);
  gc.drawText(name,textX,textY);
}