diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/FileGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/FileGuacamoleProperty.java index 38e1dac99..854a2cfb0 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/FileGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/FileGuacamoleProperty.java @@ -23,6 +23,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; /** @@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleException; */ public abstract class FileGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + @Override public File parseValue(String value) throws GuacamoleException { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/GuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/GuacamoleProperty.java index bcbea055b..b852e21ab 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/GuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/GuacamoleProperty.java @@ -21,7 +21,6 @@ package org.apache.guacamole.properties; import java.util.Collection; import java.util.Collections; -import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; /** @@ -32,14 +31,6 @@ import org.apache.guacamole.GuacamoleException; * The type this GuacamoleProperty will parse into. */ public interface GuacamoleProperty { - - /** - * A pattern which matches against the delimiters between values. This is - * currently simply a semicolon and any following whitespace. Parts of the - * input string which match this pattern will not be included in the parsed - * result. - */ - static final Pattern DELIMITER_PATTERN = Pattern.compile(";\\s*"); /** * Returns the name of the property in guacamole.properties that this diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/IntegerGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/IntegerGuacamoleProperty.java index 8746f2774..93046d952 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/IntegerGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/IntegerGuacamoleProperty.java @@ -22,6 +22,7 @@ package org.apache.guacamole.properties; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleServerException; @@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleServerException; */ public abstract class IntegerGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + @Override public Integer parseValue(String value) throws GuacamoleException { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/LongGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/LongGuacamoleProperty.java index b118a6140..dfbfcf2c6 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/LongGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/LongGuacamoleProperty.java @@ -22,6 +22,7 @@ package org.apache.guacamole.properties; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleServerException; @@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleServerException; */ public abstract class LongGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + @Override public Long parseValue(String value) throws GuacamoleException { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringGuacamoleProperty.java index abc2b15cb..37881ad63 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringGuacamoleProperty.java @@ -21,6 +21,7 @@ package org.apache.guacamole.properties; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; /** @@ -28,6 +29,14 @@ import org.apache.guacamole.GuacamoleException; */ public abstract class StringGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + @Override public String parseValue(String value) throws GuacamoleException { return value; diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringListProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringListProperty.java index 574a3d8ca..ac09cf93c 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringListProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/StringListProperty.java @@ -39,6 +39,14 @@ import org.apache.guacamole.GuacamoleException; @Deprecated public abstract class StringListProperty implements GuacamoleProperty> { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + @Override public List parseValue(String values) throws GuacamoleException { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/TimeZoneGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/TimeZoneGuacamoleProperty.java index d4a15f977..a3bf0e12c 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/TimeZoneGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/TimeZoneGuacamoleProperty.java @@ -33,6 +33,14 @@ import org.apache.guacamole.GuacamoleServerException; public abstract class TimeZoneGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. This is + * currently either a comma or a semicolon and any following whitespace. + * Parts of the input string which match this pattern will not be included + * in the parsed result. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*"); + /** * A regex that matches valid variants of GMT timezones. */ diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/properties/URIGuacamoleProperty.java b/guacamole-ext/src/main/java/org/apache/guacamole/properties/URIGuacamoleProperty.java index ae6077c7b..371ddd3e9 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/properties/URIGuacamoleProperty.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/properties/URIGuacamoleProperty.java @@ -24,6 +24,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleServerException; @@ -32,6 +33,13 @@ import org.apache.guacamole.GuacamoleServerException; */ public abstract class URIGuacamoleProperty implements GuacamoleProperty { + /** + * A pattern which matches against the delimiters between values. For the + * URIGuacamoleProperty, this is set to one or more spaces, as commas and + * semicolons are valid in URIs while white space is not. + */ + static final Pattern DELIMITER_PATTERN = Pattern.compile("\\s+"); + @Override public URI parseValue(String value) throws GuacamoleException {