From 8626cefcdebf95bf5bc3fc2107799bdb55790a05 Mon Sep 17 00:00:00 2001 From: Torsten Grote <t@grobox.de> Date: Tue, 16 Nov 2021 09:40:03 -0300 Subject: [PATCH] Add javadocs to Settings explaining that null strings get stored as empty string --- .../java/org/briarproject/mailbox/core/settings/Settings.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt index 01ace732..bd64f02c 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt @@ -4,11 +4,17 @@ import java.util.Hashtable class Settings : Hashtable<String, String>() { + /** + * Note that null values will get stored as empty string. + */ override fun put(key: String, value: String?): String? { return if (value == null) super.put(key, "") else super.put(key, value) } + /** + * Note that empty strings get returned as null. + */ override fun get(key: String): String? { val value = super.get(key) return if (value.isNullOrEmpty()) null -- GitLab