Program: 29010
Project: 29010
Buggy source:
/** 
 * Called by EJBHome proxy.
 */
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  ClassLoader originalClassLoader=null;
  try {
    ((BaseContainer)getContainer()).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 (invokeSpecialEJBHomeMethod(method,methodClass,args)) {
      return null;
    }
    InvocationInfo invInfo=(InvocationInfo)invocationInfoMap_.get(method,((args != null) ? args.length : 0));
    if (invInfo == null) {
      throw new RemoteException("String_Node_Str" + method);
    }
 else     if ((methodClass == javax.ejb.EJBHome.class) || invInfo.ejbIntfOverride) {
      return invokeEJBHomeMethod(method.getName(),args);
    }
 else     if (GenericEJBHome.class.isAssignableFrom(methodClass)) {
      if (method.getName().equals("String_Node_Str")) {
        EJBObjectImpl busObjectImpl=createRemoteBusinessObjectImpl();
        return busObjectImpl.getStub((String)args[0]);
      }
 else {
        EjbAsyncInvocationManager asyncManager=((EjbContainerUtilImpl)ejbContainerUtil).getEjbAsyncInvocationManager();
        Long asyncTaskID=(Long)args[0];
        RemoteAsyncResult asyncResult=null;
        if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteCancel(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteGet(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteIsDone(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          Long timeout=(Long)args[1];
          TimeUnit unit=TimeUnit.valueOf((String)args[2]);
          asyncResult=asyncManager.remoteGetWithTimeout(asyncTaskID,timeout,unit);
        }
        return asyncResult;
      }
    }
    EJBObjectImpl ejbObjectImpl=null;
    Object returnValue=null;
    if (invInfo.startsWithCreate) {
      ejbObjectImpl=createEJBObjectImpl();
      if (ejbObjectImpl != null) {
        returnValue=ejbObjectImpl.getStub();
      }
    }
    if (!isStatelessSession_) {
      if (invInfo.targetMethod1 == null) {
        _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()});
        String errorMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str",new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()});
        throw new RemoteException(errorMsg);
      }
      EjbInvocation inv=((BaseContainer)getContainer()).createEjbInvocation();
      inv.isRemote=true;
      inv.method=method;
      inv.isHome=true;
      inv.clientInterface=homeIntfClass_;
      inv.transactionAttribute=invInfo.txAttr;
      inv.securityPermissions=invInfo.securityPermissions;
      inv.invocationInfo=invInfo;
      if (ejbObjectImpl != null && invInfo.startsWithCreate) {
        inv.ejbObject=(EJBLocalRemoteObject)ejbObjectImpl;
      }
      BaseContainer container=(BaseContainer)getContainer();
      try {
        container.preInvoke(inv);
        if (invInfo.startsWithCreate) {
          Object ejbCreateReturnValue=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
          postCreate(container,inv,invInfo,ejbCreateReturnValue,args);
          if (inv.ejbObject != null) {
            returnValue=((EJBObjectImpl)inv.ejbObject).getStub();
          }
        }
 else         if (invInfo.startsWithFindByPrimaryKey) {
          returnValue=container.invokeFindByPrimaryKey(invInfo.targetMethod1,inv,args);
        }
 else         if (invInfo.startsWithFind) {
          Object pKeys=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
          returnValue=container.postFind(inv,pKeys,null);
        }
 else {
          returnValue=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
        }
      }
 catch (      InvocationTargetException ite) {
        inv.exception=ite.getCause();
      }
catch (      Throwable c) {
        inv.exception=c;
      }
 finally {
        container.postInvoke(inv);
      }
      if (inv.exception != null) {
        InvocationHandlerUtil.throwRemoteException(inv.exception,method.getExceptionTypes());
      }
    }
    return returnValue;
  }
  finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
    ((BaseContainer)getContainer()).onLeavingContainer();
  }
}

