Source:
public Optional<String> getContent(String mainDescName, String mainDescriptor, Set<SourceFile> secondarySourceFiles, LanguageHandlerInterface.Type type, ToolDAO dao) { String callType = "call"; String toolType = "tool"; Map<String, ToolInfo> toolInfoMap; Map<String, String> namespaceToPath; File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", Files.createTempDir()); Files.asCharSink(tempMainDescriptor, StandardCharsets.UTF_8).write(mainDescriptor); WdlBridge wdlBridge = new WdlBridge(); final Map<String, String> pathToContentMap = secondarySourceFiles.stream() .collect(Collectors.toMap(SourceFile::getAbsolutePath, SourceFile::getContent)); wdlBridge.setSecondaryFiles(new HashMap<>(pathToContentMap)); Map<String, String> callsToDockerMap = wdlBridge.getCallsToDockerMap(tempMainDescriptor.getAbsolutePath(), mainDescName); Map<String, List<String>> callsToDependencies = wdlBridge.getCallsToDependencies(tempMainDescriptor.getAbsolutePath(), mainDescName); toolInfoMap = mapConverterToToolInfo(callsToDockerMap, callsToDependencies); namespaceToPath = wdlBridge.getImportMap(tempMainDescriptor.getAbsolutePath(), mainDescName); } catch (WdlParser.SyntaxError e) { return Optional.empty(); } catch (IOException | NoSuchElementException e) { throw new CustomWebApplicationException("could not process request " + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } finally { FileUtils.deleteQuietly(tempMainDescriptor); } return convertMapsToContent(mainDescName, type, dao, callType, toolType, toolInfoMap, namespaceToPath); }

Target:
public Optional<String> getContent(String mainDescName, String mainDescriptor, Set<SourceFile> secondarySourceFiles, LanguageHandlerInterface.Type type, ToolDAO dao) { String callType = "call"; String toolType = "tool"; Map<String, ToolInfo> toolInfoMap; Map<String, String> namespaceToPath; File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", Files.createTempDir()); Files.asCharSink(tempMainDescriptor, StandardCharsets.UTF_8).write(mainDescriptor); WdlBridge wdlBridge = new WdlBridge(); final Map<String, String> pathToContentMap = secondarySourceFiles.stream() .collect(Collectors.toMap(SourceFile::getAbsolutePath, SourceFile::getContent)); wdlBridge.setSecondaryFiles(new HashMap<>(pathToContentMap)); Map<String, String> callsToDockerMap = wdlBridge.getCallsToDockerMap(tempMainDescriptor.getAbsolutePath(), mainDescName); Map<String, List<String>> callsToDependencies = wdlBridge.getCallsToDependencies(tempMainDescriptor.getAbsolutePath(), mainDescName); toolInfoMap = mapConverterToToolInfo(callsToDockerMap, callsToDependencies); namespaceToPath = wdlBridge.getImportMap(tempMainDescriptor.getAbsolutePath(), mainDescName); } catch (WdlParser.SyntaxError ex) { final String exMsg = WDLHandler.WDL_PARSE_ERROR + ex.getMessage(); LOG.error(exMsg, ex); throw new CustomWebApplicationException(exMsg, HttpStatus.SC_BAD_REQUEST); } catch (IOException | NoSuchElementException ex) { final String exMsg = "Could not process request, " + ex.getMessage(); LOG.error(exMsg, ex); throw new CustomWebApplicationException(exMsg, HttpStatus.SC_INTERNAL_SERVER_ERROR); } finally { FileUtils.deleteQuietly(tempMainDescriptor); } return convertMapsToContent(mainDescName, type, dao, callType, toolType, toolInfoMap, namespaceToPath); }