Skip to content

Conversation

@cshamrick
Copy link
Contributor

@cshamrick cshamrick commented Dec 5, 2025

Key Changes:

  • Update GitHub workflow to include examples scope for conventional commits.
  • Enhance examples with more robust setup logic, including fetching/creating dependent resources.
  • Implemented try-catch blocks for graceful exception handling and clearer user feedback
  • Improved logging to provide better insight into the execution flow.

These improvements enhance the quality and usability of the examples, providing a better experience for developers using the Java SDK.

Signed-off-by: Scott Hamrick <2623452+cshamrick@users.noreply.github.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @cshamrick, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Java SDK examples by integrating Log4j2 for improved logging and debugging capabilities. It also introduces more robust and dynamic setup logic in several examples, particularly for creating attributes and subject mappings, ensuring that dependent resources are either fetched or created on the fly. These changes aim to make the examples more self-contained, easier to understand, and more resilient to changes in the environment.

Highlights

  • Enhanced Logging: Log4j2 has been integrated across most Java example files, replacing direct System.out.println calls with structured logging for better output visibility and debugging.
  • Improved Example Setup Logic: The CreateAttribute and CreateSubjectMapping examples now include more robust setup logic, dynamically fetching or creating necessary dependent resources like namespaces and attributes, making them more self-contained and functional.
  • Refactored Subject Mapping Creation: The CreateSubjectMapping example was significantly refactored to dynamically create a SubjectConditionSet and use dynamically retrieved attribute values, removing reliance on hardcoded IDs.
  • Code Cleanup and Clarity: Redundant imports like java.util.concurrent.ExecutionException have been removed, and variable names in some examples have been improved for better readability.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/checks.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully improves the examples by introducing Log4j2 for better logging and enhancing the setup logic to be more robust, particularly in CreateSubjectMapping.java. However, there are a few areas for improvement. A significant issue is that the SDK resource, which is AutoCloseable, is not being closed in most of the example files, potentially leading to resource leaks. I've recommended using try-with-resources statements to address this. Additionally, there are several instances where collections are accessed without checking if they are empty, which could cause IndexOutOfBoundsException. Lastly, CreateNamespace.java was missed during the logging refactor and still uses System.out.println.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Signed-off-by: Scott Hamrick <2623452+cshamrick@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Signed-off-by: Scott Hamrick <2623452+cshamrick@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Signed-off-by: Scott Hamrick <2623452+cshamrick@users.noreply.github.com>
@cshamrick cshamrick marked this pull request as ready for review December 8, 2025 15:18
@cshamrick cshamrick requested review from a team as code owners December 8, 2025 15:18
elizabethhealy
elizabethhealy previously approved these changes Dec 8, 2025
Copy link
Member

@elizabethhealy elizabethhealy left a comment

Choose a reason for hiding this comment

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

lgtm! it doesnt look like we run these as part of ci, maybe we can add a ticket to the backlog, hopefully that would help in keeping these up to date

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Signed-off-by: Scott Hamrick <2623452+cshamrick@users.noreply.github.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 8, 2025

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

X-Test Failure Report

✅ go-v0.4.34
✅ js-v0.4.34
✅ js-main
✅ go-main
✅ java-main

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

@cshamrick cshamrick merged commit 2e5660c into main Dec 8, 2025
28 of 31 checks passed
@cshamrick cshamrick deleted the refactor-examples branch December 8, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants