KEMBAR78
docs: Add preconditions to some samples by JesseLovelace · Pull Request #1600 · googleapis/java-storage · GitHub
Skip to content

Conversation

@JesseLovelace
Copy link
Contributor

Adds preconditions to some Java samples. This is half the samples that need to be added, @sydney-munro is going to do the other half

@JesseLovelace JesseLovelace requested a review from frankyn August 31, 2022 01:13
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. samples Issues that are directly related to samples. labels Aug 31, 2022
@gcf-owl-bot gcf-owl-bot bot requested review from a team as code owners August 31, 2022 01:16
Copy link

@Shabirmean Shabirmean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Overall.

Some minor formatting related comments. Also PTAL at the failing tests

// conditions and data corruptions. The request to upload returns a 412 error if
// the object's generation number does not match your precondition.
Storage.BlobSourceOption precondition =
Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could 404 and return null if there isn't an object for blobId. Possibly move it to it's own line to ease debugging?

// conditions and data corruptions. The request to upload returns a 412 error if
// the object's generation number does not match your precondition.
Storage.BlobSourceOption precondition =
Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

// the object's generation number does not match your precondition.
Storage.BlobSourceOption precondition =
Storage.BlobSourceOption.generationMatch(
storage.get(bucketName, objectName).getGeneration());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

// conditions and data corruptions. The request to upload returns a 412 error if
// the object's generation number does not match your precondition.
Storage.BlobSourceOption precondition =
Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Collaborator

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the null checks!

@JesseLovelace JesseLovelace added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 12, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 12, 2022
@JesseLovelace JesseLovelace merged commit 4b3be44 into main Sep 23, 2022
@JesseLovelace JesseLovelace deleted the jesseprecon branch September 23, 2022 18:15
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 4, 2022
🤖 I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-storage/compare/v2.12.0...v2.13.0) (2022-10-03)


### Features

* Regenerate gapic storage v2 client as of googleapis/googleapis@844d0f7 ([#1673](https://togithub.com/googleapis/java-storage/issues/1673)) ([bd818b3](https://togithub.com/googleapis/java-storage/commit/bd818b311186c37ceb527630ed56755d89e2b71b))


### Documentation

* Add preconditions to some samples ([#1600](https://togithub.com/googleapis/java-storage/issues/1600)) ([4b3be44](https://togithub.com/googleapis/java-storage/commit/4b3be44bd4c53613f08bbd01d3b4a9ded419565d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#1685](https://togithub.com/googleapis/java-storage/issues/1685)) ([3d8f550](https://togithub.com/googleapis/java-storage/commit/3d8f550e4d646a7d4bda6f9e74bc5996d573d5b4))
* Update dependency gcp-releasetool to v1.8.9 ([#1684](https://togithub.com/googleapis/java-storage/issues/1684)) ([54a5159](https://togithub.com/googleapis/java-storage/commit/54a5159707efd6a2d4abd0273ab7c279f507005b))
* Update dependency importlib-metadata to v4.13.0 ([#1682](https://togithub.com/googleapis/java-storage/issues/1682)) ([2487aff](https://togithub.com/googleapis/java-storage/commit/2487affad5a1adf1c39589d8f8a976c7f245b0c9))
* Update dependency importlib-metadata to v5 ([#1683](https://togithub.com/googleapis/java-storage/issues/1683)) ([020fe8c](https://togithub.com/googleapis/java-storage/commit/020fe8ce7991e8c72135a2912f615ed50cc68fd4))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.14 ([#1643](https://togithub.com/googleapis/java-storage/issues/1643)) ([ab3a198](https://togithub.com/googleapis/java-storage/commit/ab3a198115ae637710982f838231d2d36c029486))
* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.1 ([#1635](https://togithub.com/googleapis/java-storage/issues/1635)) ([ba85ab6](https://togithub.com/googleapis/java-storage/commit/ba85ab6ce9304b4c426538d2bacc99ef73ed2b0e))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. samples Issues that are directly related to samples. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants