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

SLLS-266 correctly handle JSON values in settings #397

Merged

Conversation

sophio-japharidze-sonarsource
Copy link
Contributor

@sophio-japharidze-sonarsource sophio-japharidze-sonarsource commented Sep 24, 2024

Copy link
Member

@jblievremont jblievremont left a comment

Choose a reason for hiding this comment

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

Nice fix! And let's validate it on a Windows box 😅

Comment on lines +310 to +320
private static String getStringValue(Map<String, Object> settingsMap, String key, String defaultValue) {
String finalValue;
try {
var string = new Gson().fromJson((JsonElement) settingsMap.get(key), String.class);
finalValue = string == null || string.isEmpty() ? defaultValue : string;
} catch (JsonParseException e) {
finalValue = defaultValue;
}
return finalValue;
}

Copy link
Member

Choose a reason for hiding this comment

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

👏🏻

@sophio-japharidze-sonarsource sophio-japharidze-sonarsource merged commit 00df27b into master Sep 25, 2024
8 checks passed
@sophio-japharidze-sonarsource sophio-japharidze-sonarsource deleted the SLLS-266_fix_parsing_solutionPath branch September 25, 2024 08:47
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.

2 participants