[JIRA] (JSPT-115) Inconsistent contracts in constructors of ContextHandlingHttpClient
Ian Young (Jira)
jira at shibboleth.atlassian.net
Tue Mar 1 17:42:36 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=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 ) / Bug ( https://shibboleth.atlassian.net/browse/JSPT-115?atlOrigin=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 ) JSPT-115 ( https://shibboleth.atlassian.net/browse/JSPT-115?atlOrigin=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 ) Inconsistent contracts in constructors of ContextHandlingHttpClient ( https://shibboleth.atlassian.net/browse/JSPT-115?atlOrigin=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 )
Issue Type: Bug Affects Versions: 8.2.1 Assignee: Unassigned Components: httpclient Created: 01/Mar/22 12:42 PM Priority: Trivial Reporter: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 )
This was highlighted by Spotbugs. It’s trivial in effect, but someone needs to decide what the contracts should be in order to fix it.
The single-argument constructor for ContextHandlingHttpClient calls the two-argument constructor with a second argument of null. That parameter is however specified to be @Nonnull.
The implementation of the two-argument constructor checks the second argument against null and replaces such a value with an empty list.
So the first constructor is inconsistent with the definition of the second, and the implementation of the second is inconsistent with its own definition.
I think the best approach here would probably be to pass an explicit empty list to the second constructor, and have it throw a constraint exception if it sees a null so that it enforces its own signature. Its possible that other code relies on the implementation rather than the definition, though.
( https://shibboleth.atlassian.net/browse/JSPT-115#add-comment?atlOrigin=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/JSPT-115#add-comment?atlOrigin=eyJpIjoiMzZhNTg0MmQyN2ZiNDhjZmIzZGJkYzg0M2NkNDNkNzAiLCJwIjoiaiJ9 )
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/fcb100f1/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-5d9af004-8ca4-470c-a0d2-db3ea7a5602d
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/fcb100f1/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-trivial-407acdbf-46ae-436f-a4d8-14076273ae8d
Type: image/png
Size: 563 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/fcb100f1/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-eae6be5c-3d90-4af4-82b3-a6348355ed0c
Type: image/png
Size: 425 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/fcb100f1/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-25bd8434-c546-4d4a-b7cd-a544faee1e50
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/fcb100f1/attachment-0007.png>
More information about the commits
mailing list