Source:
<code>public synchronized TransportNetwork getNetworkForScenario (String networkId, ProfileRequest request) { String scenarioId = request.scenarioId != null ? request.scenarioId : request.scenario.id; TransportNetwork baseNetwork = this.getNetwork(networkId); TransportNetwork scenarioNetwork = scenarioNetworkCache.get(scenarioId); if (scenarioNetwork == null) { LOG.info("Applying scenario to base network..."); Scenario scenario; if (request.scenario == null && request.scenarioId != null) { <START> LOG.info("Retrieving scenario stored separately"); <END> String scenarioKey = String.format("%s_%s.json", networkId, scenarioId); File scenarioFile = new File(cacheDir, scenarioKey); if (!scenarioFile.exists()) { try { S3Object obj = s3.getObject(sourceBucket, scenarioKey); InputStream is = obj.getObjectContent(); OutputStream os = new BufferedOutputStream(new FileOutputStream(scenarioFile)); ByteStreams.copy(is, os); is.close(); os.close(); } catch (Exception e) { LOG.info("Error retrieving scenario from S3", e); return null; } } try { scenario = JsonUtilities.objectMapper.readValue(scenarioFile, Scenario.class); } catch (IOException e) { LOG.error("Could not read scenario from disk", scenarioId, e); return null; } } else if (request.scenario != null) { scenario = request.scenario; } else { LOG.warn("No scenario specified"); scenario = new Scenario(); } scenarioNetwork = scenario.applyToTransportNetwork(baseNetwork); LOG.info("Done applying scenario. Caching the resulting network."); scenarioNetworkCache.put(scenario.id, scenarioNetwork); } else { LOG.info("Reusing cached TransportNetwork for scenario {}.", scenarioId); } return scenarioNetwork; }</code><technical_language>clear "separately" means. If I understand correctly this is a multilevel cache cache misses local filesystem fall S3</technical_language>

Target:
public synchronized TransportNetwork getNetworkForScenario (String networkId, ProfileRequest request) { String scenarioId = request.scenarioId != null ? request.scenarioId : request.scenario.id; TransportNetwork baseNetwork = this.getNetwork(networkId); TransportNetwork scenarioNetwork = scenarioNetworkCache.get(scenarioId); if (scenarioNetwork == null) { LOG.info("Applying scenario to base network..."); Scenario scenario; if (request.scenario == null && request.scenarioId != null) { LOG.info("Retrieving scenario stored separately on S3 rather than in the ProfileRequest"); String scenarioKey = String.format("%s_%s.json", networkId, scenarioId); File scenarioFile = new File(cacheDir, scenarioKey); if (!scenarioFile.exists()) { try { S3Object obj = s3.getObject(sourceBucket, scenarioKey); InputStream is = obj.getObjectContent(); OutputStream os = new BufferedOutputStream(new FileOutputStream(scenarioFile)); ByteStreams.copy(is, os); is.close(); os.close(); } catch (Exception e) { LOG.info("Error retrieving scenario from S3", e); return null; } } try { scenario = JsonUtilities.objectMapper.readValue(scenarioFile, Scenario.class); } catch (IOException e) { LOG.error("Could not read scenario from disk", scenarioId, e); return null; } } else if (request.scenario != null) { scenario = request.scenario; } else { LOG.warn("No scenario specified"); scenario = new Scenario(); } scenarioNetwork = scenario.applyToTransportNetwork(baseNetwork); LOG.info("Done applying scenario. Caching the resulting network."); scenarioNetworkCache.put(scenario.id, scenarioNetwork); } else { LOG.info("Reusing cached TransportNetwork for scenario {}.", scenarioId); } return scenarioNetwork; }