GUACAMOLE-243: Clean up JavaDoc comments, fix error messages and exceptions.

This commit is contained in:
Nick Couchman
2017-11-06 22:11:45 -05:00
parent 37bfa9e00f
commit 124cf92358
5 changed files with 15 additions and 19 deletions

View File

@@ -257,7 +257,7 @@ public class ConfigurationService {
* *
* @return * @return
* The boolean value of whether to follow referrals * The boolean value of whether to follow referrals
* as configured in guacamole.properties * as configured in guacamole.properties.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed. * If guacamole.properties cannot be parsed.
@@ -295,7 +295,7 @@ public class ConfigurationService {
* *
* @return * @return
* The maximum number of referral hops to follow * The maximum number of referral hops to follow
* as configured in guacamole.properties * as configured in guacamole.properties.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed. * If guacamole.properties cannot be parsed.
@@ -328,11 +328,11 @@ public class ConfigurationService {
} }
/** /**
* Returns the maximum number of seconds to wait for LDAP operations * Returns the maximum number of seconds to wait for LDAP operations.
* *
* @return * @return
* The maximum number of seconds to wait for LDAP operations * The maximum number of seconds to wait for LDAP operations
* as configured in guacamole.properties * as configured in guacamole.properties.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed. * If guacamole.properties cannot be parsed.

View File

@@ -176,7 +176,7 @@ public class LDAPGuacamoleProperties {
}; };
/** /**
* Whether or not we should follow referrals * Whether or not we should follow referrals.
*/ */
public static final BooleanGuacamoleProperty LDAP_FOLLOW_REFERRALS = new BooleanGuacamoleProperty() { public static final BooleanGuacamoleProperty LDAP_FOLLOW_REFERRALS = new BooleanGuacamoleProperty() {
@@ -186,7 +186,7 @@ public class LDAPGuacamoleProperties {
}; };
/** /**
* Maximum number of referral hops to follow * Maximum number of referral hops to follow.
*/ */
public static final IntegerGuacamoleProperty LDAP_MAX_REFERRAL_HOPS = new IntegerGuacamoleProperty() { public static final IntegerGuacamoleProperty LDAP_MAX_REFERRAL_HOPS = new IntegerGuacamoleProperty() {
@@ -196,7 +196,7 @@ public class LDAPGuacamoleProperties {
}; };
/** /**
* Number of seconds to wait for LDAP operations to complete * Number of seconds to wait for LDAP operations to complete.
*/ */
public static final IntegerGuacamoleProperty LDAP_OPERATION_TIMEOUT = new IntegerGuacamoleProperty() { public static final IntegerGuacamoleProperty LDAP_OPERATION_TIMEOUT = new IntegerGuacamoleProperty() {

View File

@@ -48,12 +48,8 @@ public class ReferralAuthHandler implements LDAPAuthHandler {
* Creates a ReferralAuthHandler object to handle authentication when * Creates a ReferralAuthHandler object to handle authentication when
* following referrals in a LDAP connection, using the provided dn and * following referrals in a LDAP connection, using the provided dn and
* password. * password.
*
* @throws GuacamoleException
* If exceptions are caught while converting the password from a string
* into a byte array.
*/ */
public ReferralAuthHandler(String dn, String password) throws GuacamoleException { public ReferralAuthHandler(String dn, String password) {
byte[] passwordBytes; byte[] passwordBytes;
try { try {
@@ -67,7 +63,7 @@ public class ReferralAuthHandler implements LDAPAuthHandler {
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
logger.error("Unexpected lack of support for UTF-8: {}", e.getMessage()); logger.error("Unexpected lack of support for UTF-8: {}", e.getMessage());
logger.debug("Support for UTF-8 (as required by Java spec) not found.", e); logger.debug("Support for UTF-8 (as required by Java spec) not found.", e);
throw new GuacamoleException("Could not set password due to missing UTF-8 support."); throw new UnsupportedOperationException("Unexpected lack of UTF-8 support.", e);
} }
ldapAuth = new LDAPAuthProvider(dn, passwordBytes); ldapAuth = new LDAPAuthProvider(dn, passwordBytes);
} }

View File

@@ -194,12 +194,12 @@ public class ConnectionService {
// Deal with issues following LDAP referrals // Deal with issues following LDAP referrals
catch (LDAPReferralException e) { catch (LDAPReferralException e) {
if (confService.getFollowReferrals()) { if (confService.getFollowReferrals()) {
logger.error("Could not follow referral.", e.getFailedReferral()); logger.error("Could not follow referral: {}", e.getFailedReferral());
logger.debug("Error encountered trying to follow referral.", e); logger.debug("Error encountered trying to follow referral.", e);
throw new GuacamoleServerException("Could not follow LDAP referral.", e); throw new GuacamoleServerException("Could not follow LDAP referral.", e);
} }
else { else {
logger.warn("Given a referral, but referrals are disabled.", e.getMessage()); logger.warn("Given a referral, but referrals are disabled. Error was: {}", e.getMessage());
logger.debug("Got a referral, but configured to not follow them.", e); logger.debug("Got a referral, but configured to not follow them.", e);
} }
} }
@@ -281,7 +281,7 @@ public class ConnectionService {
throw new GuacamoleServerException("Could not follow LDAP referral.", e); throw new GuacamoleServerException("Could not follow LDAP referral.", e);
} }
else { else {
logger.warn("Given a referral, but referrals are disabled.", e.getMessage()); logger.warn("Given a referral, but referrals are disabled. Error was: {}", e.getMessage());
logger.debug("Got a referral, but configured to not follow them.", e); logger.debug("Got a referral, but configured to not follow them.", e);
} }
} }

View File

@@ -134,7 +134,7 @@ public class UserService {
throw new GuacamoleServerException("Could not follow LDAP referral.", e); throw new GuacamoleServerException("Could not follow LDAP referral.", e);
} }
else { else {
logger.warn("Given a referral, but referrals are disabled.", e.getMessage()); logger.warn("Given a referral, but referrals are disabled. Error was: {}", e.getMessage());
logger.debug("Got a referral, but configured to not follow them.", e); logger.debug("Got a referral, but configured to not follow them.", e);
} }
} }
@@ -293,12 +293,12 @@ public class UserService {
// Deal with errors following referrals // Deal with errors following referrals
catch (LDAPReferralException e) { catch (LDAPReferralException e) {
if (confService.getFollowReferrals()) { if (confService.getFollowReferrals()) {
logger.error("Error trying to follow a referral.", e.getMessage()); logger.error("Error trying to follow a referral: {}", e.getFailedReferral());
logger.debug("Encountered an error trying to follow a referral.", e); logger.debug("Encountered an error trying to follow a referral.", e);
throw new GuacamoleServerException("Failed while trying to follow referrals.", e); throw new GuacamoleServerException("Failed while trying to follow referrals.", e);
} }
else { else {
logger.warn("Given a referral, not following it.", e.getMessage()); logger.warn("Given a referral, not following it. Error was: {}", e.getMessage());
logger.debug("Given a referral, but configured to not follow them.", e); logger.debug("Given a referral, but configured to not follow them.", e);
} }
} }