[JIRA] (JSPT-113) AttributeSupport.hasAttribute can NPE with null argument, contrary to contract
Ian Young (Jira)
jira at shibboleth.atlassian.net
Tue Mar 1 16:57:52 UTC 2022
Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 ) *created* an issue
Java Support ( https://shibboleth.atlassian.net/browse/JSPT?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 ) / Bug ( https://shibboleth.atlassian.net/browse/JSPT-113?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 ) JSPT-113 ( https://shibboleth.atlassian.net/browse/JSPT-113?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 ) AttributeSupport.hasAttribute can NPE with null argument, contrary to contract ( https://shibboleth.atlassian.net/browse/JSPT-113?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 )
Issue Type: Bug Affects Versions: 8.2.1 Assignee: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 ) Components: xml Created: 01/Mar/22 11:57 AM Fix Versions: 8.3.0 Priority: Trivial Reporter: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 )
Spotted by Spotbugs: The utility methods in the AttributeSupport class all follow the (dubious, IMO) convention of allowing parameters to be @Nullable and having some default result if any of them are.
The AttributeSupport.hasAttribute method doesn’t follow this pattern, instead doing this:
if (element == name || name == null) {
return false;
}
Spotbugs noticed that this wasn’t likely to be correct because you don’t compare objects using ==.
I’ll fix this and add to the testset.
( https://shibboleth.atlassian.net/browse/JSPT-113#add-comment?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/JSPT-113#add-comment?atlOrigin=eyJpIjoiNGJlODZhMzkwMzRkNGU4Njk2N2FkZDlkODhhM2U1ZmEiLCJwIjoiaiJ9 )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100192- sha1:31e1add )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/af4bcf48/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-292e9dfd-c539-4f6f-9e7e-825e52ceffdb
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/af4bcf48/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-trivial-0d452b0f-2020-45c8-b884-478c6a5d20bc
Type: image/png
Size: 563 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/af4bcf48/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-a877581a-bce8-417c-b27e-02b24cb76e0d
Type: image/png
Size: 425 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/af4bcf48/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-bf52dc74-0fc7-41ee-b045-5cda8f70fe65
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/af4bcf48/attachment-0007.png>
More information about the commits
mailing list