private String downloadHash()

in taverna-download-impl/src/main/java/org/apache/taverna/download/impl/DownloadManagerImpl.java [128:147]


	private String downloadHash(URI source) throws DownloadException {
		try {
			// We want to handle http/https with HTTPClient
			if (source.getScheme().equalsIgnoreCase("http") || source.getScheme().equalsIgnoreCase("https")) {
				logger.info("Downloading checksum " + source);
				return Request.Get(source).userAgent(getUserAgent()).connectTimeout(TIMEOUT).socketTimeout(TIMEOUT).execute()
						.returnContent().asString(StandardCharsets.ISO_8859_1);
			} else {
				// Try as a supported Path, e.g. file: or relative path
				try {
					Path path = Paths.get(source);
					return Files.readAllLines(path, StandardCharsets.ISO_8859_1).get(0);				
				} catch (FileSystemNotFoundException e) {
					throw new DownloadException("Unsupported URL scheme: " + source.getScheme());
				}
 			}
		} catch (IOException e) {
			throw new DownloadException(String.format("Error downloading %1$s", source), e);
		}		
	}