Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle absent OTX API key in ThreatIntelPluginConfiguration #54

merged 1 commit into from Sep 27, 2017


Copy link

@joschi joschi commented Sep 26, 2017

Fixes #53

@joschi joschi added this to the 2.4.0 milestone Sep 26, 2017
@joschi joschi requested a review from dennisoelkers Sep 26, 2017
@@ -19,7 +19,8 @@
public abstract boolean otxEnabled();

public abstract Optional<String> otxApiKey();
public abstract String otxApiKey();

This comment has been minimized.


bernd Sep 27, 2017

Wouldn't this be enough so we can keep the nice properties of java.util.Optional?

diff --git src/main/java/org/graylog/plugins/threatintel/ src/main/java/org/graylog/plugins/threatintel/
index 130fa5d..9b983fa 100644
--- src/main/java/org/graylog/plugins/threatintel/
+++ src/main/java/org/graylog/plugins/threatintel/
@@ -38,7 +37,7 @@ public abstract class ThreatIntelPluginConfiguration {
                                                         @JsonProperty("abusech_ransom_enabled") boolean abusechRansomEnabled) {
         return builder()
-                .otxApiKey(otxApiKey)
+                .otxApiKey(Optional.ofNullable(otxApiKey))
@@ -62,7 +61,7 @@ public abstract class ThreatIntelPluginConfiguration {
     public static abstract class Builder {
         public abstract Builder otxEnabled(boolean otxEnabled);
-        public abstract Builder otxApiKey(String otxApiKey);
+        public abstract Builder otxApiKey(Optional<String> otxApiKey);
         public abstract Builder torEnabled(boolean torEnabled);

This comment has been minimized.


joschi Sep 27, 2017
Author Contributor

Maybe, but Optional<T> is pretty useless in this case anyway (check the usages of ThreatIntelPluginConfiguration#otxApiKey()).
In other words, getting rid of the Optional<T> meant having less code.

This comment has been minimized.


bernd Sep 27, 2017

I wouldn't call it useless, but fair enough.

@bernd bernd self-assigned this Sep 27, 2017
bernd approved these changes Sep 27, 2017
@bernd bernd merged commit e3b1ca2 into master Sep 27, 2017
2 checks passed
2 checks passed
graylog-project/pr Jenkins build graylog-project-pr-snapshot 504 has succeeded
license/cla Contributor License Agreement is signed.
@bernd bernd deleted the issue-53 branch Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants