JBehave
  1. JBehave
  2. JBEHAVE-747

codeLocationFromPath breaks for paths with spaces

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.5.4
    • Fix Version/s: 3.6
    • Component/s: Core, Core Examples
    • Labels:
    • Environment:
      Windows 7 Enterprise 64-bit, Version 6.1 (Build 7600)
      Ubuntu Linux 10.04.3 LTS
    • Number of attachments :
      0

      Description

      I discovered this in the Guice examples, but it's not a problem limited to Guice. Take this code that searches for stories:

      new StoryFinder().findPaths( CodeLocations.codeLocationFromPath( "resources" ).getFile(), asList( "*/.story" ), null );

      If the "resources" folder resides in a base path that contains a space, the StoryFinder will fail to locate the stories. This is because codeLocationFromPath() uses a java.net.URL object under-the-hood to URL encode the path, converting spaces to %20. Thus, jBehave will look here:

      c:\jbehave\folder%20with%20spaces\resources

      for stories located here:

      c:\jbehave\folder with spaces\resources

      This is also a problem for reports. If relative paths are used in any form, when jBehave converts them to full paths, the paths are URL-encoded. This in turn causes our Hudson builds to fail because it cannot locate the reports.

      The workaround for this is to not use CodeLocations to locate stories, and to use a Hudson project with no spaces, but jBehave really should support paths with spaces. This occurs on both Windows and Linux.

        Activity

        Hide
        Alexander Lehmann added a comment -

        this is the same issue as JBEHAVE-712, this is fixed in the snapshot build, if you want to try that

        you currently have to compile the source yourself, however, since the CI build is not working

        Show
        Alexander Lehmann added a comment - this is the same issue as JBEHAVE-712 , this is fixed in the snapshot build, if you want to try that you currently have to compile the source yourself, however, since the CI build is not working
        Hide
        Ryan Nelson added a comment -

        Thanks for the update, Alexander. I should've searched Jira a bit more carefully.

        Show
        Ryan Nelson added a comment - Thanks for the update, Alexander. I should've searched Jira a bit more carefully.
        Hide
        Mauro Talevi added a comment -

        Duplicate of JBEHAVE-712

        Show
        Mauro Talevi added a comment - Duplicate of JBEHAVE-712
        Mauro Talevi made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.6 [ 17721 ]
        Resolution Duplicate [ 3 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Ryan Nelson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: