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

String.replace Function result is ignored in lucene/analysis/kuromoji CSVUtil.quoteEscape

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.1
    • Fix Version/s: 6.x, master (7.0)
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      Hello!

      Code in the method CSVUtil. quoteEscape

      CSVUtil.java
          if (result.indexOf('\"') >= 0) {
            result.replace("\"", ESCAPED_QUOTE);
          }
      

      ignores the return value of the String.replace method.

      Probably, is should be:

      CSVUtil.java
          if (result.indexOf('\"') >= 0) {
            result = result.replace("\"", ESCAPED_QUOTE);
          }
      

      This possible defect found by static code analyzer AppChecker

      1. SOLR-9413.patch
        3 kB
        Christine Poerschke

        Activity

        Hide
        cpoerschke Christine Poerschke added a comment -

        Perhaps along with the fix in the lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java class we could also add a test for the method and/or class?

        Show
        cpoerschke Christine Poerschke added a comment - Perhaps along with the fix in the lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java class we could also add a test for the method and/or class?
        Hide
        thetaphi Uwe Schindler added a comment -

        I removed the watcher from this issue that caused the useless "support messages" from an automated system.

        Show
        thetaphi Uwe Schindler added a comment - I removed the watcher from this issue that caused the useless "support messages" from an automated system.
        Hide
        mikemccand Michael McCandless added a comment -

        +1

        Show
        mikemccand Michael McCandless added a comment - +1
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 75924f583416470ccba0cc112465d8cfb0f34640 in lucene-solr's branch refs/heads/master from Christine Poerschke
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=75924f5 ]

        SOLR-9413: Fix analysis/kuromoji's CSVUtil.quoteEscape logic, add TestCSVUtil test. (AppChecker, Christine Poerschke)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 75924f583416470ccba0cc112465d8cfb0f34640 in lucene-solr's branch refs/heads/master from Christine Poerschke [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=75924f5 ] SOLR-9413 : Fix analysis/kuromoji's CSVUtil.quoteEscape logic, add TestCSVUtil test. (AppChecker, Christine Poerschke)
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit ca682750b4440da5aeaa6a84f9a0d1f295aa7963 in lucene-solr's branch refs/heads/branch_6x from Christine Poerschke
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ca68275 ]

        SOLR-9413: Fix analysis/kuromoji's CSVUtil.quoteEscape logic, add TestCSVUtil test. (AppChecker, Christine Poerschke)

        Show
        jira-bot ASF subversion and git services added a comment - Commit ca682750b4440da5aeaa6a84f9a0d1f295aa7963 in lucene-solr's branch refs/heads/branch_6x from Christine Poerschke [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ca68275 ] SOLR-9413 : Fix analysis/kuromoji's CSVUtil.quoteEscape logic, add TestCSVUtil test. (AppChecker, Christine Poerschke)
        Hide
        cpoerschke Christine Poerschke added a comment -

        Thanks AppChecker!

        Show
        cpoerschke Christine Poerschke added a comment - Thanks AppChecker!

          People

          • Assignee:
            cpoerschke Christine Poerschke
            Reporter:
            AppChecker AppChecker
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development