Solr
  1. Solr
  2. SOLR-2819

Wrong isHex()-method in HTMLStripCharFilter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      In org.apache.solr.analysis HTMLStripCharFilter use a wrong isHex()-method that return characters like 'X', 'Y' as valid hex chars:

        private boolean isHex(int ch) {
          return (ch>='0' && ch<='9') ||
                 (ch>='A' && ch<='Z') ||
                 (ch>='a' && ch<='z');
        }
      

      If only characters from [0-9a-zA-Z] are allowed, the readNumericEntity method will detect faster a mismatch.

        Activity

        Bernhard Berger created issue -
        Hoss Man committed 1208032 (2 files)
        Hide
        Hoss Man added a comment -

        Nice catch Bernhard!

        I think this is a new record for "time between bug introduced in code and bug reported" ... from what i can tell this has been in there since Solr 1.0 (but as you point out, didn't actually cause bad behavior since the final integer parsing would result in a MISMATCH and backtracking.

        Still good to fix it though – thank you for reporting it.

        Committed revision 1208032. - trunk
        Committed revision 1208037. - 3x

        Show
        Hoss Man added a comment - Nice catch Bernhard! I think this is a new record for "time between bug introduced in code and bug reported" ... from what i can tell this has been in there since Solr 1.0 (but as you point out, didn't actually cause bad behavior since the final integer parsing would result in a MISMATCH and backtracking. Still good to fix it though – thank you for reporting it. Committed revision 1208032. - trunk Committed revision 1208037. - 3x
        Hoss Man made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Hoss Man [ hossman ]
        Fix Version/s 3.6 [ 12319065 ]
        Fix Version/s 4.0 [ 12314992 ]
        Resolution Fixed [ 1 ]
        Eric committed 1208156 (1 file)
        Reviews: none

        Took out a massive bunch of stuff that Jan pointed out I managed to introduce into the file inappropriately, I *think* I did a poor merge.

        SOLR-2819 and SOLR-2919 are the JIRAs that have been checked in since I screwed it up, and I *think* I have them back in the right place, but Muir and Hoss might want to check considering my not-so-stellar record on this nonsense.

        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development