Program: 78202
Project: 78202
Buggy source:
/** 
 * Add event handling to the hotspot
 */
private void addEventHandling(Element elm,StructureSource src,Trigger[] triggers){
  if (elm != null) {
    for (int x=0; x < triggers.length; x++) {
      Trigger tg=triggers[x];
      String scriptEvent=getJsScriptEvent(tg.getCondition().getValue());
      if (scriptEvent != null) {
switch (tg.getAction().getType().getValue()) {
case ActionType.SHOW_TOOLTIP:
          String tooltipText=((TooltipValue)tg.getAction().getValue()).getText();
        if ((tooltipText != null) && (tooltipText.trim().length() > 0)) {
          Element title=svg_g2d.dom.createElement("String_Node_Str");
          title.appendChild(svg_g2d.dom.createTextNode(tooltipText));
          elm.appendChild(title);
          elm.setAttribute("String_Node_Str","String_Node_Str");
          elm.setAttribute("String_Node_Str","String_Node_Str");
        }
      break;
case ActionType.URL_REDIRECT:
    URLValue urlValue=((URLValue)tg.getAction().getValue());
  if (urlValue.getBaseUrl().startsWith("String_Node_Str")) {
    Element aLink=svg_g2d.createElement("String_Node_Str");
    aLink.setAttribute(scriptEvent,"String_Node_Str" + urlValue.getBaseUrl() + "String_Node_Str");
    aLink.setAttribute("String_Node_Str","String_Node_Str");
    aLink.appendChild(elm);
    elm=aLink;
  }
 else {
    Element aLink=svg_g2d.createElement("String_Node_Str");
    aLink.setAttribute("String_Node_Str",urlValue.getBaseUrl());
    if (urlValue.getTarget() != null)     aLink.setAttribute("String_Node_Str",urlValue.getTarget());
    aLink.appendChild(elm);
    elm=aLink;
  }
break;
case ActionType.TOGGLE_VISIBILITY:
case ActionType.TOGGLE_DATA_POINT_VISIBILITY:
case ActionType.HIGHLIGHT:
addJSCodeOnElement(src,tg,elm,scriptEvent,tg.getAction().getType().getValue());
break;
case ActionType.INVOKE_SCRIPT:
if (tg.getCondition().equals(TriggerCondition.ACCESSIBILITY_LITERAL)) {
AccessibilityValue accessValue=((AccessibilityValue)tg.getAction().getValue());
if (accessValue.getText() != null) {
Element title=svg_g2d.createElement("String_Node_Str");
title.appendChild(svg_g2d.dom.createTextNode(accessValue.getText()));
elm.appendChild(title);
}
if (accessValue.getAccessibility() != null) {
Element description=svg_g2d.createElement("String_Node_Str");
description.appendChild(svg_g2d.dom.createTextNode(accessValue.getAccessibility()));
elm.appendChild(description);
}
}
 else {
String script=((ScriptValue)tg.getAction().getValue()).getScript();
String callbackFunction="String_Node_Str" + Math.abs(script.hashCode()) + "String_Node_Str"+ src.getSource().hashCode()+ "String_Node_Str";
elm.setAttribute(scriptEvent,callbackFunction);
setCursor(elm);
if (!(scripts.contains(script))) {
svg_g2d.addScript("String_Node_Str" + Math.abs(script.hashCode()) + "String_Node_Str"+ "String_Node_Str"+ script+ "String_Node_Str");
scripts.add(script);
}
}
break;
}
}
}
hotspotLayer.appendChild(elm);
}
}

Fixed version (ground truth):
/** 
 * Add event handling to the hotspot
 */
private void addEventHandling(Element elm,StructureSource src,Trigger[] triggers){
  if (elm != null) {
    for (int x=0; x < triggers.length; x++) {
      Trigger tg=triggers[x];
      String scriptEvent=getJsScriptEvent(tg.getCondition().getValue());
      if (scriptEvent != null) {
switch (tg.getAction().getType().getValue()) {
case ActionType.SHOW_TOOLTIP:
          String tooltipText=((TooltipValue)tg.getAction().getValue()).getText();
        if ((tooltipText != null) && (tooltipText.trim().length() > 0)) {
          Element title=svg_g2d.dom.createElement("String_Node_Str");
          title.appendChild(svg_g2d.dom.createTextNode(tooltipText));
          elm.appendChild(title);
          if (scriptEvent.equals("String_Node_Str")) {
            elm.setAttribute("String_Node_Str","String_Node_Str");
            elm.setAttribute("String_Node_Str","String_Node_Str");
          }
 else           elm.setAttribute(scriptEvent,"String_Node_Str");
        }
      break;
case ActionType.URL_REDIRECT:
    URLValue urlValue=((URLValue)tg.getAction().getValue());
  if (urlValue.getBaseUrl().startsWith("String_Node_Str")) {
    Element aLink=svg_g2d.createElement("String_Node_Str");
    aLink.setAttribute(scriptEvent,"String_Node_Str" + urlValue.getBaseUrl() + "String_Node_Str");
    aLink.setAttribute("String_Node_Str","String_Node_Str");
    aLink.appendChild(elm);
    elm=aLink;
  }
 else {
    Element aLink=svg_g2d.createElement("String_Node_Str");
    aLink.setAttribute("String_Node_Str",urlValue.getBaseUrl());
    if (urlValue.getTarget() != null)     aLink.setAttribute("String_Node_Str",urlValue.getTarget());
    aLink.appendChild(elm);
    elm=aLink;
  }
break;
case ActionType.TOGGLE_VISIBILITY:
case ActionType.TOGGLE_DATA_POINT_VISIBILITY:
case ActionType.HIGHLIGHT:
addJSCodeOnElement(src,tg,elm,scriptEvent,tg.getAction().getType().getValue());
break;
case ActionType.INVOKE_SCRIPT:
if (tg.getCondition().equals(TriggerCondition.ACCESSIBILITY_LITERAL)) {
AccessibilityValue accessValue=((AccessibilityValue)tg.getAction().getValue());
if (accessValue.getText() != null) {
Element title=svg_g2d.createElement("String_Node_Str");
title.appendChild(svg_g2d.dom.createTextNode(accessValue.getText()));
elm.appendChild(title);
}
if (accessValue.getAccessibility() != null) {
Element description=svg_g2d.createElement("String_Node_Str");
description.appendChild(svg_g2d.dom.createTextNode(accessValue.getAccessibility()));
elm.appendChild(description);
}
}
 else {
String script=((ScriptValue)tg.getAction().getValue()).getScript();
String callbackFunction="String_Node_Str" + Math.abs(script.hashCode()) + "String_Node_Str"+ src.getSource().hashCode()+ "String_Node_Str";
elm.setAttribute(scriptEvent,callbackFunction);
setCursor(elm);
if (!(scripts.contains(script))) {
svg_g2d.addScript("String_Node_Str" + Math.abs(script.hashCode()) + "String_Node_Str"+ "String_Node_Str"+ script+ "String_Node_Str");
scripts.add(script);
}
}
break;
}
}
}
hotspotLayer.appendChild(elm);
}
}