diff --git a/guacamole-common/src/main/java/net/sourceforge/guacamole/io/ReaderGuacamoleReader.java b/guacamole-common/src/main/java/net/sourceforge/guacamole/io/ReaderGuacamoleReader.java index 7443d56c8..96997ac61 100644 --- a/guacamole-common/src/main/java/net/sourceforge/guacamole/io/ReaderGuacamoleReader.java +++ b/guacamole-common/src/main/java/net/sourceforge/guacamole/io/ReaderGuacamoleReader.java @@ -124,6 +124,10 @@ public class ReaderGuacamoleReader implements GuacamoleReader { instructionStart = 0; } + // If EOF, return EOF + if (instructionBuffer == null) + return null; + // Locate end-of-opcode and end-of-instruction int opcodeEnd = -1; int instructionEnd = -1; diff --git a/guacamole-common/src/main/java/net/sourceforge/guacamole/properties/GuacamoleProperties.java b/guacamole-common/src/main/java/net/sourceforge/guacamole/properties/GuacamoleProperties.java index 820b50540..6d272058d 100644 --- a/guacamole-common/src/main/java/net/sourceforge/guacamole/properties/GuacamoleProperties.java +++ b/guacamole-common/src/main/java/net/sourceforge/guacamole/properties/GuacamoleProperties.java @@ -98,4 +98,28 @@ public class GuacamoleProperties { } + /** + * Given a GuacamoleProperty, parses and returns the value set for that + * property in guacamole.properties. An exception is thrown if the value + * is not provided. + * + * @param The type that the given property is parsed into. + * @param property The property to read from guacamole.properties. + * @return The parsed value of the property as read from + * guacamole.properties. + * @throws GuacamoleException If an error occurs while parsing the value + * for the given property in + * guacamole.properties, or if the property is + * not specified. + */ + public static Type getRequiredProperty(GuacamoleProperty property) + throws GuacamoleException { + + Type value = getProperty(property); + if (value == null) + throw new GuacamoleException("Property " + property.getName() + " is required."); + + return value; + + } }