瀏覽代碼

fix spotbugs string-concat-loop error

Jason Rivard 2 年之前
父節點
當前提交
5423f60984
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      server/src/main/java/password/pwm/config/stored/ConfigurationFileManager.java

+ 6 - 6
server/src/main/java/password/pwm/config/stored/ConfigurationFileManager.java

@@ -282,19 +282,19 @@ public class ConfigurationFileManager
             final UserIdentity userIdentity = valueMetaData.map( ValueMetaData::getUserIdentity ).orElse( null );
             final UserIdentity userIdentity = valueMetaData.map( ValueMetaData::getUserIdentity ).orElse( null );
 
 
             final Optional<StoredValue> storedValue = newConfig.readStoredValue( key );
             final Optional<StoredValue> storedValue = newConfig.readStoredValue( key );
-            String modifyMessage = "configuration record '" + key.getLabel( PwmConstants.DEFAULT_LOCALE ) + "' has been ";
+            final StringBuilder modifyMessage = new StringBuilder();
+            modifyMessage.append( "configuration record '" ).append( key.getLabel( PwmConstants.DEFAULT_LOCALE ) ).append( "' has been " );
 
 
-            modifyMessage += storedValue.map( value -> "modified, new value: " + value.toDebugString( PwmConstants.DEFAULT_LOCALE ) )
-                    .orElse( "removed" );
+            modifyMessage.append( storedValue.map( value -> "modified, new value: " + value.toDebugString( PwmConstants.DEFAULT_LOCALE ) )
+                    .orElse( "removed" ) );
 
 
-            final String finalMsg = modifyMessage;
-            LOGGER.trace( sessionLabel, () -> "sending audit notice: " + finalMsg );
+            LOGGER.trace( sessionLabel, () -> "sending audit notice: " + modifyMessage );
 
 
             AuditServiceClient.submit( pwmApplication, sessionLabel, AuditRecordFactory.make( sessionLabel, pwmApplication ).createUserAuditRecord(
             AuditServiceClient.submit( pwmApplication, sessionLabel, AuditRecordFactory.make( sessionLabel, pwmApplication ).createUserAuditRecord(
                     AuditEvent.MODIFY_CONFIGURATION,
                     AuditEvent.MODIFY_CONFIGURATION,
                     userIdentity,
                     userIdentity,
                     sessionLabel,
                     sessionLabel,
-                    modifyMessage ) );
+                    modifyMessage.toString() ) );
 
 
             changeCount++;
             changeCount++;
         }
         }