GUACAMOLE-1511: Merge automatically trim whitespace from property values.

This commit is contained in:
Virtually Nick authored and GitHub committed 2022-01-23 14:28:18 -05:00
commit c079b31dd5
2 files changed
+13 -4

No files matched your search

@@ -29,7 +29,8 @@ import org.apache.guacamole.GuacamoleServerException;
/**
* GuacamoleProperties implementation which reads all properties from a
* standard Java properties file.
* standard Java properties file. Whitespace at the end of property values is
* automatically trimmed.
*/
public class FileGuacamoleProperties extends PropertiesGuacamoleProperties {
@@ -24,7 +24,8 @@ import org.apache.guacamole.GuacamoleException;
/**
* GuacamoleProperties implementation which reads all properties from a
* {@link Properties} object.
* {@link Properties} object. Whitespace at the end of property values is
* automatically trimmed.
*/
public class PropertiesGuacamoleProperties implements GuacamoleProperties {
@@ -43,12 +44,19 @@ public class PropertiesGuacamoleProperties implements GuacamoleProperties {
* values exposed by this instance of PropertiesGuacamoleProperties.
*/
public PropertiesGuacamoleProperties(Properties properties) {
this.properties = properties;
this(properties);
}
@Override
public String getProperty(String name) throws GuacamoleException {
return properties.getProperty(name);
String value = properties.getProperty(name);
if (value == null)
return null;
return value.trim();
}
}