From 0f4ff0fe468e064a672296af47c0744cf919ee4e Mon Sep 17 00:00:00 2001 From: Virtually Nick Date: Wed, 17 Apr 2019 15:32:31 -0400 Subject: [PATCH] GUACAMOLE-422: Clean up style and extra code. --- .../protocol/ConfiguredGuacamoleSocket.java | 1 - .../protocol/GuacamoleClientInformation.java | 2 +- .../protocol/GuacamoleProtocolVersion.java | 94 ++----------------- .../directives/guacSettingsPreferences.js | 1 - 4 files changed, 7 insertions(+), 91 deletions(-) diff --git a/guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java b/guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java index c7544faa2..98c054df6 100644 --- a/guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java +++ b/guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java @@ -145,7 +145,6 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket { // Build args list off provided names and config List arg_names = args.getArgs(); - String[] arg_values = new String[arg_names.size()]; for (int i=0; i imageMimetypes = new ArrayList(); /** - * The timezone report by the client. + * The timezone reported by the client. */ private String timezone = ""; diff --git a/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleProtocolVersion.java b/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleProtocolVersion.java index f2bb935f5..2c84516e3 100644 --- a/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleProtocolVersion.java +++ b/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleProtocolVersion.java @@ -29,12 +29,11 @@ import org.apache.guacamole.GuacamoleUnsupportedException; */ public enum GuacamoleProtocolVersion { - VERSION_1_0_0("1.0.0", 1, 0, 0), + // Version 1.0.0 and older. + VERSION_1_0_0(1, 0, 0), - VERSION_1_1_0("1.1.0", 1, 1, 0); - - // The string representation of the version. - private final String version; + // Version 1.1.0 + VERSION_1_1_0(1, 1, 0); // The major version number. private final int major; @@ -47,10 +46,7 @@ public enum GuacamoleProtocolVersion { /** * Generate a new GuacamoleProtocolVersion object with the given - * string version, major version, and minor version. - * - * @param version - * The String representation of the version. + * major version, minor version, and patch version. * * @param major * The integer representation of the major version component. @@ -61,23 +57,12 @@ public enum GuacamoleProtocolVersion { * @param patch * The integer representation of the patch version component. */ - GuacamoleProtocolVersion(String version, int major, int minor, int patch) { - this.version = version; + GuacamoleProtocolVersion(int major, int minor, int patch) { this.major = major; this.minor = minor; this.patch = patch; } - /** - * Return the string representation of the version. - * - * @return - * The string representation of the version. - */ - public String getVersion() { - return version; - } - /** * Return the major version number. * @@ -154,71 +139,4 @@ public enum GuacamoleProtocolVersion { } - /** - * Parses the given string version, returning the GuacamoleProtocolVersion - * object that matches the string version. If a matching version is not - * found an exception is thrown. - * - * @param version - * The String representation of a version to parse. - * - * @return - * The GuacamoleProtocolVersion that matches the string version - * that has been provided. - * - * @throws GuacamoleException - * If the string version does not match any known enum values. - */ - public static GuacamoleProtocolVersion parseVersion(String version) - throws GuacamoleException { - - for (GuacamoleProtocolVersion v : GuacamoleProtocolVersion.values()) { - if (v.getVersion().equals(version)) - return v; - } - - throw new GuacamoleUnsupportedException("Version " + version - + " of Guacamole protocol is not valid."); - - } - - /** - * Parse the version provided as individual version components to the - * matching enum version. If a match is not found an exception is - * thrown. - * - * @param major - * The integer major version. - * - * @param minor - * The integer minor version. - * - * @param patch - * The integer patch version. - * - * @return - * The GuacamoleProtocolVersion that matches the individual components - * that were provided. - * - * @throws GuacamoleException - * If the provided components do not match any known enum value. - */ - public static GuacamoleProtocolVersion parseVersion(int major, int minor, int patch) - throws GuacamoleException { - - for (GuacamoleProtocolVersion v : GuacamoleProtocolVersion.values()) { - if (v.getMajor() == major - && v.getMinor() == minor - && v.getPatch() == patch) - return v; - } - - throw new GuacamoleUnsupportedException("Version " - + Integer.toString(major) + "." - + Integer.toString(minor) + "." - + Integer.toString(patch) - + " is not valid."); - - } - } diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js b/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js index 4aeef47f4..71e7af73e 100644 --- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js +++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsPreferences.js @@ -38,7 +38,6 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe // Required services var $translate = $injector.get('$translate'); var authenticationService = $injector.get('authenticationService'); - var formService = $injector.get('formService'); var guacNotification = $injector.get('guacNotification'); var languageService = $injector.get('languageService'); var permissionService = $injector.get('permissionService');