Solr
  1. Solr
  2. SOLR-4288

Improve logging for FileDataSource (basePath, relative resources).

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      In fact, the logic is broken:

            if (!file.isAbsolute())
              file = new File(basePath + query);
      

      because basePath is null so 'null' is concatenated with the query string (path) resulting in an invalid path.

      It should be checked if basePath is null, if so default to "."? Then resolve relative location as:

      new File(basePathFile, query);
      

      I'd also say change the log so that the absolute path is also logged in the warning message, otherwise it's really hard to figure out what's going on.

        Activity

        Hide
        Dawid Weiss added a comment -

        I'd like to squeeze this one in for 4.1. It's a fairly trivial patch and improves the user experience if somebody needs to configure DIH with relative basedir/paths.

        I'll commit to trunk – if there are no objections, could you merge-in to the release branch, Steve?

        Show
        Dawid Weiss added a comment - I'd like to squeeze this one in for 4.1. It's a fairly trivial patch and improves the user experience if somebody needs to configure DIH with relative basedir/paths. I'll commit to trunk – if there are no objections, could you merge-in to the release branch, Steve?
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Dawid Weiss
        http://svn.apache.org/viewvc?view=revision&revision=1433849

        SOLR-4288: Improve logging for FileDataSource (basePath, relative resources).

        Show
        Commit Tag Bot added a comment - [trunk commit] Dawid Weiss http://svn.apache.org/viewvc?view=revision&revision=1433849 SOLR-4288 : Improve logging for FileDataSource (basePath, relative resources).
        Hide
        Steve Rowe added a comment -

        I'll commit to trunk – if there are no objections, could you merge-in to the release branch, Steve?

        Yes, I'll merge into branch_4x and lucene_solr_4_1.

        Show
        Steve Rowe added a comment - I'll commit to trunk – if there are no objections, could you merge-in to the release branch, Steve? Yes, I'll merge into branch_4x and lucene_solr_4_1.
        Hide
        Dawid Weiss added a comment -

        Thanks Steve!

        Show
        Dawid Weiss added a comment - Thanks Steve!
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Steven Rowe
        http://svn.apache.org/viewvc?view=revision&revision=1433957

        SOLR-4288: Improve logging for FileDataSource (basePath, relative resources). (merged trunk r1433849)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Steven Rowe http://svn.apache.org/viewvc?view=revision&revision=1433957 SOLR-4288 : Improve logging for FileDataSource (basePath, relative resources). (merged trunk r1433849)

          People

          • Assignee:
            Dawid Weiss
            Reporter:
            Dawid Weiss
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development