Skip to content

Commit 2c2a77c

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 1167 b: refs/heads/master c: 6c40825 h: refs/heads/master i: 1165: c375dfe 1163: 70aa88d 1159: 78789d9 1151: f6dc7d2 v: v3
1 parent e8ab53d commit 2c2a77c

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: ad12f4143bbcb5d6557055452717c7380cf54959
2+
refs/heads/master: 6c408256e1621c7e0f3640fb7a4ffdef139f5241
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.google.gcloud;
1818

1919
import static com.google.common.base.MoreObjects.firstNonNull;
20-
import static com.google.common.base.Preconditions.checkNotNull;
20+
import static com.google.common.base.Preconditions.checkArgument;
2121
import static java.nio.charset.StandardCharsets.UTF_8;
2222

2323
import com.google.api.client.extensions.appengine.http.UrlFetchTransport;
@@ -308,7 +308,10 @@ protected ServiceOptions(Class<? extends ServiceFactory<ServiceT, OptionsT>> ser
308308
Builder<ServiceT, ServiceRpcT, OptionsT, ?> builder) {
309309
projectId = builder.projectId != null ? builder.projectId : defaultProject();
310310
if (projectIdRequired()) {
311-
checkNotNull(projectId);
311+
checkArgument(
312+
projectId != null,
313+
"A project ID is required for this service but could not be determined from the builder or "
314+
+ "the environment. Please set a project ID using the builder.");
312315
}
313316
host = firstNonNull(builder.host, defaultHost());
314317
httpTransportFactory = firstNonNull(builder.httpTransportFactory,
@@ -334,7 +337,7 @@ protected ServiceOptions(Class<? extends ServiceFactory<ServiceT, OptionsT>> ser
334337
*
335338
* @return true if a project ID is required to use the service, false if not.
336339
*/
337-
public boolean projectIdRequired() {
340+
protected boolean projectIdRequired() {
338341
return true;
339342
}
340343

0 commit comments

Comments
 (0)