GUACAMOLE-422: Clean up style and extra code.

This commit is contained in:
Virtually Nick
2019-04-17 15:32:31 -04:00
parent 644e69de0a
commit 0f4ff0fe46
4 changed files with 7 additions and 91 deletions

View File

@@ -145,7 +145,6 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket {
// Build args list off provided names and config // Build args list off provided names and config
List<String> arg_names = args.getArgs(); List<String> arg_names = args.getArgs();
String[] arg_values = new String[arg_names.size()]; String[] arg_values = new String[arg_names.size()];
for (int i=0; i<arg_names.size(); i++) { for (int i=0; i<arg_names.size(); i++) {

View File

@@ -60,7 +60,7 @@ public class GuacamoleClientInformation {
private final List<String> imageMimetypes = new ArrayList<String>(); private final List<String> imageMimetypes = new ArrayList<String>();
/** /**
* The timezone report by the client. * The timezone reported by the client.
*/ */
private String timezone = ""; private String timezone = "";

View File

@@ -29,12 +29,11 @@ import org.apache.guacamole.GuacamoleUnsupportedException;
*/ */
public enum GuacamoleProtocolVersion { 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); // Version 1.1.0
VERSION_1_1_0(1, 1, 0);
// The string representation of the version.
private final String version;
// The major version number. // The major version number.
private final int major; private final int major;
@@ -47,10 +46,7 @@ public enum GuacamoleProtocolVersion {
/** /**
* Generate a new GuacamoleProtocolVersion object with the given * Generate a new GuacamoleProtocolVersion object with the given
* string version, major version, and minor version. * major version, minor version, and patch version.
*
* @param version
* The String representation of the version.
* *
* @param major * @param major
* The integer representation of the major version component. * The integer representation of the major version component.
@@ -61,23 +57,12 @@ public enum GuacamoleProtocolVersion {
* @param patch * @param patch
* The integer representation of the patch version component. * The integer representation of the patch version component.
*/ */
GuacamoleProtocolVersion(String version, int major, int minor, int patch) { GuacamoleProtocolVersion(int major, int minor, int patch) {
this.version = version;
this.major = major; this.major = major;
this.minor = minor; this.minor = minor;
this.patch = patch; 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. * 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.");
}
} }

View File

@@ -38,7 +38,6 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe
// Required services // Required services
var $translate = $injector.get('$translate'); var $translate = $injector.get('$translate');
var authenticationService = $injector.get('authenticationService'); var authenticationService = $injector.get('authenticationService');
var formService = $injector.get('formService');
var guacNotification = $injector.get('guacNotification'); var guacNotification = $injector.get('guacNotification');
var languageService = $injector.get('languageService'); var languageService = $injector.get('languageService');
var permissionService = $injector.get('permissionService'); var permissionService = $injector.get('permissionService');