]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR_19368 show full value of properties in /api/system/info
authorAurelien Poscia <aurelien.poscia@sonarsource.com>
Mon, 22 May 2023 07:23:48 +0000 (09:23 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 22 May 2023 20:02:56 +0000 (20:02 +0000)
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/SettingsSectionTest.java

index 8ed2a63d5970654b9c872320c37fe98489e98a4c..537f99fb976f9edcb86dc9e5d761238a74531ae3 100644 (file)
@@ -40,7 +40,6 @@ import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo.Section.Builder;
 import org.sonar.server.platform.NodeInformation;
 
 import static java.util.stream.Collectors.toUnmodifiableSet;
-import static org.apache.commons.lang.StringUtils.abbreviate;
 import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
 import static org.apache.commons.lang.StringUtils.endsWithIgnoreCase;
 import static org.sonar.process.ProcessProperties.Property.AUTH_JWT_SECRET;
@@ -54,7 +53,6 @@ import static org.sonar.process.systeminfo.SystemInfoUtils.setAttribute;
 
 @ServerSide
 public class SettingsSection implements SystemInfoSection, Global {
-  private static final int MAX_VALUE_LENGTH = 500;
   private static final String PASSWORD_VALUE = "xxxxxxxx";
   private static final Collection<String> IGNORED_SETTINGS_IN_CLUSTER = Stream.of(
       WEB_JAVA_OPTS,
@@ -115,7 +113,7 @@ public class SettingsSection implements SystemInfoSection, Global {
       AUTH_JWT_SECRET.getKey().equals(key)) {
       return PASSWORD_VALUE;
     }
-    return abbreviate(value, MAX_VALUE_LENGTH);
+    return value;
   }
 
   private static String parseDefaultNewCodeDefinition(NewCodePeriodDto period) {
index ff4a919f6684fed59460fb9050b5df52a3d00438..a402a307134e2b0a3616b19a77f3fcd98ed2cc04 100644 (file)
@@ -120,12 +120,13 @@ public class SettingsSectionTest {
   }
 
   @Test
-  public void truncate_long_property_values() {
-    settings.setProperty("foo", repeat("abcde", 1_000));
+  public void long_property_values_are_not_truncated() {
+    String value = repeat("abcde", 1_000);
+    settings.setProperty("foo", value);
 
     ProtobufSystemInfo.Section protobuf = underTest.toProtobuf();
-    String value = attribute(protobuf, "foo").getStringValue();
-    assertThat(value).hasSize(500).startsWith("abcde");
+    String actualValue = attribute(protobuf, "foo").getStringValue();
+    assertThat(actualValue).isEqualTo(value);
   }
 
   @Test