Program: 72826
Project: 72826
Buggy source:
/** 
 * Render a visual representation of the given node. If the StringAttribute _color of the node is set then use that color to highlight the node. If the StringAttribute _explanation of the node is set then use it to set the tooltip.
 * @see diva.graph.NodeRenderer#render(java.lang.Object)
 */
public Figure render(Object n){
  Locatable location=(Locatable)n;
  final NamedObj object=location.getContainer();
  Figure result=null;
  try {
    List iconList=object.attributeList(EditorIcon.class);
    if (iconList.size() == 0) {
      XMLIcon alreadyCreated=(XMLIcon)_iconsPendingContainer.get(object);
      if (alreadyCreated != null) {
        iconList.add(alreadyCreated);
      }
    }
    if (iconList.size() == 0) {
      final EditorIcon icon=XMLIcon.getXMLIcon(object.workspace(),"String_Node_Str");
      icon.setContainerToBe(object);
      icon.setPersistent(false);
      result=icon.createFigure();
      _iconsPendingContainer.put(object,icon);
      GraphController controller=IconController.this.getController();
      GraphModel graphModel=controller.getGraphModel();
      ChangeRequest request=new ChangeRequest(graphModel,"String_Node_Str"){
        protected void _execute() throws KernelException {
          _iconsPendingContainer.remove(object);
          if (icon.getContainer() != null) {
            return;
          }
          if (object.getAttribute("String_Node_Str") != null) {
            return;
          }
          icon.setContainer(object);
        }
      }
;
      request.setPersistent(false);
      object.requestChange(request);
    }
 else     if (iconList.size() >= 1) {
      EditorIcon icon=(EditorIcon)iconList.get(iconList.size() - 1);
      result=icon.createFigure();
    }
  }
 catch (  KernelException ex) {
    throw new InternalErrorException(null,ex,"String_Node_Str" + "String_Node_Str" + object + "String_Node_Str"+ "String_Node_Str");
  }
  if (result == null) {
    throw new InternalErrorException("String_Node_Str");
  }
 else {
    result.setToolTipText(object.getClassName());
  }
  try {
    StringAttribute colorAttr=(StringAttribute)object.getAttribute("String_Node_Str",StringAttribute.class);
    if (colorAttr != null) {
      String color=colorAttr.getExpression();
      AnimationRenderer animationRenderer=new AnimationRenderer(SVGUtilities.getColor(color));
      animationRenderer.renderSelected(result);
    }
  }
 catch (  IllegalActionException e) {
  }
  AttributeController.renderHighlight(object,result);
  try {
    Attribute highlightColor=object.getAttribute("String_Node_Str");
    if (highlightColor != null) {
      object.removeAttribute(highlightColor);
      object.validateSettables();
    }
    List<Decorator> decorators=new ArrayList();
    decorators.addAll(object.decorators());
    for (    Decorator decorator : decorators) {
      DecoratorAttributes decoratorAttributes=object.getDecoratorAttributes(decorator);
      if (decoratorAttributes instanceof ExecutionAttributes) {
        if (decoratorAttributes.getDecorator() != null && ((ExecutionAttributes)decoratorAttributes).enabled()) {
          try {
            if (object.getAttribute("String_Node_Str") == null) {
              highlightColor=new ColorAttribute(object,"String_Node_Str");
              Attribute attribute=((NamedObj)decorator).getAttribute("String_Node_Str");
              String colorExpression="String_Node_Str";
              if (attribute != null) {
                colorExpression=(((ColorAttribute)attribute).getToken()).toString();
              }
              ((ColorAttribute)highlightColor).setExpression(colorExpression);
            }
          }
 catch (          NameDuplicationException e) {
          }
        }
      }
    }
  }
 catch (  IllegalActionException e1) {
    e1.printStackTrace();
  }
  AttributeController.renderDecoratorHighlight(object,result);
  try {
    ColorAttribute shadowAttribute=(ColorAttribute)object.getAttribute("String_Node_Str",ColorAttribute.class);
    if (shadowAttribute != null) {
      if (!shadowAttribute.getExpression().trim().equals("String_Node_Str")) {
        Color color=shadowAttribute.asColor();
        ShadowRenderer animationRenderer=new ShadowRenderer(color);
        animationRenderer.renderSelected(result);
      }
    }
 else     if (object instanceof Entity) {
      NamedObj container=object.getContainer();
      if (container != null) {
        shadowAttribute=(ColorAttribute)container.getAttribute("String_Node_Str",ColorAttribute.class);
        if (shadowAttribute != null && !shadowAttribute.getExpression().trim().equals("String_Node_Str")) {
          Color color=shadowAttribute.asColor();
          ShadowRenderer animationRenderer=new ShadowRenderer(color);
          animationRenderer.renderSelected(result);
        }
      }
    }
  }
 catch (  IllegalActionException e) {
  }
  try {
    StringAttribute explanationAttribute=(StringAttribute)object.getAttribute("String_Node_Str",StringAttribute.class);
    if (explanationAttribute != null) {
      result.setToolTipText(explanationAttribute.getExpression());
    }
  }
 catch (  IllegalActionException e) {
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Render a visual representation of the given node. If the StringAttribute _color of the node is set then use that color to highlight the node. If the StringAttribute _explanation of the node is set then use it to set the tooltip.
 * @see diva.graph.NodeRenderer#render(java.lang.Object)
 */
public Figure render(Object n){
  Locatable location=(Locatable)n;
  final NamedObj object=location.getContainer();
  Figure result=null;
  try {
    List iconList=object.attributeList(EditorIcon.class);
    if (iconList.size() == 0) {
      XMLIcon alreadyCreated=(XMLIcon)_iconsPendingContainer.get(object);
      if (alreadyCreated != null) {
        iconList.add(alreadyCreated);
      }
    }
    if (iconList.size() == 0) {
      final EditorIcon icon=XMLIcon.getXMLIcon(object.workspace(),"String_Node_Str");
      icon.setContainerToBe(object);
      icon.setPersistent(false);
      result=icon.createFigure();
      _iconsPendingContainer.put(object,icon);
      GraphController controller=IconController.this.getController();
      GraphModel graphModel=controller.getGraphModel();
      ChangeRequest request=new ChangeRequest(graphModel,"String_Node_Str"){
        protected void _execute() throws KernelException {
          _iconsPendingContainer.remove(object);
          if (icon.getContainer() != null) {
            return;
          }
          if (object.getAttribute("String_Node_Str") != null) {
            return;
          }
          icon.setContainer(object);
        }
      }
;
      request.setPersistent(false);
      object.requestChange(request);
    }
 else     if (iconList.size() >= 1) {
      EditorIcon icon=(EditorIcon)iconList.get(iconList.size() - 1);
      result=icon.createFigure();
    }
  }
 catch (  KernelException ex) {
    throw new InternalErrorException(null,ex,"String_Node_Str" + "String_Node_Str" + object + "String_Node_Str"+ "String_Node_Str");
  }
  if (result == null) {
    throw new InternalErrorException("String_Node_Str");
  }
 else {
    result.setToolTipText(object.getClassName());
  }
  try {
    StringAttribute colorAttr=(StringAttribute)object.getAttribute("String_Node_Str",StringAttribute.class);
    if (colorAttr != null) {
      String color=colorAttr.getExpression();
      AnimationRenderer animationRenderer=new AnimationRenderer(SVGUtilities.getColor(color));
      animationRenderer.renderSelected(result);
    }
  }
 catch (  IllegalActionException e) {
  }
  AttributeController.renderHighlight(object,result);
  try {
    Attribute highlightColor=object.getAttribute("String_Node_Str");
    if (highlightColor != null) {
      object.removeAttribute(highlightColor);
    }
    List<Decorator> decorators=new ArrayList();
    decorators.addAll(object.decorators());
    for (    Decorator decorator : decorators) {
      DecoratorAttributes decoratorAttributes=object.getDecoratorAttributes(decorator);
      if (decoratorAttributes instanceof ExecutionAttributes) {
        if (decoratorAttributes.getDecorator() != null && ((ExecutionAttributes)decoratorAttributes).enabled()) {
          try {
            if (object.getAttribute("String_Node_Str") == null) {
              highlightColor=new ColorAttribute(object,"String_Node_Str");
              Attribute attribute=((NamedObj)decorator).getAttribute("String_Node_Str");
              String colorExpression="String_Node_Str";
              if (attribute != null) {
                colorExpression=(((ColorAttribute)attribute).getToken()).toString();
              }
              ((ColorAttribute)highlightColor).setExpression(colorExpression);
            }
          }
 catch (          NameDuplicationException e) {
          }
        }
      }
    }
  }
 catch (  IllegalActionException e1) {
    e1.printStackTrace();
  }
  AttributeController.renderDecoratorHighlight(object,result);
  try {
    ColorAttribute shadowAttribute=(ColorAttribute)object.getAttribute("String_Node_Str",ColorAttribute.class);
    if (shadowAttribute != null) {
      if (!shadowAttribute.getExpression().trim().equals("String_Node_Str")) {
        Color color=shadowAttribute.asColor();
        ShadowRenderer animationRenderer=new ShadowRenderer(color);
        animationRenderer.renderSelected(result);
      }
    }
 else     if (object instanceof Entity) {
      NamedObj container=object.getContainer();
      if (container != null) {
        shadowAttribute=(ColorAttribute)container.getAttribute("String_Node_Str",ColorAttribute.class);
        if (shadowAttribute != null && !shadowAttribute.getExpression().trim().equals("String_Node_Str")) {
          Color color=shadowAttribute.asColor();
          ShadowRenderer animationRenderer=new ShadowRenderer(color);
          animationRenderer.renderSelected(result);
        }
      }
    }
  }
 catch (  IllegalActionException e) {
  }
  try {
    StringAttribute explanationAttribute=(StringAttribute)object.getAttribute("String_Node_Str",StringAttribute.class);
    if (explanationAttribute != null) {
      result.setToolTipText(explanationAttribute.getExpression());
    }
  }
 catch (  IllegalActionException e) {
  }
  return result;
}