Skip to content

Conversation

minherz
Copy link
Contributor

@minherz minherz commented Nov 24, 2021

Fix behavior of getRegion and getZone methods when attributes aren't defined.
Align getNamespaceName return value with other methods to return null.

Addresses googleapis/java-logging-logback#599 when incorrect resource type is enforced.

Fix behavior of getRegion and getZone methods when attributes aren't defined.
Align getNamespaceName return value with other methods to return null.
@minherz minherz requested review from a team as code owners November 24, 2021 12:40
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 24, 2021
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Nov 24, 2021
Copy link
Contributor

@losalex losalex left a comment

Choose a reason for hiding this comment

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

LGTM

private String getRegion() {
String loc = getter.getAttribute("instance/region");
return loc.substring(loc.lastIndexOf('/') + 1);
if (loc != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: return loc != null ? loc.substring(loc.lastIndexOf('/') + 1) : null;

String loc = getter.getAttribute("instance/zone");
return loc.substring(loc.lastIndexOf('/') + 1);
if (loc != null) {
return loc.substring(loc.lastIndexOf('/') + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Same as above - simplifies reading

@minherz minherz merged commit e8cf6f9 into main Nov 24, 2021
@minherz minherz deleted the minherz/fix-logback-599 branch November 24, 2021 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. cla: yes This human has signed the Contributor License Agreement.
3 participants