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

Michael Osipov commented on MNG-6435:
-------------------------------------

The Maven Model does not seem to suffer form this because it uses a visitor 
approach:
{noformat}
mosipov@bsd1srv:/usr/home/mosipov/var/Projekte/maven-integration-testing/core-it-suite/target/test-classes/mng-4625
 (master=)
$ 
/var/mosipov/Projekte/maven-integration-testing/core-it-suite/target/apache-maven/bin/mvn
  -e --batch-mode 
-Dmaven.repo.loca1l=/usr/home/mosipov/var/Projekte/maven-integration-testing/repo
 validate -Dtest.prop1="&x=y<>" help:effective-pom
...
[INFO]
Effective POMs, after inheritance, interpolation, and profiles are applied:

<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 2021-01-24T22:00:22+01:00            -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Effective POM for project 'org.apache.maven.its.mng4625:test:pom:0.1'  -->
<!--                                                                        -->
<!-- ====================================================================== -->
<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.maven.its.mng4625</groupId>
  <artifactId>test</artifactId>
  <version>0.1</version>
  <packaging>pom</packaging>
  <name>Maven Integration Test :: MNG-4625</name>
  <description>Verify that interpolation of the settings.xml doesn't fail if an 
expression's value contains
          XML special characters. &amp;x=y&lt;&gt;</description>
  <properties>
{noformat}

Yes, that is ugly with settings. Would be a nice improvement for an 
intermediate developer with GSoC.

> 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
>             Fix For: Issues to be reviewed for 4.x
>
>
> 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
(v8.3.4#803005)

Reply via email to