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, 5.0
    • 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
        4 kB
        Hoss Man
      2. SOLR-4953.patch
        9 kB
        Hoss Man

        Issue Links

          Activity

          Adrien Grand made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Adrien Grand added a comment -

          4.5 release -> bulk close

          Show
          Adrien Grand added a comment - 4.5 release -> bulk close
          Hoss Man made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 4.5 [ 12324743 ]
          Fix Version/s 5.0 [ 12321664 ]
          Resolution Fixed [ 1 ]
          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
          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.
          Hoss Man made changes -
          Summary solrconfig.xml parsing should fail hard if there are multiple <indexConfig/> blocks 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
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          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.
          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.
          Hoss Man made changes -
          Attachment SOLR-4953.patch [ 12594801 ]
          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.
          Hoss Man made changes -
          Attachment SOLR-4953.patch [ 12594633 ]
          Hoss Man made changes -
          Field Original Value New Value
          Link This issue blocks SOLR-4950 [ SOLR-4950 ]
          Hoss Man created issue -

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development