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

FilteringUtils escapeWindowsPath() doesn't work on Windows

    Details

    • Flags:
      Patch

      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
        velo
      2. FilteringUtilsTest.java
        0.8 kB
        velo

        Issue Links

          Activity

          velo created issue -
          velo made changes -
          Field Original Value New Value
          Affects Version/s 2.3 [ 12622 ]
          velo made changes -
          Link This issue is related to MRESOURCES-42 [ MRESOURCES-42 ]
          Hide
          velo 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
          velo 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
          velo 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
          velo 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 ]
          Key MRESOURCES-76 MSHARED-78
          Affects Version/s maven-filtering-1.0-beta-2 [ 14488 ]
          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?
          velo 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/
          velo made changes -
          Link This issue relates to MRESOURCES-106 [ MRESOURCES-106 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:14:21 UTC 2015 [ 1428239661755 ]
          Mark Thomas made changes -
          Workflow jira [ 12726086 ] Default workflow, editable Closed status [ 12764509 ]
          Mark Thomas made changes -
          Patch Submitted Yes [ 10763 ]
          Flags Patch [ 10430 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 01:15:59 UTC 2015 [ 1428282959282 ]
          Mark Thomas made changes -
          Workflow jira [ 12963937 ] Default workflow, editable Closed status [ 12999968 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          124d 8h 58m 1 Olivier Lamy (*$^¨%`£) 02/Mar/09 16:40

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development