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

Laird Nelson commented on MNG-6435:
-----------------------------------

That's a bit of a strange request; I'm not sure what constitutes "harm".  I can 
give an example of someone (me) trying to write a settings reader and realizing 
that I had to also write a settings writer even though there is no case where I 
or any other part of the tool needs to write settings.

To do this, I had to jump through a lot of hoops.  Please see: 
https://github.com/microbean/microbean-maven-cdi/blob/master/src/main/java/org/microbean/maven/cdi/YamlSettingsBuilder.java

Note that I shouldn't have to implement a {{SettingsBuilder}} but only a 
{{SettingsReader}}.  But I can't simply implement a {{SettingsReader}} because 
the {{DefaultSettingsBuilder}} forces me needlessly to also implement a 
{{SettingsWriter}}.  In my case, I simply reimplemented the {{SettingsBuilder}} 
to bypass this limitation.

> DefaultSettingsBuilder assumes all SettingsReader/Writer impls will use XML
> ---------------------------------------------------------------------------
>
>                 Key: MNG-6435
>                 URL: https://issues.apache.org/jira/browse/MNG-6435
>             Project: Maven
>          Issue Type: Improvement
>          Components: Settings
>    Affects Versions: 3.5.3
>            Reporter: Laird Nelson
>            Priority: Minor
>
> On or around line 234, interpolation of settings assumes XML:
> {code}
> interpolator.addPostProcessor( new InterpolationPostProcessor()
> {
>   @Override
>   public Object execute( String expression, Object value )
>   {
>     if ( value != null )
>     {
>       // we're going to parse this back in as XML so we need to escape XML 
> markup
>       value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" 
> ).replace( ">", "&gt;" );
>       return value;
>     }
>     return null;
>   }
> } );
> {code}
> The value being interpolated here is the result of a {{SettingsWriter}}'s 
> output.  Obviously this kind of escaping doesn't make any sense if the 
> {{SettingsWriter}} in question is not XML-based.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to