Program: 30096
Project: 30096
Buggy source:
/** 
 * This constructor is called from ContainerFactoryImpl when an EJB Jar is deployed.
 */
protected BaseContainer(ContainerType type,EjbDescriptor ejbDesc,ClassLoader loader) throws Exception {
  this.containerType=type;
  try {
    this.loader=loader;
    this.ejbDescriptor=ejbDesc;
    logParams=new Object[1];
    logParams[0]=ejbDesc.getName();
    invocationManager=ejbContainerUtilImpl.getInvocationManager();
    injectionManager=ejbContainerUtilImpl.getInjectionManager();
    namingManager=ejbContainerUtilImpl.getGlassfishNamingManager();
    transactionManager=ejbContainerUtilImpl.getTransactionManager();
    ejbClass=loader.loadClass(ejbDescriptor.getEjbImplClassName());
    IASEjbExtraDescriptors iased=ejbDesc.getIASEjbExtraDescriptors();
    cmtTimeoutInSeconds=iased.getCmtTimeoutInSeconds();
    if (ejbDescriptor.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
      assertFullProfile("String_Node_Str");
      isMessageDriven=true;
      EjbMessageBeanDescriptor mdb=(EjbMessageBeanDescriptor)ejbDescriptor;
      if (mdb.getTransactionType().equals("String_Node_Str")) {
        isBeanManagedTran=true;
      }
 else {
        isBeanManagedTran=false;
      }
    }
 else {
      if (ejbDescriptor.getType().equals(EjbEntityDescriptor.TYPE)) {
        assertFullProfile("String_Node_Str");
        isEntity=true;
      }
 else {
        isSession=true;
        EjbSessionDescriptor sd=(EjbSessionDescriptor)ejbDescriptor;
        if (!sd.isSessionTypeSet()) {
          throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",sd.getName(),sd));
        }
        if (sd.isSingleton()) {
          isSingleton=true;
        }
 else {
          isStatelessSession=sd.isStateless();
          isStatefulSession=!isStatelessSession;
          if (isStatefulSession) {
            if (!Serializable.class.isAssignableFrom(ejbClass)) {
              sfsbSerializedClass=EJBUtils.loadGeneratedSerializableClass(ejbClass.getClassLoader(),ejbClass.getName());
            }
          }
        }
        if (sd.getTransactionType().equals("String_Node_Str")) {
          isBeanManagedTran=true;
        }
 else {
          isBeanManagedTran=false;
        }
        hasAsynchronousInvocations=sd.hasAsynchronousMethods();
        if (hasAsynchronousInvocations) {
          assertFullProfile("String_Node_Str");
        }
      }
      if (ejbDescriptor.isRemoteInterfacesSupported() || ejbDescriptor.isRemoteBusinessInterfacesSupported()) {
        assertFullProfile("String_Node_Str");
        initializeProtocolManager();
      }
      if (ejbDescriptor.isRemoteInterfacesSupported()) {
        isRemote=true;
        hasRemoteHomeView=true;
        String homeClassName=ejbDescriptor.getHomeClassName();
        homeIntf=loader.loadClass(homeClassName);
        remoteIntf=loader.loadClass(ejbDescriptor.getRemoteClassName());
        String id=Long.toString(ejbDescriptor.getUniqueId()) + "String_Node_Str";
        remoteHomeRefFactory=getProtocolManager().getRemoteReferenceFactory(this,true,id);
      }
      if (ejbDescriptor.isRemoteBusinessInterfacesSupported()) {
        isRemote=true;
        hasRemoteBusinessView=true;
        remoteBusinessHomeIntf=EJBUtils.loadGeneratedGenericEJBHomeClass(loader);
        for (        String next : ejbDescriptor.getRemoteBusinessClassNames()) {
          EJBUtils.loadGeneratedRemoteBusinessClasses(loader,next);
          String nextGen=EJBUtils.getGeneratedRemoteIntfName(next);
          Class genRemoteIntf=loader.loadClass(nextGen);
          RemoteBusinessIntfInfo info=new RemoteBusinessIntfInfo();
          info.generatedRemoteIntf=genRemoteIntf;
          info.remoteBusinessIntf=loader.loadClass(next);
          String id=Long.toString(ejbDescriptor.getUniqueId()) + "String_Node_Str" + "String_Node_Str"+ genRemoteIntf.getName();
          info.referenceFactory=getProtocolManager().getRemoteReferenceFactory(this,false,id);
          remoteBusinessIntfInfo.put(genRemoteIntf.getName(),info);
          addToGeneratedMonitoredMethodInfo(nextGen,genRemoteIntf);
        }
      }
      if (ejbDescriptor.isLocalInterfacesSupported()) {
        isLocal=true;
        hasLocalHomeView=true;
        String localHomeClassName=ejbDescriptor.getLocalHomeClassName();
        localHomeIntf=loader.loadClass(localHomeClassName);
        localIntf=loader.loadClass(ejbDescriptor.getLocalClassName());
      }
      if (ejbDescriptor.isLocalBusinessInterfacesSupported()) {
        isLocal=true;
        hasLocalBusinessView=true;
        localBusinessHomeIntf=GenericEJBLocalHome.class;
        for (        String next : ejbDescriptor.getLocalBusinessClassNames()) {
          Class clz=loader.loadClass(next);
          localBusinessIntfs.add(clz);
          addToGeneratedMonitoredMethodInfo(next,clz);
        }
      }
      if (ejbDescriptor.isLocalBean()) {
        isLocal=true;
        hasOptionalLocalBusinessView=true;
        ejbOptionalLocalBusinessHomeIntf=GenericEJBLocalHome.class;
        Class clz=loader.loadClass(ejbDescriptor.getEjbClassName());
        addToGeneratedMonitoredMethodInfo(ejbDescriptor.getEjbClassName(),clz);
        this.optIntfClassName=EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
        optIntfClassLoader=new EjbOptionalIntfGenerator(loader);
        ((EjbOptionalIntfGenerator)optIntfClassLoader).generateOptionalLocalInterface(ejbClass,optIntfClassName);
        ejbGeneratedOptionalLocalBusinessIntfClass=optIntfClassLoader.loadClass(optIntfClassName);
      }
      if (isStatelessSession || isSingleton) {
        EjbBundleDescriptor bundle=ejbDescriptor.getEjbBundleDescriptor();
        WebServicesDescriptor webServices=bundle.getWebServices();
        Collection endpoints=webServices.getEndpointsImplementedBy(ejbDescriptor);
        if (endpoints.size() == 1) {
          assertFullProfile("String_Node_Str");
          webServiceEndpointIntf=loader.loadClass(ejbDescriptor.getWebServiceEndpointInterfaceName());
          isWebServiceEndpoint=true;
        }
      }
      try {
        ejbPassivateMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
        ejbActivateMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
        ejbRemoveMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
      }
 catch (      NoSuchMethodException nsme) {
      }
    }
    if (ejbDescriptor.isTimedObject()) {
      assertFullProfile("String_Node_Str");
      MethodDescriptor ejbTimeoutMethodDesc=ejbDescriptor.getEjbTimeoutMethod();
      if (ejbTimeoutMethodDesc != null) {
        Method method=ejbTimeoutMethodDesc.getMethod(ejbDescriptor);
        processEjbTimeoutMethod(method);
        ejbTimeoutMethod=method;
      }
      for (      ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
        Method method=schd.getTimeoutMethod().getMethod(ejbDescriptor);
        if (method == null) {
          throw new EJBException(localStrings.getLocalString("String_Node_Str","String_Node_Str",ejbClass.getName(),schd.getTimeoutMethod().getFormattedString()));
        }
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + method);
        }
        processEjbTimeoutMethod(method);
        List<ScheduledTimerDescriptor> list=schedules.get(method);
        if (list == null) {
          list=new ArrayList<ScheduledTimerDescriptor>();
          schedules.put(method,list);
        }
        list.add(schd);
      }
    }
    if (isTimedObject_) {
      if (!isStatefulSession) {
        EJBTimerService timerService=ejbContainerUtilImpl.getEJBTimerService();
        if (timerService != null) {
          timerService.timedObjectCount();
        }
      }
 else {
        isTimedObject_=false;
        throw new EJBException(localStrings.getLocalString("String_Node_Str","String_Node_Str",ejbDescriptor.getName()));
      }
    }
    preInitialize(ejbDesc,loader);
    initializeEjbInterfaceMethods();
    if (needSystemInterceptorProxy()) {
      addSystemInterceptorProxy();
    }
    initializeInvocationInfo();
    setupEnvironment();
  }
 catch (  Exception ex) {
    _logger.log(Level.FINE,"String_Node_Str",logParams);
    _logger.log(Level.FINE,"String_Node_Str",ex);
    throw ex;
  }
  _debugDescription="String_Node_Str" + ejbDescriptor.getName() + "String_Node_Str"+ ejbDescriptor.getUniqueId();
  _logger.log(Level.FINE,"String_Node_Str" + _debugDescription);
}

