@@ -302,12 +302,12 @@ private Set<String> getVpnGatewayParametersInBlockedList(String ikePolicy, Strin
302302 }
303303
304304 Set <String > ikePolicyResult = getVpnGatewayPolicyParametersInBlockedList (ikePolicy , "IKE" , blockedEncryptionList , blockedHashingList , blockedDhGroupList );
305- if (! ikePolicyResult . isEmpty ( )) {
305+ if (CollectionUtils . isNotEmpty ( ikePolicyResult )) {
306306 blockedParameters .addAll (ikePolicyResult );
307307 }
308308
309309 Set <String > espPolicyResult = getVpnGatewayPolicyParametersInBlockedList (espPolicy , "ESP" , blockedEncryptionList , blockedHashingList , blockedDhGroupList );
310- if (! espPolicyResult . isEmpty ( )) {
310+ if (CollectionUtils . isNotEmpty ( espPolicyResult )) {
311311 blockedParameters .addAll (espPolicyResult );
312312 }
313313
@@ -1196,41 +1196,37 @@ protected void runInContext() {
11961196 Set <String > excludedParameters = getExcludedVpnGatewayParameters (gateway );
11971197 Set <String > obsoleteParameters = getObsoleteVpnGatewayParameters (gateway );
11981198
1199- String message = "" ;
1200- if (! excludedParameters . isEmpty ( )) {
1199+ List < String > message = new ArrayList <>() ;
1200+ if (CollectionUtils . isNotEmpty ( excludedParameters )) {
12011201 excludedCount ++;
1202- message += "excluded parameter(s) " + excludedParameters .toString ();
1202+ message . add ( "excluded parameter(s) " + excludedParameters .toString () );
12031203 }
1204- if (! obsoleteParameters . isEmpty ( )) {
1204+ if (CollectionUtils . isNotEmpty ( obsoleteParameters )) {
12051205 obsoleteCount ++;
1206- if (StringUtils .isNotEmpty (message )) {
1207- message += " and " ;
1208- }
1209- message += "obsolete parameter(s) " + obsoleteParameters .toString ();
1206+ message .add ("obsolete parameter(s) " + excludedParameters .toString ());
12101207 }
12111208
1212- if (StringUtils .isNotEmpty (message )) {
1209+ if (CollectionUtils .isNotEmpty (message )) {
12131210 Account account = _accountDao .findById (gateway .getAccountId ());
1214- String description = String .format ("VPN customer gateway '%s' (Account: %s) contains %s." , gateway .getName (), account .getAccountName (), message );
1211+ String description = String .format ("VPN customer gateway '%s' (Account: %s) contains %s." ,
1212+ gateway .getName (), account .getAccountName (), String .join (" and " , message ));
12151213 ActionEventUtils .onActionEvent (User .UID_SYSTEM , gateway .getAccountId (), gateway .getDomainId (),
12161214 EventTypes .EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS , description ,
12171215 gateway .getId (), Site2SiteCustomerGateway .class .getSimpleName ());
12181216 }
12191217 }
12201218
1221- String message = "" ;
1222- if (obsoleteCount > 0 ) {
1223- message += "VPN Customer Gateways with obsolete parameters: " + obsoleteCount ;
1224- }
1219+ List <String > message = new ArrayList <>();
12251220 if (excludedCount > 0 ) {
1226- if ( StringUtils . isNotEmpty ( message )) {
1227- message += " and " ;
1228- }
1229- message += "VPN Customer Gateways with excluded parameters: " + excludedCount ;
1221+ message . add ( "excluded parameters: " + excludedCount );
1222+ }
1223+ if ( obsoleteCount > 0 ) {
1224+ message . add ( "obsolete parameters: " + obsoleteCount ) ;
12301225 }
1231- if (StringUtils .isNotEmpty (message )) {
1226+ if (CollectionUtils .isNotEmpty (message )) {
1227+ String subject = String .format ("VPN customer gateways using " + String .join (", " , message ));
12321228 _alertMgr .clearAlert (AlertService .AlertType .ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS , 0L , 0L );
1233- _alertMgr .sendAlert (AlertService .AlertType .ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS , 0L , 0L , message , null );
1229+ _alertMgr .sendAlert (AlertService .AlertType .ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS , 0L , 0L , subject , null );
12341230 }
12351231 }
12361232 }
0 commit comments