Title: Operations on Buckets should use Storage.*Option types · Issue #702 · googleapis/google-cloud-java · GitHub
Open Graph Title: Operations on Buckets should use Storage.*Option types · Issue #702 · googleapis/google-cloud-java
X Title: Operations on Buckets should use Storage.*Option types · Issue #702 · googleapis/google-cloud-java
Description: Some of the static classes in Storage, such as BlobTargetOption which is used by Storage.create(), are also being erroneously used in Bucket. This is problematic because Bucket keys of of path Strings, not BlobInfo instances, and therefo...
Open Graph Description: Some of the static classes in Storage, such as BlobTargetOption which is used by Storage.create(), are also being erroneously used in Bucket. This is problematic because Bucket keys of of path Stri...
X Description: Some of the static classes in Storage, such as BlobTargetOption which is used by Storage.create(), are also being erroneously used in Bucket. This is problematic because Bucket keys of of path Stri...
Opengraph URL: https://github.com/googleapis/google-cloud-java/issues/702
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Operations on Buckets should use Storage.*Option types","articleBody":"Some of the static classes in `Storage`, such as `BlobTargetOption` which is used by `Storage.create()`, are also being erroneously used in `Bucket`. This is problematic because `Bucket` keys of of path `Strings`, not `BlobInfo` instances, and therefore isn't able to extract information like the blob's generation, causing a line like this:\n\n```\nbucket.create(file, data, null, BlobTargetOption.generationMatch());\n```\n\nto fail:\n\n```\n java.lang.IllegalArgumentException: Option ifGenerationMatch is missing a value\n at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)\n at com.google.gcloud.storage.StorageImpl.addToOptionMap(StorageImpl.java:651)\n at com.google.gcloud.storage.StorageImpl.addToOptionMap(StorageImpl.java:643)\n at com.google.gcloud.storage.StorageImpl.optionMap(StorageImpl.java:681)\n at com.google.gcloud.storage.StorageImpl.optionMap(StorageImpl.java:660)\n at com.google.gcloud.storage.StorageImpl.optionMap(StorageImpl.java:695)\n at com.google.gcloud.storage.StorageImpl.optionMap(StorageImpl.java:703)\n at com.google.gcloud.storage.StorageImpl.create(StorageImpl.java:140)\n at com.google.gcloud.storage.StorageImpl.create(StorageImpl.java:129)\n at com.google.gcloud.storage.Bucket.create(Bucket.java:360)\n```\n\nAnd there is no way in `Storage.BlobTargetOption` to actually specify a generation.\n\nI don't think `Bucket` should have any dependency on the `Storage.*Option` types. There's clearly a good amount of overlap, but I don't think that's a good enough reason for them to share these types. Even where they behave the same it's confusing for the caller.\n\nThey could extend from a shared parent if we wanted, but that should be an implementation detail.\n\nI can put together a patch to remove the dependencies on `Storage.*Option` from `Bucket` if that's desired.\n","author":{"url":"https://github.com/dimo414","@type":"Person","name":"dimo414"},"datePublished":"2016-03-02T06:19:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/702/google-cloud-java/issues/702"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0b661690-dad8-6ed8-8d5f-bc559d45c311 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B82C:259DC8:15396BB:1CF6778:6A4D7842 |
| html-safe-nonce | 281af61e4a53337d0a76ec2944709b0abe41a19f77106114fcef27ad4e71933c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODJDOjI1OURDODoxNTM5NkJCOjFDRjY3Nzg6NkE0RDc4NDIiLCJ2aXNpdG9yX2lkIjoiNDE4Mzc5OTM0MDcwNjEzNDA4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4ac22dc541fca763ede0085a6eca86b6e8519a150dc8a7ec807c82c83b0ecb1e |
| hovercard-subject-tag | issue:137784978 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-java/702/issue_layout |
| twitter:image | https://opengraph.githubassets.com/728f0544307e9980dc408b517f554e5f5766ddbcbaf40ea072ec964dd020bafc/googleapis/google-cloud-java/issues/702 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/728f0544307e9980dc408b517f554e5f5766ddbcbaf40ea072ec964dd020bafc/googleapis/google-cloud-java/issues/702 |
| og:image:alt | Some of the static classes in Storage, such as BlobTargetOption which is used by Storage.create(), are also being erroneously used in Bucket. This is problematic because Bucket keys of of path Stri... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dimo414 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f8e15305e2ab58890ca84b830615e375f5df303cf471cafcba0c08272981be3 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-java git https://github.com/googleapis/google-cloud-java.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 26181278 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 26181278 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8608b0750fc35e283e5ec5b094bff942d7a0e197 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width