Skip to content

docs: Update SpannerSample.java to align with best practices #3625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 17, 2025

Conversation

adhiggs
Copy link
Contributor

@adhiggs adhiggs commented Feb 1, 2025

docs: update SpannerSample.java to align with best practices

Encapsulates both ResultSet statements in try-with-resources statements to align with best practices.

Fixes #3623 ☕️

Encapsulates both statements in a try-with-resources statement
@adhiggs adhiggs requested review from a team as code owners February 1, 2025 02:29
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner API. labels Feb 1, 2025
@adhiggs adhiggs changed the title Update SpannerSample.java fix: Update SpannerSample.java to align with best practices Feb 1, 2025
@adhiggs adhiggs changed the title fix: Update SpannerSample.java to align with best practices fix:Update SpannerSample.java to align with best practices Feb 1, 2025
@adhiggs adhiggs changed the title fix:Update SpannerSample.java to align with best practices docs: Update SpannerSample.java to align with best practices Feb 1, 2025
@adhiggs
Copy link
Contributor Author

adhiggs commented Feb 1, 2025

I don't work with github very often, so if I can get a hand in getting the tests passed, I would greatly appreciate it.

@sakthivelmanii
Copy link
Collaborator

@adhiggs please update your commit message to follow the convention. https://www.conventionalcommits.org/en/v1.0.0/

@adhiggs
Copy link
Contributor Author

adhiggs commented Feb 10, 2025

@adhiggs please update your commit message to follow the convention. https://www.conventionalcommits.org/en/v1.0.0/

@sakthivelmanii - I think I got it? PTAL.

@adhiggs
Copy link
Contributor Author

adhiggs commented May 13, 2025

@sakthivelmanii - Could you take a look at this request?

sakthivelmanii
sakthivelmanii previously approved these changes May 14, 2025
Copy link
Collaborator

@sakthivelmanii sakthivelmanii left a comment

Choose a reason for hiding this comment

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

Please fix the code issue

@sakthivelmanii sakthivelmanii added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 14, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 14, 2025
@sakthivelmanii sakthivelmanii added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 15, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 15, 2025
@sakthivelmanii
Copy link
Collaborator

sakthivelmanii commented May 15, 2025

Please fix the checkstyle issues.

