Context::sessionAttribute(String) can return null value if attribute is not set but is typed as 'T' instead of 'T?'
See original GitHub issueActual behavior (the bug)
Getting an attribute with Context::sessionAttribute(String)
(which returns null
if the attribute isn’t set) returns a T
instead of T?
.
This forces Kotlin users to add @Suppress("SENSELESS_COMPARISON")
when checking if an attribute is null (or have an unexpected runtime NullPointerException
).
Expected behavior
sessionAttribute(String)
should return T?
instead of T
.
Additional context Although an easy fix, this will “break” the API for Kotlin users that currently don’t have a null check when getting an attribute.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Informatica PowerExchange - Message Reference Volume 2
If not and the first run ID is the empty string use the APPCLEAR ... can return redo/undo data in the server's code...
Read more >Developer Manual Third Edition Version 2.0.0 - MasterObjects
corresponding column is empty. ⇒ The ! character is the default value for constant. MdConstants.kMdFindEmptyString, and can thus be changed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I’ve been looking at all possible paths the
setAttribute
calls can take in Jetty’s source and turns out they don’t all have the same side effects when sending anull
value: all of them will remove the attribute, exceptUpgradeHttpServletRequest
which will just add the attribute with a null value -_-I’ll go ahead and revert this back to what was already present except for the nullable stuff.
I see that other attribute functions have the same problem:
If you’d like to create a PR, please include all of them.