[ 
https://issues.apache.org/jira/browse/MNG-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17386900#comment-17386900
 ] 

Robert Scholte commented on MNG-7194:
-------------------------------------

Rethinking it: null is always problematic. You cannot know if the value is set 
to null or the key is unavailable. IMO the first doesn't have to throw an 
exception, the latter only in strict mode. In other words: only Map/Properties 
can potentially throw the Exception.
I'm kind of surprised nobody hit this issue before or that it didn't cause 
serious issues. I think there are multiple implementations of an 
ExpressionEvaluator available, so let's analyse this first.

> PluginParameterExpressionEvaluator incorrectly interpolates unknown 
> subexpression
> ---------------------------------------------------------------------------------
>
>                 Key: MNG-7194
>                 URL: https://issues.apache.org/jira/browse/MNG-7194
>             Project: Maven
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>            Reporter: Robert Scholte
>            Priority: Minor
>
> The PluginParameterExpressionEvaluator evaluate(String,Class)-method ends 
> like this:
> {code:java}
>         if ( value instanceof String )
>         {
>             // TODO: without #, this could just be an evaluate call...
>             String val = (String) value;
>             int exprStartDelimiter = val.indexOf( "${" );
>             if ( exprStartDelimiter >= 0 )
>             {
>                 if ( exprStartDelimiter > 0 )
>                 {
>                     value = val.substring( 0, exprStartDelimiter ) + 
> evaluate( val.substring( exprStartDelimiter ) );
>                 }
>                 else
>                 {
>                     value = evaluate( val.substring( exprStartDelimiter ) );
>                 }
>             }
>         }
> {code}
> Assume that pre${unknown} needs to be evaluated and {{unknown}} does not 
> exist, the result well be "{{prenull}}"
> Just ${unknown} evaluates to null, but because there's no String concat it 
> will be a real null.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to