Error:  src/main/java/com/example/spanner/SpannerSample.java:[685,7] (indentation) Indentation: 'while' has incorrect indentation level 6, expected level should be 8.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[686,[9](https://github.com/googleapis/java-spanner/actions/runs/15027603684/job/42257173380?pr=3625#step:4:10)] (indentation) Indentation: 'while' child has incorrect indentation level 8, expected level should be 10.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[689,7] (indentation) Indentation: 'while rcurly' has incorrect indentation level 6, expected level should be 8.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[690,5] (indentation) Indentation: 'try rcurly' has incorrect indentation level 4, expected level should be 6.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[691,5] (indentation) Indentation: 'try' has incorrect indentation level 4, expected level should be 6.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[694,7] (indentation) Indentation: 'while' has incorrect indentation level 6, expected level should be 8.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[695,9] (indentation) Indentation: 'while' child has incorrect indentation level 8, expected level should be [10](https://github.com/googleapis/java-spanner/actions/runs/15027603684/job/42257173380?pr=3625#step:4:11).
Error:  src/main/java/com/example/spanner/SpannerSample.java:[698,7] (indentation) Indentation: 'while rcurly' has incorrect indentation level 6, expected level should be 8.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[699,5] (indentation) Indentation: 'try rcurly' has incorrect indentation level 4, expected level should be 6.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[700,3] (indentation) Indentation: 'try rcurly' has incorrect indentation level 2, expected level should be 4.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[701,1] (indentation) Indentation: 'method def rcurly' has incorrect indentation level 0, expected level should be 2.
Error:  src/main/java/com/example/spanner/SpannerSample.java:[702,1] (indentation) CommentsIndentation: Comment has incorrect indentation level 0, expected is 2, indentation should be the same level as line 705.
Error:  Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0:check (default-cli) on project spanner-snippets: You have [12](https://github.com/googleapis/java-spanner/actions/runs/15027603684/job/42257173380?pr=3625#step:4:13) Checkstyle violations. -> [Help 1]

https://github.com/googleapis/java-spanner/actions/runs/15027603684/job/42257173380?pr=3625

@adhiggs
Copy link
Contributor Author

adhiggs commented May 27, 2025

Thanks for your patience! Spacing issuse should be sorted.

@sakthivelmanii sakthivelmanii added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 17, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 17, 2025
@rahul2393 rahul2393 merged commit 7bfc62d into googleapis:main Jun 17, 2025
33 of 35 checks passed
svc-squareup-copybara pushed a commit to cashapp/misk that referenced this pull request Jun 30, 2025
| Package | Type | Package file | Manager | Update | Change |
|---|---|---|---|---|---|
|
[com.google.cloud:google-cloud-spanner](https://github.com/googleapis/java-spanner)
| dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`6.95.1` -> `6.96.0` |
|
[com.google.cloud:google-cloud-datastore](https://github.com/googleapis/java-datastore)
| dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`2.29.2` -> `2.30.0` |
|
[com.squareup.okio:okio-fakefilesystem](https://github.com/square/okio)
| dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`3.13.0` -> `3.14.0` |
| [com.squareup.okio:okio](https://github.com/square/okio) |
dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`3.13.0` -> `3.14.0` |
| [com.datadoghq:dd-trace-api](https://github.com/datadog/dd-trace-java)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`1.50.0` -> `1.50.1` |
| [software.amazon.awssdk:sdk-core](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
| [software.amazon.awssdk:sqs](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
|
[software.amazon.awssdk:dynamodb-enhanced](https://aws.amazon.com/sdkforjava)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
| [software.amazon.awssdk:dynamodb](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
| [software.amazon.awssdk:aws-core](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
| [software.amazon.awssdk:bom](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |
| [software.amazon.awssdk:auth](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.31.71` -> `2.31.73` |

---

### Release Notes

<details>
<summary>googleapis/java-spanner
(com.google.cloud:google-cloud-spanner)</summary>

###
[`v6.96.0`](https://github.com/googleapis/java-spanner/blob/HEAD/CHANGELOG.md#6960-2025-06-27)

##### Features

- Allow JDBC to configure directpath for connection
([#&#8203;3929](googleapis/java-spanner#3929))
([d754f1f](googleapis/java-spanner@d754f1f))
- Support getOrNull and getOrDefault in Struct
([#&#8203;3914](googleapis/java-spanner#3914))
([1dc5a3e](googleapis/java-spanner@1dc5a3e))
- Use multiplexed sessions for read-only transactions
([#&#8203;3917](googleapis/java-spanner#3917))
([37fdc27](googleapis/java-spanner@37fdc27))

##### Bug Fixes

- Allow zero durations to be set for connections
([#&#8203;3916](googleapis/java-spanner#3916))
([43ea4fa](googleapis/java-spanner@43ea4fa))

##### Documentation

- Add snippet for Repeatable Read configuration at client and
transaction
([#&#8203;3908](googleapis/java-spanner#3908))
([ff3d212](googleapis/java-spanner@ff3d212))
- Update SpannerSample.java to align with best practices
([#&#8203;3625](googleapis/java-spanner#3625))
([7bfc62d](googleapis/java-spanner@7bfc62d))

</details>

<details>
<summary>googleapis/java-datastore
(com.google.cloud:google-cloud-datastore)</summary>

###
[`v2.30.0`](https://github.com/googleapis/java-datastore/blob/HEAD/CHANGELOG.md#2300-2025-06-26)

##### Features

- Enable grpc configurator for client-side tracing
([#&#8203;1886](googleapis/java-datastore#1886))
([97004c8](googleapis/java-datastore@97004c8))

##### Dependencies

- Update dependency com.google.cloud:gapic-libraries-bom to v1.60.0
([#&#8203;1799](googleapis/java-datastore#1799))
([bf2a33c](googleapis/java-datastore@bf2a33c))
- Update dependency com.google.cloud:sdk-platform-java-config to v3.50.0
([#&#8203;1897](googleapis/java-datastore#1897))
([a8d99cd](googleapis/java-datastore@a8d99cd))
- Update googleapis/sdk-platform-java action to v2.59.1
([#&#8203;1880](googleapis/java-datastore#1880))
([4fb9929](googleapis/java-datastore@4fb9929))
- Update googleapis/sdk-platform-java action to v2.60.0
([#&#8203;1898](googleapis/java-datastore#1898))
([0921f86](googleapis/java-datastore@0921f86))

</details>

<details>
<summary>square/okio (com.squareup.okio:okio-fakefilesystem)</summary>

###
[`v3.14.0`](https://github.com/square/okio/blob/HEAD/CHANGELOG.md#Version-3140)

*2025-06-28*

- Upgrade: \[kotlinx-datetime 0.7.0]\[datetime\_0\_7\_0]. This impacts
the `okio-fakefilesystem`
artifact only. This is a binary-incompatible backwards-incompatible
change that cannot co-exist
with previous releases of `okio-fakefilesystem`! If you observe a
`NoSuchMethodError` calling
`FakeFileSystem.init`, update the calling code to this release (or
newer) and recompile. We don't
like imposing backwards-incompatible changes like this on you and do so
regretfully.

</details>

<details>
<summary>datadog/dd-trace-java (com.datadoghq:dd-trace-api)</summary>

###
[`v1.50.1`](https://github.com/DataDog/dd-trace-java/releases/tag/v1.50.1):
1.50.1

### Components

#### Build & Tooling

- ✨ Migrate publishing to Maven Central Portal
([#&#8203;9054](DataDog/dd-trace-java#9054) -
[@&#8203;sarahchen6](https://github.com/sarahchen6))

#### Trace context propagation

- 🐛 Drop Baggage when `TracePropagationBehaviorExtract=IGNORE`
([#&#8203;9052](DataDog/dd-trace-java#9052) -
[@&#8203;mhlidd](https://github.com/mhlidd))

#### Tracer public API

- 🐛 Fix ArrayIndexOutOfBoundsException in PercentEscaper
([#&#8203;9050](DataDog/dd-trace-java#9050) -
[@&#8203;mhlidd](https://github.com/mhlidd))

### Instrumentations

#### Akka instrumentation

- 🐛 Fix NPE in akka-http and pekko-http integrations
([#&#8203;9049](DataDog/dd-trace-java#9049) -
[@&#8203;mcculls](https://github.com/mcculls))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 6pm every weekday,before 2am
every weekday" in timezone Australia/Melbourne, Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

GitOrigin-RevId: e80867de3af2534eca79fe17a33f5c76801bcd6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: Update SpannerSample.java to align with best practices
4 participants