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

Fix bad looping key-value lookups #52

Open
MoonBow-1 opened this issue May 17, 2024 · 3 comments
Open

Fix bad looping key-value lookups #52

MoonBow-1 opened this issue May 17, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@MoonBow-1
Copy link
Contributor

Description

This issue was raised in the review for #49:

Bad version:

for (Entry<String, JsonValue> entry : this.jsonEntry.getJsonObject("something").entrySet()) {
    String key = entry.getKey();
    JsonValue value = entry.getValue();
    map.putIfAbsent(
        key,
        ((JsonString) value).getString()
    );
}

Good version:

JsonObject jsonObject = this.jsonEntry.getJsonObject("something");
for (String key : jsonObject.keySet()) {
    map.putIfAbsent(
        key,
        jsonObject.getString(key)
    );
}

This removes the need for some bad casting required to get the string

@MoonBow-1 MoonBow-1 added the enhancement New feature or request label May 17, 2024
@MoonBow-1 MoonBow-1 self-assigned this May 17, 2024
@MoonBow-1
Copy link
Contributor Author

Reviewed internally by @51-code
We're discussing some points regarding the Exceptions thrown in the tests

@MoonBow-1
Copy link
Contributor Author

Review by the architect was done yesterday, one problem arose and will look into it internally

@MoonBow-1
Copy link
Contributor Author

All issues should now be addressed, as a new ticket was created for the issue that the architect found in the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant