From: Aurelien Poscia Date: Mon, 22 May 2023 07:23:48 +0000 (+0200) Subject: SONAR_19368 show full value of properties in /api/system/info X-Git-Tag: 10.1.0.73491~241 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f0ea81e6d63cd87f899f5de13a69bee8969e6e33;p=sonarqube.git SONAR_19368 show full value of properties in /api/system/info --- diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java index 8ed2a63d597..537f99fb976 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java @@ -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 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) { diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/SettingsSectionTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/SettingsSectionTest.java index ff4a919f668..a402a307134 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/SettingsSectionTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/SettingsSectionTest.java @@ -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