Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gcloud-java-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ To run examples from your command line:
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name add my\ comment"
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name display"
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name delete"
mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name set [email protected] 1234"
```

* Here's an example run of `DnsExample`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class BigQueryExample {

private abstract static class BigQueryAction<T> {

abstract void run(BigQuery bigquery, T request) throws Exception;
abstract void run(BigQuery bigquery, T arg) throws Exception;

abstract T parse(String... args) throws Exception;

Expand Down Expand Up @@ -775,18 +775,18 @@ public static void main(String... args) throws Exception {
return;
}
BigQuery bigquery = optionsBuilder.build().service();
Object request;
Object arg;
try {
request = action.parse(args);
arg = action.parse(args);
} catch (IllegalArgumentException ex) {
System.out.println("Invalid input for action '" + actionName + "'. " + ex.getMessage());
System.out.println("Expected: " + action.params());
System.out.printf("Invalid input for action '%s'. %s%n", actionName, ex.getMessage());
System.out.printf("Expected: %s%n", action.params());
return;
} catch (Exception ex) {
System.out.println("Failed to parse request.");
System.out.println("Failed to parse arguments.");
ex.printStackTrace();
return;
}
action.run(bigquery, request);
action.run(bigquery, arg);
}
}
Loading