Source:
<code>public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { <START> log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " <END> + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }</code><technical_language>Destroying environment instance</technical_language>

Target:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying environment instance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstance associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + " " + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }