From 34e78be898c8d023cf5e71945b4553a2f6939960 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 8 Oct 2022 23:53:56 +0300 Subject: [PATCH] Trim key/value in java props --- source/mirage/java.d | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/mirage/java.d b/source/mirage/java.d index 6da63cf..7d27ef1 100644 --- a/source/mirage/java.d +++ b/source/mirage/java.d @@ -43,7 +43,7 @@ class JavaPropertiesFactory : ConfigFactory { enforce!ConfigCreationException(parts.length <= 2, "Line has too many equals signs and cannot be parsed (L" ~ index .to!string ~ "): " ~ trimmedLine); enforce!ConfigCreationException(parts.length == 2, "Missing value assignment (L" ~ index.to!string ~ "): " ~ trimmedLine); - properties.set(parts[0], parts[1]); + properties.set(parts[0].strip, parts[1].strip); } return properties; @@ -122,4 +122,13 @@ version (unittest) { assert(config.get("two") == "money"); } + + @("Values and keys are trimmed") + unittest { + auto config = parseJavaProperties(" + one = money + "); + + assert(config.get("one") == "money"); + } }