Skip to content

Commit

Permalink
Support s3 URIs.
Browse files Browse the repository at this point in the history
toURL() fails if the URI's scheme is s3. Since the URI gets converted
to a string, just return toString().
  • Loading branch information
mcquin committed Mar 2, 2018
1 parent 4854bc6 commit e06f254
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main/java/org/cellprofiler/imageset/ImageFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,21 @@ public String getPathName() {
int lastSepIndex = path.lastIndexOf("/");
if (lastSepIndex <= 0) {
final URI uriOut = new URI(uri.getScheme(), uri.getHost(), null, null);
pathName = uriOut.toURL().toString();
pathName = uriOut.toString();
} else {
final URI uriOut = new URI(
uri.getScheme(),
uri.getHost(),
path.substring(0, lastSepIndex),
null);
pathName = uriOut.toURL().toString();
pathName = uriOut.toString();
}
}
} catch (URISyntaxException e) {
LoggerFactory.getLogger(getClass()).info(
"Failed to extract metadata from badly formed URL: " +
uri.toString());
return null;
} catch (MalformedURLException e) {
LoggerFactory.getLogger(getClass()).warn(
String.format("Failed to reconstitute path from URL, \"%s\"", uri.toString()));
return null;
}
}
return pathName;
Expand Down

0 comments on commit e06f254

Please sign in to comment.