Program: 29012
Project: 29012
Buggy source:
Object invoke(Class clientInterface,Method method,Object[] args) throws Throwable {
  ClassLoader originalClassLoader=null;
  try {
    container.onEnteringContainer();
    if (Thread.currentThread().getContextClassLoader() != getContainer().getClassLoader()) {
      originalClassLoader=Utility.setContextClassLoader(getContainer().getClassLoader());
    }
    Class methodClass=method.getDeclaringClass();
    if (methodClass == java.lang.Object.class) {
      return InvocationHandlerUtil.invokeJavaObjectMethod(this,method,args);
    }
 else     if (methodClass == IndirectlySerializable.class) {
      return this.getSerializableObjectFactory();
    }
    InvocationInfo invInfo=(InvocationInfo)invocationInfoMap_.get(method,((args != null) ? args.length : 0));
    if (invInfo == null) {
      throw new IllegalStateException("String_Node_Str" + method);
    }
    if ((methodClass == javax.ejb.EJBLocalObject.class) || invInfo.ejbIntfOverride) {
      return invokeEJBLocalObjectMethod(method.getName(),args);
    }
 else     if (invInfo.targetMethod1 == null) {
      Object[] params=new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()};
      logger.log(Level.SEVERE,"String_Node_Str",params);
      String errorMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str",params);
      throw new EJBException(errorMsg);
    }
    Object returnValue=null;
    EjbInvocation inv=container.createEjbInvocation();
    inv.isLocal=true;
    inv.isBusinessInterface=!isLocalHomeView();
    inv.isHome=false;
    inv.ejbObject=this;
    inv.method=method;
    inv.methodParams=args;
    inv.clientInterface=clientInterface;
    inv.transactionAttribute=invInfo.txAttr;
    inv.securityPermissions=invInfo.securityPermissions;
    inv.invocationInfo=invInfo;
    inv.beanMethod=invInfo.targetMethod1;
    try {
      container.preInvoke(inv);
      returnValue=container.intercept(inv);
    }
 catch (    InvocationTargetException ite) {
      inv.exception=ite.getCause();
      inv.exceptionFromBeanMethod=inv.exception;
    }
catch (    Throwable t) {
      inv.exception=t;
    }
 finally {
      container.postInvoke(inv);
    }
    if (inv.exception != null) {
      InvocationHandlerUtil.throwLocalException(inv.exception,method.getExceptionTypes());
    }
    return returnValue;
  }
  finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
    container.onLeavingContainer();
  }
}

Fixed version (ground truth):
Object invoke(Class clientInterface,Method method,Object[] args) throws Throwable {
  ClassLoader originalClassLoader=null;
  try {
    container.onEnteringContainer();
    if (Thread.currentThread().getContextClassLoader() != getContainer().getClassLoader()) {
      originalClassLoader=Utility.setContextClassLoader(getContainer().getClassLoader());
    }
    Class methodClass=method.getDeclaringClass();
    if (methodClass == java.lang.Object.class) {
      return InvocationHandlerUtil.invokeJavaObjectMethod(this,method,args);
    }
 else     if (methodClass == IndirectlySerializable.class) {
      return this.getSerializableObjectFactory();
    }
    InvocationInfo invInfo=(InvocationInfo)invocationInfoMap_.get(method,((args != null) ? args.length : 0));
    if (invInfo == null) {
      throw new IllegalStateException("String_Node_Str" + method);
    }
    if ((methodClass == javax.ejb.EJBLocalObject.class) || invInfo.ejbIntfOverride) {
      return invokeEJBLocalObjectMethod(method.getName(),args);
    }
 else     if (invInfo.targetMethod1 == null) {
      Object[] params=new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()};
      logger.log(Level.SEVERE,"String_Node_Str",params);
      String errorMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str",params);
      throw new EJBException(errorMsg);
    }
    Object returnValue=null;
    EjbInvocation inv=container.createEjbInvocation();
    inv.isLocal=true;
    inv.isBusinessInterface=!isLocalHomeView();
    inv.isHome=false;
    inv.ejbObject=this;
    inv.method=method;
    inv.methodParams=args;
    inv.clientInterface=clientInterface;
    inv.transactionAttribute=invInfo.txAttr;
    inv.invocationInfo=invInfo;
    inv.beanMethod=invInfo.targetMethod1;
    try {
      container.preInvoke(inv);
      returnValue=container.intercept(inv);
    }
 catch (    InvocationTargetException ite) {
      inv.exception=ite.getCause();
      inv.exceptionFromBeanMethod=inv.exception;
    }
catch (    Throwable t) {
      inv.exception=t;
    }
 finally {
      container.postInvoke(inv);
    }
    if (inv.exception != null) {
      InvocationHandlerUtil.throwLocalException(inv.exception,method.getExceptionTypes());
    }
    return returnValue;
  }
  finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
    container.onLeavingContainer();
  }
}