Maven Shared Components
  1. Maven Shared Components
  2. MSHARED-78

FilteringUtils escapeWindowsPath() doesn't work on Windows

    Details

    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      The method escapeWindowsPath() is replacing colon by backslash + colon.
      I.e.
      D:\temp
      is escaped as
      D\:
      temp

      But windows doesn't recognize that. If you try to open D\:
      temp on explorer, will not work.
      Even java.io.File is not able to handle that too. The attached test proves it.

      I'm not sure why this backslash was add to colon, but commenting line 44 of org.apache.maven.shared.filtering.FilteringUtils make the test work.

      1. filtering.patch
        0.9 kB
        Marvin Froeder
      2. FilteringUtilsTest.java
        0.8 kB
        Marvin Froeder

        Issue Links

          Activity

          Marvin Froeder made changes -
          Field Original Value New Value
          Affects Version/s 2.3 [ 12622 ]
          Marvin Froeder made changes -
          Link This issue is related to MRESOURCES-42 [ MRESOURCES-42 ]
          Hide
          Marvin Froeder added a comment -

          At MRESOURCES-42 was suggested to escape colon too.

          I have no idea why, but this doesn't work on windows.

          Show
          Marvin Froeder added a comment - At MRESOURCES-42 was suggested to escape colon too. I have no idea why, but this doesn't work on windows.
          Hide
          Benjamin Bentmann added a comment -

          I believe the motivation for this escaping was the use case of filtering properties files, where backslash and colon have special meanings.

          Show
          Benjamin Bentmann added a comment - I believe the motivation for this escaping was the use case of filtering properties files, where backslash and colon have special meanings.
          Hide
          Marvin Froeder added a comment -

          I have XML and properties on my projects and it still working.

          I have no idea how important is to escape colon, but if this is truly required should be done only at .properties files.

          VELO

          Show
          Marvin Froeder added a comment - I have XML and properties on my projects and it still working. I have no idea how important is to escape colon, but if this is truly required should be done only at .properties files. VELO
          Hide
          Olivier Lamy added a comment -

          So what how can we fix that ?
          apply this only for files : *.properties ?
          Not really sure.

          Show
          Olivier Lamy added a comment - So what how can we fix that ? apply this only for files : *.properties ? Not really sure.
          Olivier Lamy made changes -
          Affects Version/s 2.3 [ 12622 ]
          Affects Version/s maven-filtering-1.0-beta-2 [ 14488 ]
          Key MRESOURCES-76 MSHARED-78
          Project Maven 2.x Resources Plugin [ 11145 ] Maven Shared Components [ 11761 ]
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          Olivier Lamy made changes -
          Fix Version/s maven-filtering-1.0 [ 14631 ]
          Component/s maven-filtering [ 13380 ]
          Olivier Lamy made changes -
          Fix Version/s maven-filtering-1.0-beta-3 [ 14631 ]
          Fix Version/s maven-filtering-1.0-beta-4 [ 14861 ]
          Olivier Lamy made changes -
          Link This issue is related to MRESOURCES-81 [ MRESOURCES-81 ]
          Hide
          Paul Jackson added a comment -

          IMO, Filtering should not automatically add escape characters - it takes control away from a user. Better to never add escape characters and leave it to the user to add them as necessary.

          Show
          Paul Jackson added a comment - IMO, Filtering should not automatically add escape characters - it takes control away from a user. Better to never add escape characters and leave it to the user to add them as necessary.
          Paul Jackson made changes -
          Link This issue is depended upon by MRESOURCES-81 [ MRESOURCES-81 ]
          Hide
          Paul Jackson added a comment -

          The addition of backslashes in front of backslashes and colons is problematic.

          Show
          Paul Jackson added a comment - The addition of backslashes in front of backslashes and colons is problematic.
          Hide
          Olivier Lamy added a comment -

          Sure this should be optionnal.
          As it was introduced as a feature, IMHO this must enable by default and we must add a parameter to be able to disable this.

          Show
          Olivier Lamy added a comment - Sure this should be optionnal. As it was introduced as a feature, IMHO this must enable by default and we must add a parameter to be able to disable this.
          Hide
          Casey Butterworth added a comment -

          Unless there's a workaround that I'm not aware of, this defect is effectively rendering the 2.3 resources plugin unusable for any projects that uses resource filtering to directory locations (e.g. basedir) on windows, which I imagine is a large number of projects. MRESOURCES-81 is a good description of the problem.

          I've noticed that this is targeted at maven-filtering-1.0-beta-4, but i'm wondering if it should not be in the next release instead, and also be accompanied by a maven-release-plugin release?

          Show
          Casey Butterworth added a comment - Unless there's a workaround that I'm not aware of, this defect is effectively rendering the 2.3 resources plugin unusable for any projects that uses resource filtering to directory locations (e.g. basedir) on windows, which I imagine is a large number of projects. MRESOURCES-81 is a good description of the problem. I've noticed that this is targeted at maven-filtering-1.0-beta-4, but i'm wondering if it should not be in the next release instead, and also be accompanied by a maven-release-plugin release?
          Marvin Froeder made changes -
          Attachment filtering.patch [ 40081 ]
          Hide
          Jason van Zyl added a comment -

          The attached patch we've been using in Nexus for 3 months. Does anyone have a problem applying this?

          Show
          Jason van Zyl added a comment - The attached patch we've been using in Nexus for 3 months. Does anyone have a problem applying this?
          Olivier Lamy made changes -
          Assignee Olivier Lamy [ olamy ]
          Hide
          Olivier Lamy added a comment -

          fixed in rev 749459

          Show
          Olivier Lamy added a comment - fixed in rev 749459
          Olivier Lamy made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Hide
          Anton Makeev added a comment -

          I reckon not only the windows paths should be escaped, but all the properties filtered.

          For example, if I have a property defined as <myValue>xxx\yyy:zzz<myValue> it will be read from the *.properties file incorrectly as well.

          Thanks,
          Anton Makeev

          Show
          Anton Makeev added a comment - I reckon not only the windows paths should be escaped, but all the properties filtered. For example, if I have a property defined as <myValue>xxx\yyy:zzz<myValue> it will be read from the *.properties file incorrectly as well. Thanks, Anton Makeev
          Hide
          Jayesh Lalwani added a comment -

          Where can I get maven-filtering-1.0-beta-4? Is there a SVN that I can checkout the code from?

          Show
          Jayesh Lalwani added a comment - Where can I get maven-filtering-1.0-beta-4? Is there a SVN that I can checkout the code from?
          Show
          Benjamin Bentmann added a comment - http://svn.apache.org/repos/asf/maven/shared/trunk/maven-filtering/
          Marvin Froeder made changes -
          Link This issue relates to MRESOURCES-106 [ MRESOURCES-106 ]

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              Marvin Froeder
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: