mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-587: Do not require guacamole.properties. Use defaults if missing.
This commit is contained in:
@@ -95,28 +95,28 @@ public class LocalEnvironment implements Environment {
|
|||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
InputStream stream;
|
InputStream stream = null;
|
||||||
|
|
||||||
// If not a directory, load from classpath
|
// If not a directory, load from classpath
|
||||||
if (!guacHome.isDirectory()) {
|
if (!guacHome.isDirectory())
|
||||||
|
|
||||||
// Read from classpath
|
|
||||||
stream = LocalEnvironment.class.getResourceAsStream("/guacamole.properties");
|
stream = LocalEnvironment.class.getResourceAsStream("/guacamole.properties");
|
||||||
if (stream == null)
|
|
||||||
throw new GuacamoleServerException(
|
|
||||||
"guacamole.properties not loaded from " + guacHome
|
|
||||||
+ " (not a directory), and guacamole.properties could"
|
|
||||||
+ " not be found as a resource in the classpath.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, try to load from file
|
// Otherwise, try to load from file
|
||||||
else
|
else {
|
||||||
stream = new FileInputStream(new File(guacHome, "guacamole.properties"));
|
File propertiesFile = new File(guacHome, "guacamole.properties");
|
||||||
|
if (propertiesFile.exists())
|
||||||
|
stream = new FileInputStream(propertiesFile);
|
||||||
|
}
|
||||||
|
|
||||||
// Load properties, always close stream
|
// Load properties from stream, if any, always closing stream when done
|
||||||
try { properties.load(stream); }
|
if (stream != null) {
|
||||||
finally { stream.close(); }
|
try { properties.load(stream); }
|
||||||
|
finally { stream.close(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify if we're proceeding without guacamole.properties
|
||||||
|
else
|
||||||
|
logger.info("No guacamole.properties file found within GUACAMOLE_HOME or the classpath. Using defaults.");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
Reference in New Issue
Block a user