exceptionfactory commented on code in PR #7936:
URL: https://github.com/apache/nifi/pull/7936#discussion_r1373429747
##########
nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/main/java/org/apache/nifi/processors/slack/PutSlack.java:
##########
@@ -257,16 +272,27 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
jsonWriter.close();
final URL url =
URI.create(context.getProperty(WEBHOOK_URL).evaluateAttributeExpressions(flowFile).getValue()).toURL();
- final HttpURLConnection conn = (HttpURLConnection)
url.openConnection();
- conn.setRequestMethod("POST");
- conn.setDoOutput(true);
+ int responseCode;
+
+ if (sslService != null) {
+ final HttpsURLConnection conn = (HttpsURLConnection)
url.openConnection();
Review Comment:
`HttpsURLConnection` is a subclass of `HttpURLConnection`, so the approach
should be restructured to remove the duplicative elements and scope the
condition to setting the SSLSocketFactory when the SSL Context Service is
configured.
##########
nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/main/java/org/apache/nifi/processors/slack/PostSlack.java:
##########
@@ -180,6 +188,13 @@ public class PostSlack extends AbstractProcessor {
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.build();
+ public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new
PropertyDescriptor.Builder()
+ .name("SSL Context Service")
+ .description("If specified, indicates the SSL Context Service that
is used to communicate with the "
+ + "remote server. If not specified, communications will
not be encrypted")
Review Comment:
This description is not correct, in absence of the `SSL Context Service`,
communication will be encrypted, but the Processor will use the system default
certificate authorities.
##########
nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/main/java/org/apache/nifi/processors/slack/PutSlack.java:
##########
@@ -257,16 +272,27 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
jsonWriter.close();
final URL url =
URI.create(context.getProperty(WEBHOOK_URL).evaluateAttributeExpressions(flowFile).getValue()).toURL();
- final HttpURLConnection conn = (HttpURLConnection)
url.openConnection();
- conn.setRequestMethod("POST");
- conn.setDoOutput(true);
+ int responseCode;
+
+ if (sslService != null) {
+ final HttpsURLConnection conn = (HttpsURLConnection)
url.openConnection();
+ conn.setRequestMethod("POST");
+ conn.setDoOutput(true);
Review Comment:
These lines are the same for both conditionals, so recommend restructuring
the approach to remove the duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]