[
https://issues.apache.org/jira/browse/MENFORCER-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Slawomir Jaranowski updated MENFORCER-503:
------------------------------------------
Description:
In rule {{requireOS}} we use:
{{org.apache.maven.model.profile.activation.ProfileActivator#isActive}}
as
{code:java}
activator.isActive(createProfile(), null, null);
{code}
so provided {{context}} is null ... but not Maven use {{context}} without
protecting it
>From docs:
{code:java}
/**
* Determines whether the specified profile is active in the given activator
context.
*
* @param profile The profile whose activation status should be determined,
must not be {@code null}.
* @param context The environmental context used to determine the activation
status of the profile, must not be
* {@code null}.
* @param problems The container used to collect problems (e.g. bad syntax)
that were encountered, must not be
* {@code null}.
* @return {@code true} if the profile is active, {@code false} otherwise.
*/
boolean isActive( Profile profile, ProfileActivationContext context,
ModelProblemCollector problems ); {code}
So enforcer use it in wrong way.
was:
In rule {{requireOS}} we use:
{{org.apache.maven.model.profile.activation.ProfileActivator#isActive}}
as
{code:java}
activator.isActive(createProfile(), null, null);
{code}
so provided {{context}} is null ... but not Maven use {{context}} without
protecting it
> requireOS cause NPE with Maven 3.9.7
> ------------------------------------
>
> Key: MENFORCER-503
> URL: https://issues.apache.org/jira/browse/MENFORCER-503
> Project: Maven Enforcer Plugin
> Issue Type: Bug
> Reporter: Slawomir Jaranowski
> Priority: Major
>
> In rule {{requireOS}} we use:
> {{org.apache.maven.model.profile.activation.ProfileActivator#isActive}}
> as
> {code:java}
> activator.isActive(createProfile(), null, null);
> {code}
> so provided {{context}} is null ... but not Maven use {{context}} without
> protecting it
>
> From docs:
> {code:java}
> /**
> * Determines whether the specified profile is active in the given activator
> context.
> *
> * @param profile The profile whose activation status should be determined,
> must not be {@code null}.
> * @param context The environmental context used to determine the activation
> status of the profile, must not be
> * {@code null}.
> * @param problems The container used to collect problems (e.g. bad syntax)
> that were encountered, must not be
> * {@code null}.
> * @return {@code true} if the profile is active, {@code false} otherwise.
> */
> boolean isActive( Profile profile, ProfileActivationContext context,
> ModelProblemCollector problems ); {code}
>
> So enforcer use it in wrong way.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)