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

Make Fields interpret null values as empty strings #12024

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Jul 10, 2024

HttpRequest on the client used to interpret null parameter values as empty strings in Jetty 11, and some of the 12 code still contains such checks, e.g.:

    private String urlEncode(String value)
    {
        if (value == null)
            return "";

        return URLEncoder.encode(value, StandardCharsets.UTF_8);
    }

but the Fields class throws NPE when a null value is given.

This PR makes Fields consider a null value as empty strings.

Fixes #12018

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban added the Bug For general bugs on Jetty side label Jul 10, 2024
@lorban lorban requested review from gregw and sbordet July 10, 2024 09:22
@lorban lorban self-assigned this Jul 10, 2024
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban requested review from gregw and sbordet July 11, 2024 16:19
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban merged commit 1a38b68 into jetty-12.0.x Jul 12, 2024
10 checks passed
@lorban lorban deleted the fix/jetty-12.0.x/12018-null-fields-values branch July 12, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

NPE when passing null value to Request.param
4 participants