Program: 78758
Project: 78758
Buggy source:
public String getImageMap(){
  Map triggerMap=getTriggers();
  if (triggerMap == null || triggerMap.size() == 0) {
    return null;
  }
  StringBuffer sb=new StringBuffer();
  List al=(List)triggerMap.get(TriggerCondition.ONFOCUS_LITERAL);
  if (al != null) {
    for (int i=al.size() - 1; i >= 0; i--) {
      ShapedAction sa=(ShapedAction)al.get(i);
      Action ac=sa.getAction();
      String coords=shape2polyCoords(sa.getShape());
      if (coords != null) {
        if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
            URLValue uv=(URLValue)ac.getValue();
          sb.append("String_Node_Str");
        sb.append("String_Node_Str");
      sb.append(eval(uv.getBaseUrl()));
    sb.append("String_Node_Str");
  sb.append(coords).append("String_Node_Str");
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
sb.append("String_Node_Str");
sb.append(eval(sv.getScript()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONBLUR_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
URLValue uv=(URLValue)ac.getValue();
sb.append("String_Node_Str");
sb.append("String_Node_Str");
sb.append(eval(uv.getBaseUrl()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
sb.append("String_Node_Str");
sb.append(eval(sv.getScript()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONCLICK_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
URLValue uv=(URLValue)ac.getValue();
sb.append("String_Node_Str");
sb.append(eval(uv.getBaseUrl()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
sb.append("String_Node_Str");
sb.append(eval(sv.getScript()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONMOUSEOVER_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
break;
case ActionType.SHOW_TOOLTIP:
TooltipValue tv=(TooltipValue)ac.getValue();
sb.append("String_Node_Str");
sb.append(eval(tv.getText()));
sb.append("String_Node_Str");
sb.append(coords).append("String_Node_Str");
break;
case ActionType.INVOKE_SCRIPT:
break;
}
}
 else {
}
}
}
}
return sb.toString();
}

Fixed version (ground truth):
public String getImageMap(){
  Map triggerMap=getTriggers();
  if (triggerMap == null || triggerMap.size() == 0) {
    return null;
  }
  StringBuffer sb=new StringBuffer();
  List al=(List)triggerMap.get(TriggerCondition.ONFOCUS_LITERAL);
  if (al != null) {
    for (int i=al.size() - 1; i >= 0; i--) {
      HTMLTag tag=new HTMLTag("String_Node_Str");
      ShapedAction sa=(ShapedAction)al.get(i);
      Action ac=sa.getAction();
      String coords=shape2polyCoords(sa.getShape());
      if (coords != null) {
        if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
            URLValue uv=(URLValue)ac.getValue();
          tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
        tag.addAttribute(HTMLAttribute.ONFOCUS,getJsURLRedirect(uv));
      tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
    tag.addAttribute(HTMLAttribute.COORDS,coords);
  sb.append(tag.toString());
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
tag.addAttribute(HTMLAttribute.ONFOCUS,eval(sv.getScript()));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONBLUR_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
HTMLTag tag=new HTMLTag("String_Node_Str");
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
URLValue uv=(URLValue)ac.getValue();
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
tag.addAttribute(HTMLAttribute.ONBLUR,getJsURLRedirect(uv));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
tag.addAttribute(HTMLAttribute.ONBLUR,eval(sv.getScript()));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONCLICK_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
HTMLTag tag=new HTMLTag("String_Node_Str");
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
URLValue uv=(URLValue)ac.getValue();
tag.addAttribute(HTMLAttribute.HREF,eval(uv.getBaseUrl()));
tag.addAttribute(HTMLAttribute.TARGET,eval(uv.getTarget()));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
case ActionType.SHOW_TOOLTIP:
break;
case ActionType.INVOKE_SCRIPT:
ScriptValue sv=(ScriptValue)ac.getValue();
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
tag.addAttribute(HTMLAttribute.ONCLICK,eval(sv.getScript()));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
}
}
 else {
}
}
}
}
al=(List)triggerMap.get(TriggerCondition.ONMOUSEOVER_LITERAL);
if (al != null) {
for (int i=al.size() - 1; i >= 0; i--) {
HTMLTag tag=new HTMLTag("String_Node_Str");
ShapedAction sa=(ShapedAction)al.get(i);
Action ac=sa.getAction();
String coords=shape2polyCoords(sa.getShape());
if (coords != null) {
if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
break;
case ActionType.SHOW_TOOLTIP:
TooltipValue tv=(TooltipValue)ac.getValue();
tag.addAttribute(HTMLAttribute.ALT,eval(tv.getText()));
tag.addAttribute(HTMLAttribute.SHAPE,POLY_SHAPE);
tag.addAttribute(HTMLAttribute.COORDS,coords);
sb.append(tag.toString());
break;
case ActionType.INVOKE_SCRIPT:
break;
}
}
 else {
}
}
}
}
return sb.toString();
}