Program: 134787
Project: 134787
Buggy source:
private ComponentInfo internalNoSyncRequestComponentPhase2(int requestor,String name,String type,String code,String containerName,int keepAliveTime,StatusHolder status,AcsJCannotGetComponentEx bcex,boolean isOtherDomainComponent,boolean isDynamicComponent,int h,boolean reactivate,ComponentInfo componentInfo,Container container,ContainerInfo containerInfo,long executionId,long activationTime,boolean timeoutError) throws AcsJCannotGetComponentEx {
  if ((requestor & TYPE_MASK) == COMPONENT_MASK)   removeComponentOwner(h | COMPONENT_MASK,requestor);
synchronized (pendingActivations) {
    pendingActivations.remove(name);
  }
  if (componentInfo == null || componentInfo.getHandle() == 0 || componentInfo.getComponent() == null) {
    logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(h | COMPONENT_MASK)+ "String_Node_Str");
synchronized (components) {
      if (!reactivate)       executeCommand(new ComponentCommandDeallocate(h,h | COMPONENT_MASK,timeoutError ? WhyUnloadedReason.TIMEOUT : WhyUnloadedReason.REMOVED,true));
    }
    status.setStatus(ComponentStatus.COMPONENT_NOT_ACTIVATED);
    if (bcex == null)     return null;
 else     throw bcex;
  }
  logger.log(Level.INFO,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(h | COMPONENT_MASK)+ "String_Node_Str");
  if (!isOtherDomainComponent && !componentInfo.getComponent().doesImplement(type)) {
    logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ type+ "String_Node_Str");
  }
  if (isOtherDomainComponent) {
    componentInfo.setHandle(h | COMPONENT_MASK);
    componentInfo.setClients(new IntArray());
    componentInfo.setComponents(new IntArray(0));
    componentInfo.setContainer(0);
    type=componentInfo.getType();
    code=componentInfo.getCode();
  }
  int clients[];
