Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.4.1
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven 2.0.9, WinXP

      Description

      If the escapeString parameter is specified in plugin configuration this will break the filtered output.

      For example the configuration

      <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.4.1</version>
         <configuration>
           <escapeString>!</escapeString>
         </configuration>
      </plugin>
      

      an file to filter (an XML file)

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!-- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
         <broken-tag>Content with replacement: ${replaceThis} !</broken-tag>
         <broken-tag>Content with escaped replacement: Do not !${replaceThis} !</broken-tag>
      </root>
      

      and a property

       <properties>
              <replaceThis>I am the replacement</replaceThis>
       </properties>
      

      from pom or profile.xml

      result in

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !${\}\!static.content broken if the escapeString occure ?!</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !/broken-tag>
         <broken-tag>Content with escaped replacement: Do not ${replaceThis} !/broken-tag>
      </root>
      

      Note the broken comment and tags!
      If using Resources-Plugin 2.3 the output is like expected:

      <?xml version="1.0" encoding="UTF-8"?>
      <root>
          <!-- This is a comment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !</broken-tag>
         <broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>
      </root>
      

      Got even worse when using a complex escape string like <escapeString>static</escapeString> (I know it's a silly example ). The result is

      <?xml version=".0" encoding="UTF-8"?>
      <root>
          <!-- This is acomment ... until filtering ... -->
         <broken-tag>Why are my !\${\}\! staticcontent broken if the escapeSring occure ?!?</broken-tag>
         <broken-tag>Content with replacement: I am the replacement !</broken-tag>
         <broken-tag>Content with escapedreplacement: Do not !I am the replacement !</broken-tag>
      </root>
      

      Note the missing characters all over the file ... :-/

      So the actual state of the escapeString feature is unpredictable and nearly useless.

      1. MRESOURCES-110.zip
        11 kB
        dennislundberg

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          433d 6h 13m 1 Olivier Lamy (*$^¨%`£) 11/Jan/11 12:28
          Mark Thomas made changes -
          Workflow jira [ 12962695 ] Default workflow, editable Closed status [ 12999091 ]
          Mark Thomas made changes -
          Link This issue depends upon MSHARED-181 [ MSHARED-181 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 01:00:00 UTC 2015 [ 1428282000487 ]
          Mark Thomas made changes -
          Workflow jira [ 12724931 ] Default workflow, editable Closed status [ 12756662 ]
          Mark Thomas made changes -
          Link This issue depends upon MSHARED-181 [ MSHARED-181 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 12:20:57 UTC 2015 [ 1428236457206 ]
          Olivier Lamy (*$^¨%`£) made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Olivier Lamy (*$^¨%`£) made changes -
          Fix Version/s 2.5 [ 16232 ]
          Assignee Olivier Lamy [ olamy ]
          Olivier Lamy (*$^¨%`£) made changes -
          Link This issue depends upon MSHARED-181 [ MSHARED-181 ]
          Dennis Lundberg made changes -
          Attachment MRESOURCES-110.zip [ 53087 ]
          Hide
          Dennis Lundberg added a comment -

          A sample project.

          Show
          Dennis Lundberg added a comment - A sample project.
          Dennis Lundberg made changes -
          Field Original Value New Value
          Description If the escapeString parameter is specified in plugin configuration this will break the filtered output.

          For example the configuration

          <plugin>
             <artifactId>maven-resources-plugin</artifactId>
             <version>2.4.1</version>
             <configuration>
               <escapeString>!</escapeString>
             </configuration>
          </plugin>

          an file to filter (an XML file)

          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!-- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
             <broken-tag>Content with replacement: ${replaceThis} !</broken-tag>
             <broken-tag>Content with escaped replacement: Do not !${replaceThis} !</broken-tag>
          </root>

          and a property

           <properties>
                  <replaceThis>I am the replacement</replaceThis>
           </properties>

          from pom or profile.xml

          result in

          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !${\}\!static.content broken if the escapeString occure ?!</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !/broken-tag>
             <broken-tag>Content with escaped replacement: Do not ${replaceThis} !/broken-tag>
          </root>

          Note the broken comment and tags!
          If using Resources-Plugin 2.3 the output is like expected:

          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!-- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !</broken-tag>
             <broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>
          </root>

          Got even worse when using a complex escape string like <escapeString>static</escapeString> (I know it's a silly example ;)). The result is

          <?xml version=".0" encoding="UTF-8"?>
          <root>
              <!-- This is acomment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! staticcontent broken if the escapeSring occure ?!?</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !</broken-tag>
             <broken-tag>Content with escapedreplacement: Do not !I am the replacement !</broken-tag>
          </root>

          Note the missing characters all over the file ... :-/

          So the actual state of the escapeString feature is unpredictable and nearly useless.

          If the escapeString parameter is specified in plugin configuration this will break the filtered output.

          For example the configuration
          {code:xml}
          <plugin>
             <artifactId>maven-resources-plugin</artifactId>
             <version>2.4.1</version>
             <configuration>
               <escapeString>!</escapeString>
             </configuration>
          </plugin>
          {code}

          an file to filter (an XML file)

          {code:xml}
          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!-- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
             <broken-tag>Content with replacement: ${replaceThis} !</broken-tag>
             <broken-tag>Content with escaped replacement: Do not !${replaceThis} !</broken-tag>
          </root>
          {code}

          and a property

          {code:xml}
           <properties>
                  <replaceThis>I am the replacement</replaceThis>
           </properties>
          {code}

          from pom or profile.xml

          result in

          {code:xml}
          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !${\}\!static.content broken if the escapeString occure ?!</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !/broken-tag>
             <broken-tag>Content with escaped replacement: Do not ${replaceThis} !/broken-tag>
          </root>
          {code}

          Note the broken comment and tags!
          If using Resources-Plugin 2.3 the output is like expected:

          {code:xml}
          <?xml version="1.0" encoding="UTF-8"?>
          <root>
              <!-- This is a comment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! static.content broken if the escapeString occure ?!?</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !</broken-tag>
             <broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>
          </root>
          {code}

          Got even worse when using a complex escape string like <escapeString>static</escapeString> (I know it's a silly example ;)). The result is

          {code:xml}
          <?xml version=".0" encoding="UTF-8"?>
          <root>
              <!-- This is acomment ... until filtering ... -->
             <broken-tag>Why are my !\${\}\! staticcontent broken if the escapeSring occure ?!?</broken-tag>
             <broken-tag>Content with replacement: I am the replacement !</broken-tag>
             <broken-tag>Content with escapedreplacement: Do not !I am the replacement !</broken-tag>
          </root>
          {code}

          Note the missing characters all over the file ... :-/

          So the actual state of the escapeString feature is unpredictable and nearly useless.

          Hide
          Eric Chatellier added a comment -

          This bug happens for us too

          Show
          Eric Chatellier added a comment - This bug happens for us too
          Hide
          Andreas Höhmann added a comment -

          I can reproduce the bug too.
          In my case this results in broken utf-8 encoding string

          ist keine g\u00FCltige Zahl

          will be "transformed" to

          ist keine g\00FCltige Zahl

          Show
          Andreas Höhmann added a comment - I can reproduce the bug too. In my case this results in broken utf-8 encoding string ist keine g\u00FCltige Zahl will be "transformed" to ist keine g\00FCltige Zahl
          Hide
          Andrew Williams added a comment -

          Yes, it strips the next character if the escapeString is not followed by a filter character.
          Very annoying!

          Show
          Andrew Williams added a comment - Yes, it strips the next character if the escapeString is not followed by a filter character. Very annoying!
          Hide
          Marco Rothe added a comment -

          Hmm, those "Unable to render embedded object: File " warnings are NOT part of my bug report ...

          Show
          Marco Rothe added a comment - Hmm, those "Unable to render embedded object: File " warnings are NOT part of my bug report ...
          Marco Rothe created issue -

            People

            • Assignee:
              Olivier Lamy (*$^¨%`£)
              Reporter:
              Marco Rothe
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development