Skip to content
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

[AppConfig] Default to false if null returned when deserilizing ENABLED in feature flag setting #34091

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,30 +181,31 @@ private static FeatureFlagConfigurationSetting getFeatureFlagPropertyValue(JsonP
if (token == JsonToken.VALUE_STRING) {
map.put(ID, parser.getText());
}
token = parser.nextToken();
}
// description
token = parser.nextToken();
if (token == JsonToken.FIELD_NAME && DESCRIPTION.equals(parser.getCurrentName())) {
token = parser.nextToken();
if (token == JsonToken.VALUE_STRING) {
map.put(DESCRIPTION, parser.getText());
}
token = parser.nextToken();
}
// display name
token = parser.nextToken();
if (token == JsonToken.FIELD_NAME && DISPLAY_NAME.equals(parser.getCurrentName())) {
Copy link
Member

Choose a reason for hiding this comment

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

This field is optional. The value of token here is enabled. This resulted line 202 skipping the enabled and getting the VALUE_TRUE/VALUE_FALSE, so it is never set.

token = parser.nextToken();
if (token == JsonToken.VALUE_STRING) {
map.put(DISPLAY_NAME, parser.getText());
}
token = parser.nextToken();
}
// is enabled
token = parser.nextToken();
if (token == JsonToken.FIELD_NAME && ENABLED.equals(parser.getCurrentName())) {
token = parser.nextToken();
if (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE) {
map.put(ENABLED, parser.getBooleanValue());
}
token = parser.nextToken();
}

// Use the map to get all properties
Expand All @@ -214,7 +215,6 @@ private static FeatureFlagConfigurationSetting getFeatureFlagPropertyValue(JsonP
.setDescription((String) map.get(DESCRIPTION));

// conditional arrays
token = parser.nextToken();
if (token == JsonToken.FIELD_NAME && CONDITIONS.equals(parser.getCurrentName())) {
parser.nextToken(); // get object start
token = parser.nextToken(); // get field name
Expand Down