Skip to content

Commit

Permalink
Bug fix -- support local path hub.txt files (for testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Jan 25, 2025
1 parent 4b4d02a commit 93e9f2a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/main/java/org/broad/igv/ucsc/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Stanza> stanzas = loadStanzas(url);
Expand All @@ -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")) {
Expand Down

0 comments on commit 93e9f2a

Please sign in to comment.