diff --git a/src/main/java/org/broad/igv/ucsc/Hub.java b/src/main/java/org/broad/igv/ucsc/Hub.java index 2c9e7ff46..86c6db14b 100644 --- a/src/main/java/org/broad/igv/ucsc/Hub.java +++ b/src/main/java/org/broad/igv/ucsc/Hub.java @@ -44,12 +44,19 @@ private Hub(String url) throws IOException { String baseURL = url.substring(0, idx + 1); this.baseURL = baseURL; - try { - this.host = "https://" + (new URL(url)).getHost(); - } catch (MalformedURLException e) { - // This should never happen - log.error("Error parsing base URL host", e); - throw new RuntimeException(e); + if(url.startsWith("https://") || url.startsWith("http://")) { + try { + URL tmp = new URL(url); + this.host = tmp.getProtocol() + "://" + tmp.getHost(); + } catch (MalformedURLException e) { + // This should never happen + log.error("Error parsing base URL host", e); + throw new RuntimeException(e); + } + } + else { + // Local file, no host + this.host = ""; } List stanzas = loadStanzas(url); @@ -68,6 +75,8 @@ private Hub(String url) throws IOException { throw new RuntimeException("Unexpected hub file -- expected 'genome' stanza but found " + stanzas.get(1).type); } + this.hub = stanzas.get(0); + // Load groups this. genomeStanza = stanzas.get(1); if (genomeStanza.hasProperty("groups")) {