4242)
4343public 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