Program: 28242
Project: 28242
Buggy source:
/** 
 * Clean any files and artifacts that were created during the execution of the prepare method.
 * @param dc deployment context
 */
public void clean(DeploymentContext dc){
  OpsParams params=dc.getCommandParameters(OpsParams.class);
  if ((params.origin.isUndeploy() || params.origin.isDeploy()) && isDas()) {
    if (cmpDeployer != null) {
      cmpDeployer.clean(dc);
    }
    Properties appProps=dc.getAppProps();
    String uniqueAppId=appProps.getProperty(APP_UNIQUE_ID_PROP);
    try {
      if (getTimeoutStatusFromApplicationInfo(params.name()) && uniqueAppId != null) {
        String target=((params.origin.isDeploy()) ? dc.getCommandParameters(DeployCommandParameters.class).target : dc.getCommandParameters(UndeployCommandParameters.class).target);
        if (DeploymentUtils.isDomainTarget(target)) {
          List<String> targets=(List<String>)dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS,List.class);
          if (targets == null) {
            targets=domain.getAllReferencedTargetsForApplication(params.name());
          }
          if (targets != null && targets.size() > 0) {
            target=targets.get(0);
          }
        }
        EJBTimerService timerService=EJBTimerService.getEJBTimerService(target,false);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + uniqueAppId);
          _logger.log(Level.FINE,"String_Node_Str" + timerService);
        }
        if (timerService == null) {
          _logger.log(Level.WARNING,"String_Node_Str" + uniqueAppId + "String_Node_Str");
        }
 else {
          if (getKeepStateFromApplicationInfo(params.name())) {
            _logger.log(Level.INFO,"String_Node_Str",params.name());
          }
 else {
            timerService.destroyAllTimers(Long.parseLong(uniqueAppId));
          }
        }
      }
    }
 catch (    Exception e) {
      _logger.log(Level.WARNING,"String_Node_Str" + uniqueAppId,e);
    }
  }
  if (params.origin.isUndeploy() || params.origin.isDeploy()) {
    String appName=params.name();
    String[] contextIds=ejbSecManagerFactory.getContextsForApp(appName,false);
    if (contextIds != null) {
      for (      String contextId : contextIds) {
        try {
          probeProvider.policyDestructionStartedEvent(contextId);
          SecurityUtil.removePolicy(contextId);
          probeProvider.policyDestructionEndedEvent(contextId);
          probeProvider.policyDestructionEvent(contextId);
        }
 catch (        IASSecurityException ex) {
          _logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str" + appName + "String_Node_Str"+ ex);
        }
        ArrayList<EJBSecurityManager> managers=ejbSecManagerFactory.getManagers(contextId,false);
        if (managers != null) {
          for (          EJBSecurityManager m : managers) {
            m.destroy();
          }
        }
      }
    }
    SecurityUtil.removeRoleMapper(dc);
  }
}

Fixed version (ground truth):
/** 
 * Clean any files and artifacts that were created during the execution of the prepare method.
 * @param dc deployment context
 */
public void clean(DeploymentContext dc){
  OpsParams params=dc.getCommandParameters(OpsParams.class);
  if ((params.origin.isUndeploy() || params.origin.isDeploy()) && isDas()) {
    if (cmpDeployer != null) {
      cmpDeployer.clean(dc);
    }
    Properties appProps=dc.getAppProps();
    String uniqueAppId=appProps.getProperty(APP_UNIQUE_ID_PROP);
    try {
      if (getTimeoutStatusFromApplicationInfo(params.name()) && uniqueAppId != null) {
        String target=((params.origin.isDeploy()) ? dc.getCommandParameters(DeployCommandParameters.class).target : dc.getCommandParameters(UndeployCommandParameters.class).target);
        if (DeploymentUtils.isDomainTarget(target)) {
          List<String> targets=(List<String>)dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS,List.class);
          if (targets == null) {
            targets=domain.getAllReferencedTargetsForApplication(params.name());
          }
          if (targets != null && targets.size() > 0) {
            target=targets.get(0);
          }
        }
        EJBTimerService timerService=EJBTimerService.getEJBTimerService(target,false);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + uniqueAppId);
          _logger.log(Level.FINE,"String_Node_Str" + timerService);
        }
        if (timerService == null) {
          _logger.log(Level.WARNING,"String_Node_Str" + uniqueAppId + "String_Node_Str");
        }
 else {
          if (getKeepStateFromApplicationInfo(params.name())) {
            _logger.log(Level.INFO,"String_Node_Str",params.name());
          }
 else {
            timerService.destroyAllTimers(Long.parseLong(uniqueAppId));
          }
        }
      }
    }
 catch (    Exception e) {
      _logger.log(Level.WARNING,"String_Node_Str" + uniqueAppId,e);
    }
  }
  if (params.origin.isUndeploy() || params.origin.isDeploy() || params.origin.isLoad()) {
    String appName=params.name();
    String[] contextIds=ejbSecManagerFactory.getContextsForApp(appName,false);
    if (contextIds != null) {
      for (      String contextId : contextIds) {
        try {
          probeProvider.policyDestructionStartedEvent(contextId);
          SecurityUtil.removePolicy(contextId);
          probeProvider.policyDestructionEndedEvent(contextId);
          probeProvider.policyDestructionEvent(contextId);
        }
 catch (        IASSecurityException ex) {
          _logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str" + appName + "String_Node_Str"+ ex);
        }
        ArrayList<EJBSecurityManager> managers=ejbSecManagerFactory.getManagers(contextId,false);
        if (managers != null) {
          for (          EJBSecurityManager m : managers) {
            m.destroy();
          }
        }
      }
    }
    SecurityUtil.removeRoleMapper(dc);
  }
}