synchronized (components) {
    if (componentInfo.getHandle() != (h | COMPONENT_MASK)) {
      int componentHandle=componentInfo.getHandle() & HANDLE_MASK;
      if (components.isAllocated(componentHandle)) {
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REMOVED,true));
        bcex=new AcsJCannotGetComponentEx();
        logger.log(Level.SEVERE,"String_Node_Str",bcex);
        status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
        throw bcex;
      }
 else {
        ComponentInfo existingData=null;
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REPLACED,true));
 else {
          existingData=(ComponentInfo)components.get(h);
          executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REPLACED));
        }
        Integer objHandle=(Integer)executeCommand(new ComponentCommandAllocateHandle(componentHandle,true));
        if (objHandle == null || (h=objHandle.intValue()) == 0) {
          bcex=new AcsJCannotGetComponentEx();
          logger.log(Level.SEVERE,"String_Node_Str",bcex);
          status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
          throw bcex;
        }
 else         if (existingData != null)         executeCommand(new ComponentCommandSet(h,existingData));
        logger.log(Level.SEVERE,"String_Node_Str");
      }
    }
    ComponentInfo existingData=(ComponentInfo)components.get(h);
    ComponentInfo data=new ComponentInfo(componentInfo.getHandle(),name,type,code,componentInfo.getComponent());
    if (existingData != null) {
      data.setClients(existingData.getClients());
      data.setComponents(existingData.getComponents());
    }
    if (requestor != 0)     if (!data.getClients().contains(requestor))     data.getClients().add(requestor);
    if (keepAliveTime <= RELEASE_NEVER)     if (!data.getClients().contains(this.getHandle()))     data.getClients().add(this.getHandle());
    data.setKeepAliveTime(keepAliveTime);
    if (isOtherDomainComponent) {
      data.setContainer(0);
      data.setContainerName(componentInfo.getContainerName());
    }
 else {
      data.setContainer(containerInfo.getHandle());
      data.setContainerName(containerInfo.getName());
    }
    data.setAccessRights(0);
    data.setInterfaces(componentInfo.getInterfaces());
    if (isDynamicComponent) {
      data.setDynamic(true);
      data.setDynamicContainerName(containerName);
    }
    executeCommand(new ComponentCommandSet(h,data));
    if (!reactivate)     executeCommand(new ComponentCommandAckAlloc(h));
    componentInfo=data;
    clients=componentInfo.getClients().toArray();
  }
  if (!isOtherDomainComponent) {
    if ((requestor & TYPE_MASK) == COMPONENT_MASK)     addComponentOwner(componentInfo.getHandle(),requestor);
    boolean constructed=false;
    try {
      componentInfo.getComponent().construct();
      constructed=true;
    }
 catch (    Throwable ex) {
      bcex=new AcsJCannotGetComponentEx(ex);
      logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str",bcex);
    }
    if ((requestor & TYPE_MASK) == COMPONENT_MASK)     removeComponentOwner(componentInfo.getHandle(),requestor);
    if (!constructed) {
synchronized (components) {
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REMOVED));
        try {
          container.deactivate_component(componentInfo.getHandle());
        }
 catch (        Exception ex) {
          bcex=new AcsJCannotGetComponentEx(ex);
          logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ containerName+ "String_Node_Str",bcex);
        }
        status.setStatus(ComponentStatus.COMPONENT_NOT_ACTIVATED);
        throw bcex;
      }
    }
  }
  if (requestor != this.getHandle() && requestor != 0)   addComponentOwner(componentInfo.getHandle(),requestor);
  if (!isOtherDomainComponent) synchronized (containerInfo.getComponents()) {
    if (!containerInfo.getComponents().contains(componentInfo.getHandle()))     executeCommand(new ContainerInfoCommandComponentAdd(containerInfo.getHandle() & HANDLE_MASK,componentInfo.getHandle()));
  }
  if (reactivate) {
synchronized (unavailableComponents) {
      executeCommand(new UnavailableComponentCommandRemove(name));
    }
  }
  if (prevayler != null) {
    try {
      ((SnapshotPrevayler)prevayler).takeSnapshot();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  bind(convertToHiearachical(name),"String_Node_Str",componentInfo.getComponent().getObject());
  if (!isOtherDomainComponent)   notifyComponentActivated(componentInfo,activationTime,executionId);
  if (reactivate) {
    notifyComponentAvailable(requestor,clients,new ComponentInfo[]{componentInfo});
  }
  notifyComponentRequested(new int[]{requestor},new int[]{componentInfo.getHandle()},activationTime);
  if (reactivate)   logger.log(Level.FINE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(componentInfo.getHandle())+ "String_Node_Str");
 else   logger.log(Level.FINE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(componentInfo.getHandle())+ "String_Node_Str");
  if (containerInfo != null)   topologySortManager.notifyTopologyChange(containerInfo.getHandle());
  status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
  return componentInfo;
}

Fixed version (ground truth):
private ComponentInfo internalNoSyncRequestComponentPhase2(int requestor,String name,String type,String code,String containerName,int keepAliveTime,StatusHolder status,AcsJCannotGetComponentEx bcex,boolean isOtherDomainComponent,boolean isDynamicComponent,int h,boolean reactivate,ComponentInfo componentInfo,Container container,ContainerInfo containerInfo,long executionId,long activationTime,boolean timeoutError) throws AcsJCannotGetComponentEx {
  if ((requestor & TYPE_MASK) == COMPONENT_MASK) {
    removeComponentOwner(h | COMPONENT_MASK,requestor);
  }
synchronized (pendingActivations) {
    pendingActivations.remove(name);
  }
  if (componentInfo == null || componentInfo.getHandle() == 0 || componentInfo.getComponent() == null) {
    logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(h | COMPONENT_MASK)+ "String_Node_Str");
synchronized (components) {
      if (!reactivate)       executeCommand(new ComponentCommandDeallocate(h,h | COMPONENT_MASK,timeoutError ? WhyUnloadedReason.TIMEOUT : WhyUnloadedReason.REMOVED,true));
    }
    status.setStatus(ComponentStatus.COMPONENT_NOT_ACTIVATED);
    if (bcex == null)     return null;
 else     throw bcex;
  }
  logger.log(Level.INFO,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(h | COMPONENT_MASK)+ "String_Node_Str");
  if (!isOtherDomainComponent && !componentInfo.getComponent().doesImplement(type)) {
    logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ type+ "String_Node_Str");
  }
  if (isOtherDomainComponent) {
    componentInfo.setHandle(h | COMPONENT_MASK);
    componentInfo.setClients(new IntArray());
    componentInfo.setComponents(new IntArray(0));
    componentInfo.setContainer(0);
    type=componentInfo.getType();
    code=componentInfo.getCode();
  }
  int clients[];
