Program: 60183
Project: 60183
Buggy source:
/** 
 * Gets the event function.
 * @param varValue the var value
 * @param attributeName the attribute name
 * @return the event function
 */
public Function getEventFunction(Function varValue,String attributeName){
  if (varValue != null) {
    return varValue;
  }
  String normalAttributeName=this.normalizeAttributeName(attributeName);
synchronized (this) {
    Map<String,Function> fba=this.functionByAttribute;
    Function f=fba == null ? null : (Function)fba.get(normalAttributeName);
    if (f != null) {
      return f;
    }
    UserAgentContext uac=this.getUserAgentContext();
    if (uac == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (uac.isScriptingEnabled()) {
      String attributeValue=this.getAttribute(attributeName);
      if ((attributeValue == null) || (attributeValue.length() == 0)) {
        f=null;
      }
 else {
        String functionCode="String_Node_Str" + normalAttributeName + "String_Node_Str"+ System.identityHashCode(this)+ "String_Node_Str"+ attributeValue+ "String_Node_Str";
        Document doc=this.document;
        if (doc == null) {
          throw new IllegalStateException("String_Node_Str");
        }
        Context ctx=Executor.createContext(this.getDocumentURL(),uac);
        try {
          Scriptable scope=(Scriptable)doc.getUserData(Executor.SCOPE_KEY);
          if (scope == null) {
            throw new IllegalStateException("String_Node_Str" + Executor.SCOPE_KEY);
          }
          Scriptable thisScope=(Scriptable)JavaScript.getInstance().getJavascriptObject(this,scope);
          try {
            f=ctx.compileFunction(thisScope,functionCode,this.getTagName() + "String_Node_Str" + this.getId()+ "String_Node_Str"+ attributeName,1,null);
          }
 catch (          EcmaError ecmaError) {
            logger.log(Level.WARNING,"String_Node_Str" + ecmaError.sourceName() + "String_Node_Str"+ ecmaError.lineNumber()+ "String_Node_Str"+ ecmaError.getMessage(),ecmaError);
            f=null;
          }
catch (          Throwable err) {
            logger.log(Level.WARNING,"String_Node_Str",err);
            f=null;
          }
        }
  finally {
          Context.exit();
        }
      }
      if (fba == null) {
        fba=new HashMap<String,Function>(1);
        this.functionByAttribute=fba;
      }
      fba.put(normalAttributeName,f);
    }
    return f;
  }
}

Fixed version (ground truth):
/** 
 * Gets the event function.
 * @param varValue the var value
 * @param attributeName the attribute name
 * @return the event function
 */
public Function getEventFunction(Function varValue,String attributeName){
  if (varValue != null) {
    return varValue;
  }
  String normalAttributeName=this.normalizeAttributeName(attributeName);
synchronized (this) {
    Map<String,Function> fba=this.functionByAttribute;
    Function f=fba == null ? null : (Function)fba.get(normalAttributeName);
    if (f != null) {
      return f;
    }
    UserAgentContext uac=this.getUserAgentContext();
    if (uac == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (uac.isScriptingEnabled()) {
      String attributeValue=this.getAttribute(attributeName);
      if ((attributeValue == null) || (attributeValue.length() == 0)) {
        f=null;
      }
 else {
        String functionCode="String_Node_Str" + normalAttributeName + "String_Node_Str"+ System.identityHashCode(this)+ "String_Node_Str"+ attributeValue+ "String_Node_Str";
        Document doc=this.document;
        if (doc == null) {
          throw new IllegalStateException("String_Node_Str");
        }
        Context ctx=Executor.createContext(this.getDocumentURL(),uac);
        try {
          Scriptable scope=(Scriptable)doc.getUserData(Executor.SCOPE_KEY);
          if (scope == null) {
            throw new IllegalStateException("String_Node_Str" + Executor.SCOPE_KEY);
          }
          Scriptable thisScope=(Scriptable)JavaScript.getInstance().getJavascriptObject(this,scope);
          try {
            f=ctx.compileFunction(thisScope,functionCode,this.getTagName() + "String_Node_Str" + this.getId()+ "String_Node_Str"+ attributeName,1,null);
          }
 catch (          EcmaError ecmaError) {
            logger.log(Level.WARNING,"String_Node_Str" + ecmaError.sourceName() + "String_Node_Str"+ ecmaError.lineNumber()+ "String_Node_Str"+ ecmaError.getMessage(),ecmaError);
            f=null;
          }
catch (          Exception err) {
            logger.log(Level.WARNING,"String_Node_Str",err);
            f=null;
          }
        }
  finally {
          Context.exit();
        }
      }
      if (fba == null) {
        fba=new HashMap<String,Function>(1);
        this.functionByAttribute=fba;
      }
      fba.put(normalAttributeName,f);
    }
    return f;
  }
}