Fixed version (ground truth):
/** 
 * Called by EJBHome proxy.
 */
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  ClassLoader originalClassLoader=null;
  try {
    ((BaseContainer)getContainer()).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 (invokeSpecialEJBHomeMethod(method,methodClass,args)) {
      return null;
    }
    InvocationInfo invInfo=(InvocationInfo)invocationInfoMap_.get(method,((args != null) ? args.length : 0));
    if (invInfo == null) {
      throw new RemoteException("String_Node_Str" + method);
    }
 else     if ((methodClass == javax.ejb.EJBHome.class) || invInfo.ejbIntfOverride) {
      return invokeEJBHomeMethod(method.getName(),args);
    }
 else     if (GenericEJBHome.class.isAssignableFrom(methodClass)) {
      if (method.getName().equals("String_Node_Str")) {
        EJBObjectImpl busObjectImpl=createRemoteBusinessObjectImpl();
        return busObjectImpl.getStub((String)args[0]);
      }
 else {
        EjbAsyncInvocationManager asyncManager=((EjbContainerUtilImpl)ejbContainerUtil).getEjbAsyncInvocationManager();
        Long asyncTaskID=(Long)args[0];
        RemoteAsyncResult asyncResult=null;
        if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteCancel(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteGet(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          asyncResult=asyncManager.remoteIsDone(asyncTaskID);
        }
 else         if (method.getName().equals("String_Node_Str")) {
          Long timeout=(Long)args[1];
          TimeUnit unit=TimeUnit.valueOf((String)args[2]);
          asyncResult=asyncManager.remoteGetWithTimeout(asyncTaskID,timeout,unit);
        }
        return asyncResult;
      }
    }
    EJBObjectImpl ejbObjectImpl=null;
    Object returnValue=null;
    if (invInfo.startsWithCreate) {
      ejbObjectImpl=createEJBObjectImpl();
      if (ejbObjectImpl != null) {
        returnValue=ejbObjectImpl.getStub();
      }
    }
    if (!isStatelessSession_) {
      if (invInfo.targetMethod1 == null) {
        _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()});
        String errorMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str",new Object[]{invInfo.ejbName,"String_Node_Str",invInfo.method.toString()});
        throw new RemoteException(errorMsg);
      }
      EjbInvocation inv=((BaseContainer)getContainer()).createEjbInvocation();
      inv.isRemote=true;
      inv.method=method;
      inv.isHome=true;
      inv.clientInterface=homeIntfClass_;
      inv.transactionAttribute=invInfo.txAttr;
      inv.invocationInfo=invInfo;
      if (ejbObjectImpl != null && invInfo.startsWithCreate) {
        inv.ejbObject=(EJBLocalRemoteObject)ejbObjectImpl;
      }
      BaseContainer container=(BaseContainer)getContainer();
      try {
        container.preInvoke(inv);
        if (invInfo.startsWithCreate) {
          Object ejbCreateReturnValue=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
          postCreate(container,inv,invInfo,ejbCreateReturnValue,args);
          if (inv.ejbObject != null) {
            returnValue=((EJBObjectImpl)inv.ejbObject).getStub();
          }
        }
 else         if (invInfo.startsWithFindByPrimaryKey) {
          returnValue=container.invokeFindByPrimaryKey(invInfo.targetMethod1,inv,args);
        }
 else         if (invInfo.startsWithFind) {
          Object pKeys=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
          returnValue=container.postFind(inv,pKeys,null);
        }
 else {
          returnValue=invokeTargetBeanMethod(container,invInfo.targetMethod1,inv,inv.ejb,args);
        }
      }
 catch (      InvocationTargetException ite) {
        inv.exception=ite.getCause();
      }
catch (      Throwable c) {
        inv.exception=c;
      }
 finally {
        container.postInvoke(inv);
      }
      if (inv.exception != null) {
        InvocationHandlerUtil.throwRemoteException(inv.exception,method.getExceptionTypes());
      }
    }
    return returnValue;
  }
  finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
    ((BaseContainer)getContainer()).onLeavingContainer();
  }
}