Skip to content

Commit b0f734e

Browse files
authored
Merge pull request #1243 from mziccard/pubsub-snippets
Add snippets to PubSub's javadoc, PubSubSnippets class and tests
2 parents d504bb6 + e0dbb7e commit b0f734e

File tree

5 files changed

+1952
-23
lines changed

5 files changed

+1952
-23
lines changed

google-cloud-examples/src/main/java/com/google/cloud/examples/logging/snippets/LoggingSnippets.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public Sink updateSinkAsync(String sinkName, String datasetName)
134134
public Sink getSink(String sinkName) {
135135
// [START getSink]
136136
Sink sink = logging.getSink(sinkName);
137-
if (sink != null) {
137+
if (sink == null) {
138138
// sink was not found
139139
}
140140
// [END getSink]
@@ -151,7 +151,7 @@ public Sink getSinkAsync(String sinkName) throws ExecutionException, Interrupted
151151
Future<Sink> future = logging.getSinkAsync(sinkName);
152152
// ...
153153
Sink sink = future.get();
154-
if (sink != null) {
154+
if (sink == null) {
155155
// sink was not found
156156
}
157157
// [END getSinkAsync]
@@ -371,7 +371,7 @@ public Metric updateMetricAsync(String metricName)
371371
public Metric getMetric(String metricName) {
372372
// [START getMetric]
373373
Metric metric = logging.getMetric(metricName);
374-
if (metric != null) {
374+
if (metric == null) {
375375
// metric was not found
376376
}
377377
// [END getMetric]
@@ -388,7 +388,7 @@ public Metric getMetricAsync(String metricName) throws ExecutionException, Inter
388388
Future<Metric> future = logging.getMetricAsync(metricName);
389389
// ...
390390
Metric metric = future.get();
391-
if (metric != null) {
391+
if (metric == null) {
392392
// metric was not found
393393
}
394394
// [END getMetricAsync]

0 commit comments

Comments
 (0)