[
https://issues.apache.org/jira/browse/CODEC-336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved CODEC-336.
-----------------------------------
Fix Version/s: 1.22.0
Assignee: Gary D. Gregory
Resolution: Fixed
[~pppaul]
Thank you for your report.
This is now fixed in git master and snapshot builds in
https://repository.apache.org/content/repositories/snapshots/commons-codec/commons-codec/1.22.0-SNAPSHOT/
Please verify and close this ticket if appropriate.
> Base64.Builder.setUrlSafe(boolean) Javadoc incorrectly states null is
> accepted for primitive boolean parameter
> --------------------------------------------------------------------------------------------------------------
>
> Key: CODEC-336
> URL: https://issues.apache.org/jira/browse/CODEC-336
> Project: Commons Codec
> Issue Type: Bug
> Affects Versions: 1.21.0
> Environment: * Java version: (javac 17.0.12)
> * Commons-Codec (latest version 1.21.0 including the past)
> Reporter: Partha Paul
> Assignee: Gary D. Gregory
> Priority: Major
> Labels: documentation, documentation-update, implementation
> Fix For: 1.22.0
>
>
> The Javadoc for *{{Base64.Builder.setUrlSafe(boolean urlSafe)}}* contains a
> misleading {{@param}} description that states {{{}null resets to the
> default{}}}, however the method signature uses the primitive type {{boolean}}
> which cannot accept null values in Java.
> *Javadoc (current) contains:*
> {{@param urlSafe URL-safe encoding policy, null resets to the default.}}
> *Method signature (current):*
> {{public Builder setUrlSafe(final boolean urlSafe)}}
>
> Steps to reproduce:
> {{Base64.builder().setUrlSafe((Boolean) null).get().isUrlSafe()}} // this
> will throw a NULL pointer exception at runtime.
> Or directly passing {{null}}, which will be a compile-time error since
> primitive types cannot hold null values.
>
> *Suggested fix:*
> Update the documentation to the following to match the method signature.
> {{@param urlSafe URL-safe encoding policy.}}
>
> Happy to submit PR with this fix!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)