You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by veteranbv <gi...@git.apache.org> on 2018/05/17 16:50:05 UTC
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
GitHub user veteranbv opened a pull request:
https://github.com/apache/nifi/pull/2715
Nifi-5171 - fixed Yandex Jersey issues by adding dependency to POM and modified A…
…PI call to now detect for languages
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](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] 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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/veteranbv/nifi nifi-5171
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/2715.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2715
----
commit 3d797dcbfb96219ecc651eb505c6b3f49f9e9249
Author: veteranbv <ve...@...>
Date: 2018-05-17T16:47:19Z
fixed Yandex Jersey issues by adding dependency to POM and modified API call to now detect for languages
----
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
Github user veteranbv commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189410920
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/src/main/java/org/apache/nifi/processors/yandex/util/Languages.java ---
@@ -25,6 +25,7 @@
private static final Map<String, String> languageAbbreviationMap = new HashMap<>();
static {
+ languageAbbreviationMap.put("", "blank");
--- End diff --
@joewitt I took a little different route by deleting the blank reference in this file and updating the validator logic
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
GitHub user veteranbv reopened a pull request:
https://github.com/apache/nifi/pull/2715
Nifi-5171 - fixed Yandex Jersey issues by adding dependency to POM and modified A…
…PI call to now detect for languages
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:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] 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.
- [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
- [x] Have you written or updated unit tests to verify your changes?
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
- [x] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
- [x] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
### For documentation related changes:
- [x] 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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/veteranbv/nifi nifi-5171
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/2715.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2715
----
commit 3d797dcbfb96219ecc651eb505c6b3f49f9e9249
Author: veteranbv <ve...@...>
Date: 2018-05-17T16:47:19Z
fixed Yandex Jersey issues by adding dependency to POM and modified API call to now detect for languages
----
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189161793
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/pom.xml ---
@@ -53,7 +53,12 @@
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
--- End diff --
I think this is licensed under CDDL 1.1? If so it should be included in the NAR's NOTICE file along with the other Jersey stuff.
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
Github user veteranbv commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189410848
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/src/main/java/org/apache/nifi/processors/yandex/YandexTranslate.java ---
@@ -211,10 +211,14 @@ public void destroyClient() {
protected Invocation prepareResource(final String key, final List<String> text, final String sourceLanguage, final String destLanguage) {
Invocation.Builder builder = client.target(URL).request(MediaType.APPLICATION_JSON);
- final MultivaluedHashMap entity = new MultivaluedHashMap();;
+ final MultivaluedHashMap entity = new MultivaluedHashMap();
entity.put("text", text);
entity.add("key", key);
- entity.add("lang", sourceLanguage + "-" + destLanguage);
+ if (sourceLanguage != "") {
--- End diff --
@joewitt Updated using your recommendations
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
Github user veteranbv closed the pull request at:
https://github.com/apache/nifi/pull/2715
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
Github user veteranbv commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189294140
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/pom.xml ---
@@ -53,7 +53,12 @@
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
--- End diff --
@mattyb149 Added
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189384435
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/src/main/java/org/apache/nifi/processors/yandex/util/Languages.java ---
@@ -25,6 +25,7 @@
private static final Map<String, String> languageAbbreviationMap = new HashMap<>();
static {
+ languageAbbreviationMap.put("", "blank");
--- End diff --
perhaps this should be 'auto-detect' and 'auto-detect'. In your previous logic looking for "" it could look for equals("auto-detect") or some constant string value
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by veteranbv <gi...@git.apache.org>.
Github user veteranbv commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189289257
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/pom.xml ---
@@ -53,7 +53,12 @@
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
--- End diff --
I'll get the following line added to the NOTICE file:
` (CDDL 1.1) (GPL2 w/ CPE) jersey-hk2 (org.glassfish.jersey.inject:jersey-hk2:jar:2.26 - https://jersey.github.io/)`
---
[GitHub] nifi pull request #2715: Nifi-5171 - fixed Yandex Jersey issues by adding de...
Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2715#discussion_r189384008
--- Diff: nifi-nar-bundles/nifi-language-translation-bundle/nifi-yandex-processors/src/main/java/org/apache/nifi/processors/yandex/YandexTranslate.java ---
@@ -211,10 +211,14 @@ public void destroyClient() {
protected Invocation prepareResource(final String key, final List<String> text, final String sourceLanguage, final String destLanguage) {
Invocation.Builder builder = client.target(URL).request(MediaType.APPLICATION_JSON);
- final MultivaluedHashMap entity = new MultivaluedHashMap();;
+ final MultivaluedHashMap entity = new MultivaluedHashMap();
entity.put("text", text);
entity.add("key", key);
- entity.add("lang", sourceLanguage + "-" + destLanguage);
+ if (sourceLanguage != "") {
--- End diff --
@veteranbv consider using StringUtils.isBlank(sourceLanguage) instead of the empty string equality check
---