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


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/124cf923
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/124cf923
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/124cf923

Branch: refs/heads/master
Commit: 124cf923588579d721604f943d87f505846e5242
Parents: 37bfa9e
Author: Nick Couchman <vn...@apache.org>
Authored: Mon Nov 6 22:11:45 2017 -0500
Committer: Nick Couchman <vn...@apache.org>
Committed: Mon Nov 6 22:15:47 2017 -0500

----------------------------------------------------------------------
 .../org/apache/guacamole/auth/ldap/ConfigurationService.java | 8 ++++----
 .../apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java  | 6 +++---
 .../org/apache/guacamole/auth/ldap/ReferralAuthHandler.java  | 8 ++------
 .../guacamole/auth/ldap/connection/ConnectionService.java    | 6 +++---
 .../org/apache/guacamole/auth/ldap/user/UserService.java     | 6 +++---
 5 files changed, 15 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/124cf923/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java
 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java
index b781236..2ab7aad 100644
--- 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java
+++ 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java
@@ -257,7 +257,7 @@ public class ConfigurationService {
      *
      * @return
      *     The boolean value of whether to follow referrals
-     *     as configured in guacamole.properties
+     *     as configured in guacamole.properties.
      *
      * @throws GuacamoleException
      *     If guacamole.properties cannot be parsed.
@@ -295,7 +295,7 @@ public class ConfigurationService {
      *
      * @return
      *     The maximum number of referral hops to follow
-     *     as configured in guacamole.properties
+     *     as configured in guacamole.properties.
      *
      * @throws GuacamoleException
      *     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
      *     The maximum number of seconds to wait for LDAP operations
-     *     as configured in guacamole.properties
+     *     as configured in guacamole.properties.
      *
      * @throws GuacamoleException
      *     If guacamole.properties cannot be parsed.

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/124cf923/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java
 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java
index 63f5d0d..0d3823f 100644
--- 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java
+++ 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java
@@ -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() {
 
@@ -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() {
 
@@ -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() {
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/124cf923/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ReferralAuthHandler.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ReferralAuthHandler.java
 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ReferralAuthHandler.java
index ed0f07a..e605b3c 100644
--- 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ReferralAuthHandler.java
+++ 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ReferralAuthHandler.java
@@ -48,12 +48,8 @@ public class ReferralAuthHandler implements LDAPAuthHandler {
      * Creates a ReferralAuthHandler object to handle authentication when
      * following referrals in a LDAP connection, using the provided dn and
      * 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;
         try {
 
@@ -67,7 +63,7 @@ public class ReferralAuthHandler implements LDAPAuthHandler {
         catch (UnsupportedEncodingException e) {
             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); 
-            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);
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/124cf923/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
index 6f8bb08..3ce00e3 100644
--- 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
+++ 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/connection/ConnectionService.java
@@ -194,12 +194,12 @@ public class ConnectionService {
                 // Deal with issues following LDAP referrals
                 catch (LDAPReferralException e) {
                     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);
                         throw new GuacamoleServerException("Could not follow 
LDAP referral.", e);
                     }
                     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);
                     }
                 }
@@ -281,7 +281,7 @@ public class ConnectionService {
                         throw new GuacamoleServerException("Could not follow 
LDAP referral.", e);
                     }
                     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);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/124cf923/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
index 083df81..9d27f1e 100644
--- 
a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
+++ 
b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
@@ -134,7 +134,7 @@ public class UserService {
                         throw new GuacamoleServerException("Could not follow 
LDAP referral.", e);
                     }
                     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);
                     }
                 }
@@ -293,12 +293,12 @@ public class UserService {
                 // Deal with errors following referrals
                 catch (LDAPReferralException e) {
                     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);
                         throw new GuacamoleServerException("Failed while 
trying to follow referrals.", e);
                     }
                     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);
                     }
                 }

Reply via email to