Skip to content

NIFI-5317 - support non-ASCII X-Mailer header#2800

Closed
dtrodrigues wants to merge 1 commit intoapache:masterfrom
dtrodrigues:NIFI-5317
Closed

NIFI-5317 - support non-ASCII X-Mailer header#2800
dtrodrigues wants to merge 1 commit intoapache:masterfrom
dtrodrigues:NIFI-5317

Conversation

@dtrodrigues
Copy link
Contributor

@dtrodrigues dtrodrigues commented Jun 16, 2018

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

@ottobackwards
Copy link
Contributor

This looks good, just two comments.

  1. If we are going to add support for non-ascii, the test should test non-ascii, can we add that?
  2. We now have a pattern of use in two places using with a try catch around setting headers with encoding, maybe we should have a function?

@dtrodrigues
Copy link
Contributor Author

Header setting is now refactored into a function and there are tests for non-ascii headers

@@ -320,6 +320,15 @@ public void onScheduled(final ProcessContext context) {
this.attributeNamePattern = attributeNameRegex == null ? null : Pattern.compile(attributeNameRegex);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include the header name in the message

@@ -137,7 +137,7 @@ public void testOutgoingMessage() throws Exception {
public void testOutgoingMessageWithOptionalProperties() throws Exception {
// verifies that optional attributes are set on the outgoing Message correctly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the non-ascii, am I missing something?

Copy link
Contributor Author

@dtrodrigues dtrodrigues Jun 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is for the non-ascii accented 'i' here in the first 'i' of "TestingNífi" on lines 140/167 as well as for the accented 'u' in "Búlk" https://github.com/apache/nifi/pull/2800/files/1325c094326eb0b89b4516a99c2065ef8b2d8009#diff-c1df47b56b59d9c7ef5e22043c7cd1a7R140

@dtrodrigues
Copy link
Contributor Author

I updated the test X-Mailer header to be more explicit that it's non-ASCII

@ottobackwards
Copy link
Contributor

Yikes, sorry.

@ottobackwards
Copy link
Contributor

+1 LGTM, mvn install and contrib-check pass, use of MineType utility per best practices.

@pvillard31
Copy link
Contributor

+1, merging to master, thanks @dtrodrigues @ottobackwards

@asfgit asfgit closed this in 021ee6f Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants