From c17f096c1376a2b591cd4dc7adaa11a8c65aafbd Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 15 Sep 2022 10:17:36 +0200 Subject: [PATCH] [Minor] interning strings for log messages --- .../main/java/li/strolch/model/log/LogMessage.java | 12 ++++++------ .../src/main/java/li/strolch/utils/I18nMessage.java | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/li.strolch.model/src/main/java/li/strolch/model/log/LogMessage.java b/li.strolch.model/src/main/java/li/strolch/model/log/LogMessage.java index 7f969fc44..c01d3af71 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/log/LogMessage.java +++ b/li.strolch.model/src/main/java/li/strolch/model/log/LogMessage.java @@ -31,8 +31,8 @@ public class LogMessage extends I18nMessage { // persisting in the DB only handles millisecond precision, not nano precision ZonedDateTime now = ZonedDateTime.now(); this.zonedDateTime = now.withNano((now.getNano() / 1000000) * 1000000); - this.realm = realm; - this.username = username; + this.realm = realm.intern(); + this.username = username.intern(); this.locator = locator; this.severity = severity; this.state = state; @@ -45,8 +45,8 @@ public class LogMessage extends I18nMessage { // persisting in the DB only handles millisecond precision, not nano precision ZonedDateTime now = ZonedDateTime.now(); this.zonedDateTime = now.withNano((now.getNano() / 1000000) * 1000000); - this.realm = realm; - this.username = username; + this.realm = realm.intern(); + this.username = username.intern(); this.locator = locator; this.severity = severity; this.state = state; @@ -58,8 +58,8 @@ public class LogMessage extends I18nMessage { super(bundle, key, values, message); this.id = id; this.zonedDateTime = zonedDateTime; - this.realm = realm; - this.username = username; + this.realm = realm.intern(); + this.username = username.intern(); this.locator = locator; this.severity = severity; this.state = state; diff --git a/li.strolch.utils/src/main/java/li/strolch/utils/I18nMessage.java b/li.strolch.utils/src/main/java/li/strolch/utils/I18nMessage.java index 1fb03aaff..8eeb3c1c8 100644 --- a/li.strolch.utils/src/main/java/li/strolch/utils/I18nMessage.java +++ b/li.strolch.utils/src/main/java/li/strolch/utils/I18nMessage.java @@ -40,17 +40,17 @@ public class I18nMessage { public I18nMessage(ResourceBundle bundle, String key) { DBC.INTERIM.assertNotNull("bundle may not be null!", bundle); DBC.INTERIM.assertNotEmpty("key must be set!", key); - this.key = key; + this.key = key.intern(); this.values = new Properties(); this.bundle = bundle; - this.bundleName = bundle.getBaseBundleName(); + this.bundleName = bundle.getBaseBundleName().intern(); } public I18nMessage(String bundle, String key, Properties values, String message) { DBC.INTERIM.assertNotNull("bundle must not be empty!", bundle); DBC.INTERIM.assertNotEmpty("key must be set!", key); DBC.INTERIM.assertNotEmpty("message must be set!", message); - this.key = key; + this.key = key.intern(); this.values = values == null ? new Properties() : values; this.message = message; this.bundle = findBundle(bundle);