synchronized (components) {
    if (componentInfo.getHandle() != (h | COMPONENT_MASK)) {
      int componentHandle=componentInfo.getHandle() & HANDLE_MASK;
      if (components.isAllocated(componentHandle)) {
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REMOVED,true));
        bcex=new AcsJCannotGetComponentEx();
        logger.log(Level.SEVERE,"String_Node_Str",bcex);
        status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
        throw bcex;
      }
 else {
        ComponentInfo existingData=null;
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REPLACED,true));
 else {
          existingData=(ComponentInfo)components.get(h);
          executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REPLACED));
        }
        Integer objHandle=(Integer)executeCommand(new ComponentCommandAllocateHandle(componentHandle,true));
        if (objHandle == null || (h=objHandle.intValue()) == 0) {
          bcex=new AcsJCannotGetComponentEx();
          logger.log(Level.SEVERE,"String_Node_Str",bcex);
          status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
          throw bcex;
        }
 else         if (existingData != null)         executeCommand(new ComponentCommandSet(h,existingData));
        logger.log(Level.SEVERE,"String_Node_Str");
      }
    }
    ComponentInfo existingData=(ComponentInfo)components.get(h);
    ComponentInfo data=new ComponentInfo(componentInfo.getHandle(),name,type,code,componentInfo.getComponent());
    if (existingData != null) {
      data.setClients(existingData.getClients());
      data.setComponents(existingData.getComponents());
    }
    if (requestor != 0)     if (!data.getClients().contains(requestor))     data.getClients().add(requestor);
    if (keepAliveTime <= RELEASE_NEVER)     if (!data.getClients().contains(this.getHandle()))     data.getClients().add(this.getHandle());
    data.setKeepAliveTime(keepAliveTime);
    if (isOtherDomainComponent) {
      data.setContainer(0);
      data.setContainerName(componentInfo.getContainerName());
    }
 else {
      data.setContainer(containerInfo.getHandle());
      data.setContainerName(containerInfo.getName());
    }
    data.setAccessRights(0);
    data.setInterfaces(componentInfo.getInterfaces());
    if (isDynamicComponent) {
      data.setDynamic(true);
      data.setDynamicContainerName(containerName);
    }
    executeCommand(new ComponentCommandSet(h,data));
    if (!reactivate)     executeCommand(new ComponentCommandAckAlloc(h));
    componentInfo=data;
    clients=componentInfo.getClients().toArray();
  }
  if (!isOtherDomainComponent) {
    if ((requestor & TYPE_MASK) == COMPONENT_MASK)     addComponentOwner(componentInfo.getHandle(),requestor);
    boolean constructed=false;
    try {
      componentInfo.getComponent().construct();
      constructed=true;
    }
 catch (    Throwable ex) {
      bcex=new AcsJCannotGetComponentEx(ex);
      logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str",bcex);
    }
    if ((requestor & TYPE_MASK) == COMPONENT_MASK)     removeComponentOwner(componentInfo.getHandle(),requestor);
    if (!constructed) {
synchronized (components) {
        if (!reactivate)         executeCommand(new ComponentCommandDeallocate(h,componentInfo.getHandle(),WhyUnloadedReason.REMOVED));
        try {
          container.deactivate_component(componentInfo.getHandle());
        }
 catch (        Exception ex) {
          bcex=new AcsJCannotGetComponentEx(ex);
          logger.log(Level.SEVERE,"String_Node_Str" + name + "String_Node_Str"+ containerName+ "String_Node_Str",bcex);
        }
        status.setStatus(ComponentStatus.COMPONENT_NOT_ACTIVATED);
        throw bcex;
      }
    }
  }
  if (requestor != this.getHandle() && requestor != 0)   addComponentOwner(componentInfo.getHandle(),requestor);
  if (!isOtherDomainComponent) synchronized (containerInfo.getComponents()) {
    if (!containerInfo.getComponents().contains(componentInfo.getHandle()))     executeCommand(new ContainerInfoCommandComponentAdd(containerInfo.getHandle() & HANDLE_MASK,componentInfo.getHandle()));
  }
  if (reactivate) {
synchronized (unavailableComponents) {
      executeCommand(new UnavailableComponentCommandRemove(name));
    }
  }
  if (prevayler != null) {
    try {
      ((SnapshotPrevayler)prevayler).takeSnapshot();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  bind(convertToHiearachical(name),"String_Node_Str",componentInfo.getComponent().getObject());
  if (!isOtherDomainComponent)   notifyComponentActivated(componentInfo,activationTime,executionId);
  if (reactivate) {
    notifyComponentAvailable(requestor,clients,new ComponentInfo[]{componentInfo});
  }
  notifyComponentRequested(new int[]{requestor},new int[]{componentInfo.getHandle()},activationTime);
  if (reactivate)   logger.log(Level.FINE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(componentInfo.getHandle())+ "String_Node_Str");
 else   logger.log(Level.FINE,"String_Node_Str" + name + "String_Node_Str"+ HandleHelper.toString(componentInfo.getHandle())+ "String_Node_Str");
  if (containerInfo != null)   topologySortManager.notifyTopologyChange(containerInfo.getHandle());
  status.setStatus(ComponentStatus.COMPONENT_ACTIVATED);
  return componentInfo;
}