Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-1779

DistanceUtils.parsePoint doesn't handle dimensions > 2 properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 1.5
    • None
    • None

    Description

      As the title says. Here's the fix:

      Index: DistanceUtils.java
      ===================================================================
      --- DistanceUtils.java  (revision 911529)
      +++ DistanceUtils.java  (working copy)
      @@ -140,7 +140,7 @@
               while (start < end && externalVal.charAt(start) == ' ') start++;
               while (end > start && externalVal.charAt(end - 1) == ' ') end--;
               out[i] = externalVal.substring(start, end);
      -        start = idx + 1;
      +        start = end + 1;
               end = externalVal.indexOf(',', start);
               if (end == -1) {
                 end = externalVal.length();
      @@ -180,7 +180,7 @@
               while (start < end && externalVal.charAt(start) == ' ') start++;
               while (end > start && externalVal.charAt(end - 1) == ' ') end--;
               out[i] = Double.parseDouble(externalVal.substring(start, end));
      -        start = idx + 1;
      +        start = end + 1;
               end = externalVal.indexOf(',', start);
               if (end == -1) {
                 end = externalVal.length();
      

      Will commit now, but am going to check in a test as part of SOLR-1568, which I have open w/ lots of other changes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            gsingers Grant Ingersoll
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: