Source:
<code>private void cleanOlderProjects() { Map<Integer, ArrayList<ProjectVersion>> projectVersions = new HashMap<Integer, ArrayList<ProjectVersion>>(); for (ProjectVersion version : installedProjects.values()) { ArrayList<ProjectVersion> versionList = projectVersions.get(version.getProjectId()); if (versionList == null) { versionList = new ArrayList<ProjectVersion>(); projectVersions.put(version.getProjectId(), versionList); } versionList.add(version); } HashSet<Pair<Integer, Integer>> activeProjectVersions = new HashSet<Pair<Integer, Integer>>(); for (FlowRunner runner : runningFlows.values()) { ExecutableFlow flow = runner.getExecutableFlow(); activeProjectVersions.add(new Pair<Integer, Integer>(flow .getProjectId(), flow.getVersion())); } for (Map.Entry<Integer, ArrayList<ProjectVersion>> entry : projectVersions .entrySet()) { ArrayList<ProjectVersion> installedVersions = entry.getValue(); if (installedVersions.size() == 1) { continue; } Collections.sort(installedVersions); for (int i = 0; i < installedVersions.size() - 1; ++i) { ProjectVersion version = installedVersions.get(i); Pair<Integer, Integer> versionKey = new Pair<Integer, Integer>(version.getProjectId(), version.getVersion()); if (!activeProjectVersions.contains(versionKey)) { try { logger.info("Removing old unused installed project " + version.getProjectId() + ":" + version.getVersion()); deleteDirectory(version); installedProjects.remove(new Pair<Integer, Integer>(version .getProjectId(), version.getVersion())); <START> } catch (IOException e) { <END> e.printStackTrace(); } installedVersions.remove(versionKey); } } } }</code><technical_language>exception logged</technical_language>

Target:
private void cleanOlderProjects() { Map<Integer, ArrayList<ProjectVersion>> projectVersions = new HashMap<Integer, ArrayList<ProjectVersion>>(); for (ProjectVersion version : installedProjects.values()) { ArrayList<ProjectVersion> versionList = projectVersions.get(version.getProjectId()); if (versionList == null) { versionList = new ArrayList<ProjectVersion>(); projectVersions.put(version.getProjectId(), versionList); } versionList.add(version); } HashSet<Pair<Integer, Integer>> activeProjectVersions = new HashSet<Pair<Integer, Integer>>(); for (FlowRunner runner : runningFlows.values()) { ExecutableFlow flow = runner.getExecutableFlow(); activeProjectVersions.add(new Pair<Integer, Integer>(flow .getProjectId(), flow.getVersion())); } for (Map.Entry<Integer, ArrayList<ProjectVersion>> entry : projectVersions .entrySet()) { ArrayList<ProjectVersion> installedVersions = entry.getValue(); if (installedVersions.size() == 1) { continue; } Collections.sort(installedVersions); for (int i = 0; i < installedVersions.size() - 1; ++i) { ProjectVersion version = installedVersions.get(i); Pair<Integer, Integer> versionKey = new Pair<Integer, Integer>(version.getProjectId(), version.getVersion()); if (!activeProjectVersions.contains(versionKey)) { try { logger.info("Removing old unused installed project " + version.getProjectId() + ":" + version.getVersion()); deleteDirectory(version); installedProjects.remove(new Pair<Integer, Integer>(version .getProjectId(), version.getVersion())); } catch (IOException e) { logger.error(e); } installedVersions.remove(versionKey); } } } }