Program: 115429
Project: 115429
Buggy source:
@Override public boolean deployApplication(String applicationId,String applicationPolicyId) throws ApplicationDefinitionException {
  try {
    Application application=ApplicationHolder.getApplications().getApplication(applicationId);
    if (application == null) {
      throw new RuntimeException("String_Node_Str" + applicationId);
    }
    ApplicationContext applicationContext=RegistryManager.getInstance().getApplicationContext(applicationId);
    if (applicationContext == null) {
      throw new RuntimeException("String_Node_Str" + applicationId);
    }
    AutoscalerUtil.validateApplicationPolicyAgainstApplication(applicationId,applicationPolicyId);
    try {
      ApplicationHolder.acquireWriteLock();
      application=ApplicationHolder.getApplications().getApplication(applicationId);
      application.setApplicationPolicyId(applicationPolicyId);
      ApplicationHolder.persistApplication(application);
    }
  finally {
      ApplicationHolder.releaseWriteLock();
    }
    NetworkPartitionAlgorithmContext algorithmContext=new NetworkPartitionAlgorithmContext(applicationId,applicationPolicyId,0);
    AutoscalerContext.getInstance().addNetworkPartitionAlgorithmContext(algorithmContext);
    if (!applicationContext.isMultiTenant()) {
      addApplicationSignUp(applicationContext,application.getKey(),findApplicationClusterIds(application));
    }
    applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
    AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
    ApplicationBuilder.handleApplicationDeployment(application,applicationContext.getComponents().getApplicationClusterContexts());
    log.info("String_Node_Str" + applicationId);
    return true;
  }
 catch (  Exception e) {
    ApplicationContext applicationContext=RegistryManager.getInstance().getApplicationContext(applicationId);
    if (applicationContext != null) {
      applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
      AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
    }
    String message="String_Node_Str" + applicationId;
    log.error(message,e);
    throw new RuntimeException(message,e);
  }
}

Fixed version (ground truth):
@Override public boolean deployApplication(String applicationId,String applicationPolicyId) throws ApplicationDefinitionException {
  try {
    Application application=ApplicationHolder.getApplications().getApplication(applicationId);
    if (application == null) {
      throw new RuntimeException("String_Node_Str" + applicationId);
    }
    ApplicationContext applicationContext=RegistryManager.getInstance().getApplicationContext(applicationId);
    if (applicationContext == null) {
      throw new RuntimeException("String_Node_Str" + applicationId);
    }
    application=parseApplication(applicationContext);
    AutoscalerUtil.validateApplicationPolicyAgainstApplication(applicationId,applicationPolicyId);
    try {
      ApplicationHolder.acquireWriteLock();
      application=ApplicationHolder.getApplications().getApplication(applicationId);
      application.setApplicationPolicyId(applicationPolicyId);
      ApplicationHolder.persistApplication(application);
    }
  finally {
      ApplicationHolder.releaseWriteLock();
    }
    NetworkPartitionAlgorithmContext algorithmContext=new NetworkPartitionAlgorithmContext(applicationId,applicationPolicyId,0);
    AutoscalerContext.getInstance().addNetworkPartitionAlgorithmContext(algorithmContext);
    if (!applicationContext.isMultiTenant()) {
      addApplicationSignUp(applicationContext,application.getKey(),findApplicationClusterIds(application));
    }
    applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
    AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
    ApplicationBuilder.handleApplicationDeployment(application,applicationContext.getComponents().getApplicationClusterContexts());
    log.info("String_Node_Str" + applicationId);
    return true;
  }
 catch (  Exception e) {
    ApplicationContext applicationContext=RegistryManager.getInstance().getApplicationContext(applicationId);
    if (applicationContext != null) {
      applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
      AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
    }
    String message="String_Node_Str" + applicationId;
    log.error(message,e);
    throw new RuntimeException(message,e);
  }
}