Fixed version (ground truth):
/** 
 * This constructor is called from ContainerFactoryImpl when an EJB Jar is deployed.
 */
protected BaseContainer(ContainerType type,EjbDescriptor ejbDesc,ClassLoader loader) throws Exception {
  this.containerType=type;
  try {
    this.loader=loader;
    this.ejbDescriptor=ejbDesc;
    logParams=new Object[1];
    logParams[0]=ejbDesc.getName();
    invocationManager=ejbContainerUtilImpl.getInvocationManager();
    injectionManager=ejbContainerUtilImpl.getInjectionManager();
    namingManager=ejbContainerUtilImpl.getGlassfishNamingManager();
    transactionManager=ejbContainerUtilImpl.getTransactionManager();
    ejbClass=loader.loadClass(ejbDescriptor.getEjbImplClassName());
    IASEjbExtraDescriptors iased=ejbDesc.getIASEjbExtraDescriptors();
    cmtTimeoutInSeconds=iased.getCmtTimeoutInSeconds();
    if (ejbDescriptor.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
      assertFullProfile("String_Node_Str");
      isMessageDriven=true;
      EjbMessageBeanDescriptor mdb=(EjbMessageBeanDescriptor)ejbDescriptor;
      if (mdb.getTransactionType().equals("String_Node_Str")) {
        isBeanManagedTran=true;
      }
 else {
        isBeanManagedTran=false;
      }
      initializeProtocolManager();
    }
 else {
      if (ejbDescriptor.getType().equals(EjbEntityDescriptor.TYPE)) {
        assertFullProfile("String_Node_Str");
        isEntity=true;
      }
 else {
        isSession=true;
        EjbSessionDescriptor sd=(EjbSessionDescriptor)ejbDescriptor;
        if (!sd.isSessionTypeSet()) {
          throw new RuntimeException(localStrings.getLocalString("String_Node_Str","String_Node_Str",sd.getName(),sd));
        }
        if (sd.isSingleton()) {
          isSingleton=true;
        }
 else {
          isStatelessSession=sd.isStateless();
          isStatefulSession=!isStatelessSession;
          if (isStatefulSession) {
            if (!Serializable.class.isAssignableFrom(ejbClass)) {
              sfsbSerializedClass=EJBUtils.loadGeneratedSerializableClass(ejbClass.getClassLoader(),ejbClass.getName());
            }
          }
        }
        if (sd.getTransactionType().equals("String_Node_Str")) {
          isBeanManagedTran=true;
        }
 else {
          isBeanManagedTran=false;
        }
        hasAsynchronousInvocations=sd.hasAsynchronousMethods();
        if (hasAsynchronousInvocations) {
          assertFullProfile("String_Node_Str");
        }
      }
      if (ejbDescriptor.isRemoteInterfacesSupported() || ejbDescriptor.isRemoteBusinessInterfacesSupported()) {
        assertFullProfile("String_Node_Str");
        initializeProtocolManager();
      }
      if (ejbDescriptor.isRemoteInterfacesSupported()) {
        isRemote=true;
        hasRemoteHomeView=true;
        String homeClassName=ejbDescriptor.getHomeClassName();
        homeIntf=loader.loadClass(homeClassName);
        remoteIntf=loader.loadClass(ejbDescriptor.getRemoteClassName());
        String id=Long.toString(ejbDescriptor.getUniqueId()) + "String_Node_Str";
        remoteHomeRefFactory=getProtocolManager().getRemoteReferenceFactory(this,true,id);
      }
      if (ejbDescriptor.isRemoteBusinessInterfacesSupported()) {
        isRemote=true;
        hasRemoteBusinessView=true;
        remoteBusinessHomeIntf=EJBUtils.loadGeneratedGenericEJBHomeClass(loader);
        for (        String next : ejbDescriptor.getRemoteBusinessClassNames()) {
          EJBUtils.loadGeneratedRemoteBusinessClasses(loader,next);
          String nextGen=EJBUtils.getGeneratedRemoteIntfName(next);
          Class genRemoteIntf=loader.loadClass(nextGen);
          RemoteBusinessIntfInfo info=new RemoteBusinessIntfInfo();
          info.generatedRemoteIntf=genRemoteIntf;
          info.remoteBusinessIntf=loader.loadClass(next);
          String id=Long.toString(ejbDescriptor.getUniqueId()) + "String_Node_Str" + "String_Node_Str"+ genRemoteIntf.getName();
          info.referenceFactory=getProtocolManager().getRemoteReferenceFactory(this,false,id);
          remoteBusinessIntfInfo.put(genRemoteIntf.getName(),info);
          addToGeneratedMonitoredMethodInfo(nextGen,genRemoteIntf);
        }
      }
      if (ejbDescriptor.isLocalInterfacesSupported()) {
        isLocal=true;
        hasLocalHomeView=true;
        String localHomeClassName=ejbDescriptor.getLocalHomeClassName();
        localHomeIntf=loader.loadClass(localHomeClassName);
        localIntf=loader.loadClass(ejbDescriptor.getLocalClassName());
      }
      if (ejbDescriptor.isLocalBusinessInterfacesSupported()) {
        isLocal=true;
        hasLocalBusinessView=true;
        localBusinessHomeIntf=GenericEJBLocalHome.class;
        for (        String next : ejbDescriptor.getLocalBusinessClassNames()) {
          Class clz=loader.loadClass(next);
          localBusinessIntfs.add(clz);
          addToGeneratedMonitoredMethodInfo(next,clz);
        }
      }
      if (ejbDescriptor.isLocalBean()) {
        isLocal=true;
        hasOptionalLocalBusinessView=true;
        ejbOptionalLocalBusinessHomeIntf=GenericEJBLocalHome.class;
        Class clz=loader.loadClass(ejbDescriptor.getEjbClassName());
        addToGeneratedMonitoredMethodInfo(ejbDescriptor.getEjbClassName(),clz);
        this.optIntfClassName=EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
        optIntfClassLoader=new EjbOptionalIntfGenerator(loader);
        ((EjbOptionalIntfGenerator)optIntfClassLoader).generateOptionalLocalInterface(ejbClass,optIntfClassName);
        ejbGeneratedOptionalLocalBusinessIntfClass=optIntfClassLoader.loadClass(optIntfClassName);
      }
      if (isStatelessSession || isSingleton) {
        EjbBundleDescriptor bundle=ejbDescriptor.getEjbBundleDescriptor();
        WebServicesDescriptor webServices=bundle.getWebServices();
        Collection endpoints=webServices.getEndpointsImplementedBy(ejbDescriptor);
        if (endpoints.size() == 1) {
          assertFullProfile("String_Node_Str");
          webServiceEndpointIntf=loader.loadClass(ejbDescriptor.getWebServiceEndpointInterfaceName());
          isWebServiceEndpoint=true;
        }
      }
      try {
        ejbPassivateMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
        ejbActivateMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
        ejbRemoveMethod=ejbClass.getMethod("String_Node_Str",NO_PARAMS);
      }
 catch (      NoSuchMethodException nsme) {
      }
    }
    if (ejbDescriptor.isTimedObject()) {
      assertFullProfile("String_Node_Str");
      MethodDescriptor ejbTimeoutMethodDesc=ejbDescriptor.getEjbTimeoutMethod();
      if (ejbTimeoutMethodDesc != null) {
        Method method=ejbTimeoutMethodDesc.getMethod(ejbDescriptor);
        processEjbTimeoutMethod(method);
        ejbTimeoutMethod=method;
      }
      for (      ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
        Method method=schd.getTimeoutMethod().getMethod(ejbDescriptor);
        if (method == null) {
          throw new EJBException(localStrings.getLocalString("String_Node_Str","String_Node_Str",ejbClass.getName(),schd.getTimeoutMethod().getFormattedString()));
        }
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + method);
        }
        processEjbTimeoutMethod(method);
        List<ScheduledTimerDescriptor> list=schedules.get(method);
        if (list == null) {
          list=new ArrayList<ScheduledTimerDescriptor>();
          schedules.put(method,list);
        }
        list.add(schd);
      }
    }
    if (isTimedObject_) {
      if (!isStatefulSession) {
        EJBTimerService timerService=ejbContainerUtilImpl.getEJBTimerService();
        if (timerService != null) {
          timerService.timedObjectCount();
        }
      }
 else {
        isTimedObject_=false;
        throw new EJBException(localStrings.getLocalString("String_Node_Str","String_Node_Str",ejbDescriptor.getName()));
      }
    }
    preInitialize(ejbDesc,loader);
    initializeEjbInterfaceMethods();
    if (needSystemInterceptorProxy()) {
      addSystemInterceptorProxy();
    }
    initializeInvocationInfo();
    setupEnvironment();
  }
 catch (  Exception ex) {
    _logger.log(Level.FINE,"String_Node_Str",logParams);
    _logger.log(Level.FINE,"String_Node_Str",ex);
    throw ex;
  }
  _debugDescription="String_Node_Str" + ejbDescriptor.getName() + "String_Node_Str"+ ejbDescriptor.getUniqueId();
  _logger.log(Level.FINE,"String_Node_Str" + _debugDescription);
}