aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java
diff options
context:
space:
mode:
authorGravatar buchgr <buchgr@google.com>2017-07-14 14:58:07 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-14 16:34:49 +0200
commitbcbd2da340ed24a026729104dc0ba2a71cf70463 (patch)
treee35a267f88cdb383bf06406a2889a0c06f4fa9c9 /src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java
parent21fc8eb2c15e5b83b591084c68887827222b6e73 (diff)
remote: Improve error handling for --remote_* cmd line flags. Fixes #3361, #3358
- Move flag handling into RemoteModule to fail as early as possible. - Make error messages from flag handling human readable. - Fix a bug where remote execution would only support TLS with a root certificate being specified. - If a remote executor without a remote cache is specified, assume the remote cache to be the same as the executor. PiperOrigin-RevId: 161946029
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java b/src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java
index 60ff77b7bd..82e9b47bad 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/blobstore/RestBlobStore.java
@@ -17,6 +17,8 @@ import com.google.common.io.ByteStreams;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -53,7 +55,8 @@ public final class RestBlobStore implements SimpleBlobStore {
* @param baseUrl base URL for the remote cache
* @param poolSize maximum number of simultaneous connections
*/
- public RestBlobStore(String baseUrl, int poolSize) {
+ public RestBlobStore(String baseUrl, int poolSize) throws IOException {
+ validateUrl(baseUrl);
this.baseUrl = baseUrl;
connMan = new PoolingHttpClientConnectionManager();
connMan.setDefaultMaxPerRoute(poolSize);
@@ -122,4 +125,12 @@ public final class RestBlobStore implements SimpleBlobStore {
return null;
});
}
-} \ No newline at end of file
+
+ private void validateUrl(String url) throws IOException {
+ try {
+ new URI(url);
+ } catch (URISyntaxException e) {
+ throw new IOException("Failed to parse remote REST cache URL: " + baseUrl, e);
+ }
+ }
+}