Skip to content

Commit e0aaaba

Browse files
author
Ajay Kannan
committed
Fix version in LocalGcdHelper and check for null values when removing URL scheme
1 parent 4d2fe25 commit e0aaaba

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

gcloud-java-datastore/src/main/java/com/google/gcloud/spi/DefaultDatastoreRpc.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ private static boolean includesScheme(String url) {
8989
}
9090

9191
private static String removeScheme(String url) {
92-
if (url.startsWith("https://")) {
93-
return url.substring("https://".length());
94-
} else if (url.startsWith("http://")) {
95-
return url.substring("http://".length());
92+
if (url != null) {
93+
if (url.startsWith("https://")) {
94+
return url.substring("https://".length());
95+
} else if (url.startsWith("http://")) {
96+
return url.substring("http://".length());
97+
}
9698
}
9799
return url;
98100
}

gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LocalGcdHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ public static void main(String... args) throws IOException, InterruptedException
309309
public static boolean isActive(String projectId) {
310310
try {
311311
StringBuilder urlBuilder = new StringBuilder("http://localhost:").append(PORT);
312-
urlBuilder.append("/datastore/" + com.google.datastore.v1beta3.client.DatastoreFactory.VERSION
313-
+ "/projects/").append(projectId).append(":lookup");
312+
urlBuilder.append("/datastore/v1beta3/projects/").append(projectId).append(":lookup");
314313
URL url = new URL(urlBuilder.toString());
315314
try (BufferedReader reader =
316315
new BufferedReader(new InputStreamReader(url.openStream(), UTF_8))) {

0 commit comments

Comments
 (0)