Preserve trailing whitespace in origin-tracked property values

Closes gh-13602
pull/13710/head
Andy Wilkinson 6 years ago
parent 032d5488cd
commit 06a8c41943

@ -135,7 +135,7 @@ class OriginTrackedPropertiesLoader {
reader.read();
}
Origin origin = new TextResourceOrigin(this.resource, location);
return OriginTrackedValue.of(buffer.toString().trim(), origin);
return OriginTrackedValue.of(buffer.toString(), origin);
}
/**

@ -248,6 +248,12 @@ public class OriginTrackedPropertiesLoaderTests {
assertThat(getValue(value)).isEqualTo("æ×ÈÅÞßáñÀÿ");
}
@Test
public void getPropertyWithTrailingSpace() {
OriginTrackedValue value = this.properties.get("test-with-trailing-space");
assertThat(getValue(value)).isEqualTo("trailing ");
}
private Object getValue(OriginTrackedValue value) {
return (value != null ? value.getValue() : null);
}

@ -40,3 +40,5 @@ test-multiline-immediate-bang=\
#test ISO 8859-1
test-iso8859-1-chars=ć×ČĹŢßáńŔ˙
test-with-trailing-space= trailing

Loading…
Cancel
Save