Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-2753

Error when specifying empty replace string in Search and Replace Interceptor

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.0
    • Component/s: None
    • Labels:
      None

      Description

      The user guide specifies that the following configuration

      a1.sources.avroSrc.interceptors.search-replace.replaceString =

      will replace the search pattern with an empty string, but the following error is observed and there is no way to specify an empty replace string

      java.lang.NullPointerException: Must supply a replacement string replaceString (empty is ok)
      at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
      at org.apache.flume.interceptor.SearchAndReplaceInterceptor$Builder.configure(SearchAndReplaceInterceptor.java:108)
      at org.apache.flume.channel.ChannelProcessor.configureInterceptors(ChannelProcessor.java:110)

      We need to modify the SearchAndReplaceInterceptor to accept null values for replacement string and use empty string in that case

      1. FLUME-2753.patch
        1.0 kB
        Johny Rufus
      2. FLUME-2753-1.patch
        2 kB
        Johny Rufus

        Activity

        Hide
        jrufus Johny Rufus added a comment -

        This change will assign Empty string "" as the replacement String when the configuration for replacement String is absent or is configured as
        a1.sources.avroSrc.interceptors.search-replace.replaceString =

        Show
        jrufus Johny Rufus added a comment - This change will assign Empty string "" as the replacement String when the configuration for replacement String is absent or is configured as a1.sources.avroSrc.interceptors.search-replace.replaceString =
        Hide
        paliwalashish Ashish Paliwal added a comment -

        Can we have a test case for this?

        Show
        paliwalashish Ashish Paliwal added a comment - Can we have a test case for this?
        Hide
        jrufus Johny Rufus added a comment -

        Thanks Ashish Paliwal for looking into this, attached patch with test case

        Show
        jrufus Johny Rufus added a comment - Thanks Ashish Paliwal for looking into this, attached patch with test case
        Hide
        jrufus Johny Rufus added a comment -

        Ashish Paliwal, if the patch looks fine, can you look at committing this

        Show
        jrufus Johny Rufus added a comment - Ashish Paliwal , if the patch looks fine, can you look at committing this
        Hide
        paliwalashish Ashish Paliwal added a comment -

        +1
        Running the tests before committing

        Show
        paliwalashish Ashish Paliwal added a comment - +1 Running the tests before committing
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 32ef64dd6b4ee5457832324b3d401a6d724d92bd in flume's branch refs/heads/trunk from Ashish
        [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=32ef64d ]

        FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor

        (Johny Rufus via Ashish Paliwal)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 32ef64dd6b4ee5457832324b3d401a6d724d92bd in flume's branch refs/heads/trunk from Ashish [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=32ef64d ] FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor (Johny Rufus via Ashish Paliwal)
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 0a34e1e87d10b281fb37971421c651e0847a27f1 in flume's branch refs/heads/flume-1.7 from Ashish
        [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=0a34e1e ]

        FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor

        (Johny Rufus via Ashish Paliwal)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 0a34e1e87d10b281fb37971421c651e0847a27f1 in flume's branch refs/heads/flume-1.7 from Ashish [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=0a34e1e ] FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor (Johny Rufus via Ashish Paliwal)
        Hide
        hudson Hudson added a comment -

        UNSTABLE: Integrated in Flume-trunk-hbase-1 #118 (See https://builds.apache.org/job/Flume-trunk-hbase-1/118/)
        FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor (apaliwal: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=32ef64dd6b4ee5457832324b3d401a6d724d92bd)

        • flume-ng-core/src/main/java/org/apache/flume/interceptor/SearchAndReplaceInterceptor.java
        • flume-ng-core/src/test/java/org/apache/flume/interceptor/TestSearchAndReplaceInterceptor.java
        Show
        hudson Hudson added a comment - UNSTABLE: Integrated in Flume-trunk-hbase-1 #118 (See https://builds.apache.org/job/Flume-trunk-hbase-1/118/ ) FLUME-2753 Error when specifying empty replace string in Search and Replace Interceptor (apaliwal: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=32ef64dd6b4ee5457832324b3d401a6d724d92bd ) flume-ng-core/src/main/java/org/apache/flume/interceptor/SearchAndReplaceInterceptor.java flume-ng-core/src/test/java/org/apache/flume/interceptor/TestSearchAndReplaceInterceptor.java

          People

          • Assignee:
            jrufus Johny Rufus
            Reporter:
            jrufus Johny Rufus
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development