Program: 115447
Project: 115447
Buggy source:
private void undeployArtifacts() throws Exception {
  log.info(String.format("String_Node_Str",applicationId));
  String resourcePathUndeploy=RestConstants.APPLICATIONS + "String_Node_Str" + applicationId+ RestConstants.APPLICATIONS_UNDEPLOY;
  boolean unDeployed=restClient.undeployEntity(resourcePathUndeploy,RestConstants.APPLICATIONS_NAME);
  assertTrue(unDeployed);
  boolean undeploy=TopologyHandler.getInstance().assertApplicationUndeploy(applicationId);
  if (!undeploy) {
    log.info(String.format("String_Node_Str",applicationId));
    restClient.undeployEntity(RestConstants.APPLICATIONS + applicationId + RestConstants.APPLICATIONS_UNDEPLOY+ "String_Node_Str",RestConstants.APPLICATIONS);
    boolean forceUndeployed=TopologyHandler.getInstance().assertApplicationUndeploy(applicationId);
    assertTrue(String.format("String_Node_Str",applicationId),forceUndeployed);
  }
  log.info("String_Node_Str");
  boolean removedApp=restClient.removeEntity(RestConstants.APPLICATIONS,applicationId,RestConstants.APPLICATIONS_NAME);
  assertTrue(removedApp);
  ApplicationBean beanRemoved=(ApplicationBean)restClient.getEntity(RestConstants.APPLICATIONS,applicationId,ApplicationBean.class,RestConstants.APPLICATIONS_NAME);
  assertNull(beanRemoved);
  log.info(String.format("String_Node_Str",appPolicyId));
  boolean removeAppPolicy=restClient.removeEntity(RestConstants.APPLICATION_POLICIES,appPolicyId,RestConstants.APPLICATION_POLICIES_NAME);
  assertTrue(removeAppPolicy);
  log.info(String.format("String_Node_Str",cartridgeId));
  boolean removedC1=restClient.removeEntity(RestConstants.CARTRIDGES,cartridgeId,RestConstants.CARTRIDGES_NAME);
  assertTrue(removedC1);
  log.info(String.format("String_Node_Str",autoscalePolicyId));
  boolean removedAuto=restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,autoscalePolicyId,RestConstants.AUTOSCALING_POLICIES_NAME);
  assertTrue(removedAuto);
  log.info(String.format("String_Node_Str",depPolicyId));
  boolean removedDep=restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,depPolicyId,RestConstants.DEPLOYMENT_POLICIES_NAME);
  assertTrue(removedDep);
  log.info(String.format("String_Node_Str",networkPartitionId));
  boolean removedNet=restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,networkPartitionId,RestConstants.NETWORK_PARTITIONS_NAME);
  assertTrue(removedNet);
}

Fixed version (ground truth):
private void undeployArtifacts() throws Exception {
  log.info(String.format("String_Node_Str",applicationId));
  String resourcePathUndeploy=RestConstants.APPLICATIONS + "String_Node_Str" + applicationId+ RestConstants.APPLICATIONS_UNDEPLOY;
  boolean unDeployed=restClient.undeployEntity(resourcePathUndeploy,RestConstants.APPLICATIONS_NAME);
  assertTrue(unDeployed);
  boolean undeploy=TopologyHandler.getInstance().assertApplicationUndeploy(applicationId);
  if (!undeploy) {
    log.info(String.format("String_Node_Str",applicationId));
    restClient.undeployEntity(RestConstants.APPLICATIONS + "String_Node_Str" + applicationId+ RestConstants.APPLICATIONS_UNDEPLOY+ "String_Node_Str",RestConstants.APPLICATIONS);
    boolean forceUndeployed=TopologyHandler.getInstance().assertApplicationUndeploy(applicationId);
    assertTrue(String.format("String_Node_Str",applicationId),forceUndeployed);
  }
  log.info("String_Node_Str");
  boolean removedApp=restClient.removeEntity(RestConstants.APPLICATIONS,applicationId,RestConstants.APPLICATIONS_NAME);
  assertTrue(removedApp);
  ApplicationBean beanRemoved=(ApplicationBean)restClient.getEntity(RestConstants.APPLICATIONS,applicationId,ApplicationBean.class,RestConstants.APPLICATIONS_NAME);
  assertNull(beanRemoved);
  log.info(String.format("String_Node_Str",appPolicyId));
  boolean removeAppPolicy=restClient.removeEntity(RestConstants.APPLICATION_POLICIES,appPolicyId,RestConstants.APPLICATION_POLICIES_NAME);
  assertTrue(removeAppPolicy);
  log.info(String.format("String_Node_Str",cartridgeId));
  boolean removedC1=restClient.removeEntity(RestConstants.CARTRIDGES,cartridgeId,RestConstants.CARTRIDGES_NAME);
  assertTrue(removedC1);
  log.info(String.format("String_Node_Str",autoscalePolicyId));
  boolean removedAuto=restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,autoscalePolicyId,RestConstants.AUTOSCALING_POLICIES_NAME);
  assertTrue(removedAuto);
  log.info(String.format("String_Node_Str",depPolicyId));
  boolean removedDep=restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,depPolicyId,RestConstants.DEPLOYMENT_POLICIES_NAME);
  assertTrue(removedDep);
  log.info(String.format("String_Node_Str",networkPartitionId));
  boolean removedNet=restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,networkPartitionId,RestConstants.NETWORK_PARTITIONS_NAME);
  assertTrue(removedNet);
}