Source:
<code>public void delete(ClaudiaData claudiaData, NetworkInstance networkInstance, String region) throws InvalidEntityException, InfrastructureException { log.info("Destroying network " + networkInstance.getNetworkName() + " region " + region); if (!canBeDeleted(claudiaData, networkInstance, region)) { log.info("The network cannot be deleted due to existing ports"); return; } log.info("Deleting the public interface"); try { log.info("Loading newtwokr " + networkInstance.getNetworkName() + " " + claudiaData.getVdc() + " " + region); networkInstance = networkInstanceDao.load(networkInstance.getNetworkName(), claudiaData.getVdc(), region); } catch (Exception e) { log.error("It is not possible to find the network " + e.getMessage()); throw new InvalidEntityException(networkInstance); } try { networkClient.deleteNetworkToPublicRouter(claudiaData, networkInstance, region); } catch (Exception e) { log.warn ("It is not possible to delete the public interface. It is not exist: "+ e.getMessage()); networkInstance.getSubNets().clear(); <START> networkInstanceDao.update(networkInstance); <END> } log.info("Deleting the subnets"); Set<SubNetworkInstance> subNetAux = networkInstance.cloneSubNets(); networkInstance.getSubNets().clear(); networkInstanceDao.update(networkInstance); for (SubNetworkInstance subNet : subNetAux) { subNetworkInstanceManager.delete(claudiaData, subNet, region); } log.info("Deleting the network"); networkClient.destroyNetwork(claudiaData, networkInstance, region); try { networkInstanceDao.remove(networkInstance); } catch (Exception e) { log.error("Error to remove the network in BD " + e.getMessage()); throw new InvalidEntityException(networkInstance); } }</code><technical_language>of throwing exception end of catch block, I lines 239 240 deleted executed in lines 245 246. I problems in subnet deletion if execute lines here. do think</technical_language>

Target:
public void delete(ClaudiaData claudiaData, NetworkInstance networkInstance, String region) throws InvalidEntityException, InfrastructureException { log.info("Destroying network " + networkInstance.getNetworkName() + " region " + region); if (!canBeDeleted(claudiaData, networkInstance, region)) { log.info("The network cannot be deleted due to existing ports"); return; } log.info("Deleting the public interface"); try { log.info("Loading newtwokr " + networkInstance.getNetworkName() + " " + claudiaData.getVdc() + " " + region); networkInstance = networkInstanceDao.load(networkInstance.getNetworkName(), claudiaData.getVdc(), region); } catch (Exception e) { log.error("It is not possible to find the network " + e.getMessage()); throw new InvalidEntityException(networkInstance); } try { networkClient.deleteNetworkToPublicRouter(claudiaData, networkInstance, region); } catch (Exception e) { log.warn ("It is not possible to delete the public interface. It is not exist: "+ e.getMessage()); } log.info("Deleting the subnets"); Set<SubNetworkInstance> subNetAux = networkInstance.cloneSubNets(); networkInstance.getSubNets().clear(); networkInstanceDao.update(networkInstance); for (SubNetworkInstance subNet : subNetAux) { subNetworkInstanceManager.delete(claudiaData, subNet, region); } log.info("Deleting the network"); networkClient.destroyNetwork(claudiaData, networkInstance, region); try { networkInstanceDao.remove(networkInstance); } catch (Exception e) { log.error("Error to remove the network in BD " + e.getMessage()); throw new InvalidEntityException(networkInstance); } }