Skip to content

Commit 652dbee

Browse files
committed
warn about leading/trailing whitespace in properties files and remove them
1 parent bba1a3e commit 652dbee

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main/java/de/rwth/idsg/steve/utils/PropertiesFileLoader.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.rwth.idsg.steve.utils;
22

33
import com.google.common.base.Strings;
4+
import lombok.extern.log4j.Log4j2;
45

56
import java.io.FileNotFoundException;
67
import java.io.InputStream;
@@ -12,6 +13,7 @@
1213
* @author Sevket Goekay <goekay@dbis.rwth-aachen.de>
1314
* @since 01.10.2015
1415
*/
16+
@Log4j2
1517
public class PropertiesFileLoader {
1618

1719
private Properties prop;
@@ -43,7 +45,12 @@ public String getString(String key) {
4345
throw new IllegalArgumentException("The property '" + key + "' has no value set");
4446
}
4547

46-
return s;
48+
String trimmed = s.trim();
49+
if (!trimmed.equals(s)) {
50+
log.warn("The property '{}' has leading or trailing spaces which were removed!", key);
51+
}
52+
53+
return trimmed;
4754
}
4855

4956
public boolean getBoolean(String key) {

0 commit comments

Comments
 (0)