Skip to content

Commit e7b76d8

Browse files
committed
NIFI-14381: Incorporated further review comments
1 parent 830ec49 commit e7b76d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/main/java/org/apache/nifi/flowanalysis/rules/RequireServerSSLContextService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343
public class RequireServerSSLContextService extends AbstractFlowAnalysisRule {
4444

45-
private final List<String> componentTypes = List.of(
45+
private final static List<String> COMPONENT_TYPES = List.of(
4646
"org.apache.nifi.processors.standard.ListenFTP",
4747
"org.apache.nifi.processors.standard.ListenHTTP",
4848
"org.apache.nifi.processors.standard.ListenTCP",
@@ -58,15 +58,16 @@ public Collection<ComponentAnalysisResult> analyzeComponent(VersionedComponent c
5858
if (component instanceof VersionedConfigurableExtension versionedConfigurableExtension) {
5959

6060
String encounteredComponentType = versionedConfigurableExtension.getType();
61-
String encounteredSimpleComponentType = encounteredComponentType.substring(encounteredComponentType.lastIndexOf(".") + 1);
6261

63-
if (componentTypes.isEmpty() || componentTypes.contains(encounteredComponentType) || componentTypes.contains(encounteredSimpleComponentType)) {
62+
if (COMPONENT_TYPES.contains(encounteredComponentType)) {
6463
// Loop over the properties for this component looking for an SSLContextService
6564
versionedConfigurableExtension.getProperties().forEach((propertyName, propertyValue) -> {
6665

6766
// If the SSL Context property exists and the value is not set, report a violation
6867
if (("SSL Context Service".equalsIgnoreCase(propertyName) || "ssl-context-service".equalsIgnoreCase(propertyName))
6968
&& StringUtils.isEmpty(propertyValue)) {
69+
70+
String encounteredSimpleComponentType = encounteredComponentType.substring(encounteredComponentType.lastIndexOf(".") + 1);
7071
ComponentAnalysisResult result = new ComponentAnalysisResult(
7172
component.getInstanceIdentifier(),
7273
"'" + encounteredSimpleComponentType + "' must specify an SSL Context Service"

0 commit comments

Comments
 (0)