From commits-return-43772-archive-asf-public=cust-asf.ponee.io@nifi.apache.org Thu Oct 8 09:45:05 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id E9BD018065C for ; Thu, 8 Oct 2020 11:45:05 +0200 (CEST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 54D3F62C83 for ; Thu, 8 Oct 2020 09:45:05 +0000 (UTC) Received: (qmail 49072 invoked by uid 500); 8 Oct 2020 09:45:04 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 49059 invoked by uid 99); 8 Oct 2020 09:45:04 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2020 09:45:04 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 196DA82B2C; Thu, 8 Oct 2020 09:45:04 +0000 (UTC) Date: Thu, 08 Oct 2020 09:45:03 +0000 To: "commits@nifi.apache.org" Subject: [nifi] branch main updated: NIFI-7815: Enhance the logging in MergeContent processor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <160215030353.11941.1256161709373892176@gitbox.apache.org> From: pvillard@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: nifi X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Oldrev: dee2fcedfed4a20f565eec66425a8790088e05c1 X-Git-Newrev: 668c278e3099598f7a42aaf6da1ce833c951fab2 X-Git-Rev: 668c278e3099598f7a42aaf6da1ce833c951fab2 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. pvillard pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 668c278 NIFI-7815: Enhance the logging in MergeContent processor 668c278 is described below commit 668c278e3099598f7a42aaf6da1ce833c951fab2 Author: Peter Gyori AuthorDate: Thu Sep 17 15:51:32 2020 +0200 NIFI-7815: Enhance the logging in MergeContent processor Signed-off-by: Pierre Villard This closes #4534. --- .../apache/nifi/processors/standard/MergeContent.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java index 0d337d8..5d4506c 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java @@ -577,6 +577,15 @@ public class MergeContent extends BinFiles { return NUMBER_PATTERN.matcher(value).matches(); } + private void removeFlowFileFromSession(final ProcessSession session, final FlowFile flowFile, final ProcessContext context) { + try { + session.remove(flowFile); + } catch (final Exception e) { + getLogger().error("Failed to remove merged FlowFile from the session after merge failure during \"" + + context.getProperty(MERGE_FORMAT).getValue() + "\" merge.", e); + } + } + private class BinaryConcatenationMerge implements MergeBin { private String mimeType = "application/octet-stream"; @@ -636,7 +645,7 @@ public class MergeContent extends BinFiles { } }); } catch (final Exception e) { - session.remove(bundle); + removeFlowFileFromSession(session, bundle, context); throw e; } @@ -781,7 +790,7 @@ public class MergeContent extends BinFiles { } }); } catch (final Exception e) { - session.remove(bundle); + removeFlowFileFromSession(session, bundle, context); throw e; } @@ -848,7 +857,7 @@ public class MergeContent extends BinFiles { } }); } catch (final Exception e) { - session.remove(bundle); + removeFlowFileFromSession(session, bundle, context); throw e; } @@ -918,7 +927,7 @@ public class MergeContent extends BinFiles { } }); } catch (final Exception e) { - session.remove(bundle); + removeFlowFileFromSession(session, bundle, context); throw e; } @@ -1042,7 +1051,7 @@ public class MergeContent extends BinFiles { } }); } catch (final Exception e) { - session.remove(bundle); + removeFlowFileFromSession(session, bundle, context); throw e; }