Solr
  1. Solr
  2. SOLR-4953

Config XML parsing should fail hard if an xpath is expect to match at most one node/string/int/boolean and multiple values are found

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5, Trunk
    • Component/s: None
    • Labels:
      None

      Description

      while reviewing some code i think i noticed that if there are multiple <indexConfig/> blocks in solrconfig.xml, one just "wins" and hte rest are ignored.

      this should be a hard failure situation, and we should have a "TestBadConfig" method to verify it.

      broadened goal of issue to fail if configuration contains multiple nodes/values for any option where only one value is expected.

      1. SOLR-4953.patch
        9 kB
        Hoss Man
      2. SOLR-4953.patch
        4 kB
        Hoss Man

        Issue Links

          Activity

          Hide
          Hoss Man added a comment -

          it ocured to me last night that instead of just dealing explicitly with indexConfig here, we could probably help improve the validation of a lot of config parsing with a relatively simple change to Config.getNode: throw an error in any case where Solr is looking for a single Node/String/Int/Boolean and multiple values are found instead.

          I wasn't sure how badly this might break things, but i've been testing it out today and except for a few cases where the text() xpath expression was getting abused (instead of a simple node check), it seems fairly straight forward.

          So here's a patch that broadens the scope of the issue to fail hard if any "single valued" config option is found more then once in the config.

          Show
          Hoss Man added a comment - it ocured to me last night that instead of just dealing explicitly with indexConfig here, we could probably help improve the validation of a lot of config parsing with a relatively simple change to Config.getNode: throw an error in any case where Solr is looking for a single Node/String/Int/Boolean and multiple values are found instead. I wasn't sure how badly this might break things, but i've been testing it out today and except for a few cases where the text() xpath expression was getting abused (instead of a simple node check), it seems fairly straight forward. So here's a patch that broadens the scope of the issue to fail hard if any "single valued" config option is found more then once in the config.
          Hide
          ASF subversion and git services added a comment -

          Commit 1509359 from hossman@apache.org in branch 'dev/trunk'
          [ https://svn.apache.org/r1509359 ]

          SOLR-4953: Make XML Configuration parsing fail if an xpath matches multiple nodes when only a single value is expected.

          Show
          ASF subversion and git services added a comment - Commit 1509359 from hossman@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1509359 ] SOLR-4953 : Make XML Configuration parsing fail if an xpath matches multiple nodes when only a single value is expected.
          Hide
          ASF subversion and git services added a comment -

          Commit 1509390 from hossman@apache.org in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1509390 ]

          SOLR-4953: Make XML Configuration parsing fail if an xpath matches multiple nodes when only a single value is expected. (merge r1509359)

          Show
          ASF subversion and git services added a comment - Commit 1509390 from hossman@apache.org in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1509390 ] SOLR-4953 : Make XML Configuration parsing fail if an xpath matches multiple nodes when only a single value is expected. (merge r1509359)
          Hide
          Adrien Grand added a comment -

          4.5 release -> bulk close

          Show
          Adrien Grand added a comment - 4.5 release -> bulk close

            People

            • Assignee:
              Hoss Man
              Reporter:
              Hoss Man
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development