Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Handle file-based repositories. #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jkinkead
Copy link
Contributor

This adds support for repositories in the local file system.

Fixes #64 .

@bazel-io
Copy link
Member

Can one of the admins verify this patch?

HttpURLConnection connection = (HttpURLConnection) new URL(sha1Url).openConnection();
connection.setInstanceFollowRedirects(true);
URLConnection connection = new URL(sha1Url).openConnection();
if (connection instanceof HttpURLConnection) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again.

In the situation that it is not an HttpURLConnection, it would be a JarURLConnection. I doubt this should occur, so can you throw an exception?

Additionally, can you separate the sha functionality into a separate class, and add a simple test case for when this URLConnection fails?

Resolver.java has gotten fairly bloated, and I am trying to steer it so that Resolver.java has less functionality backed in. (see VersionResolver.java as an example)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connection can be an instance of any type that the URLStreamHandler for the protocol returns. For a file, this appears to be sun.net.www.protocol.file.FileURLConnection (at least on the JRE I'm using).

Both the sha and pom files will have the protocol file if the repository has a file URL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants