[tomcat] branch 7.0.x updated: Clean-up. Remove unnecessary toString(). Better local variable name.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 7.0.x updated: Clean-up. Remove unnecessary toString(). Better local variable name.

Mark Thomas-2
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new f6e4b17  Clean-up. Remove unnecessary toString(). Better local variable name.
f6e4b17 is described below

commit f6e4b17b0a1cbffca3829e537be0e41b84531844
Author: Mark Thomas <[hidden email]>
AuthorDate: Mon Dec 2 20:55:14 2019 +0000

    Clean-up. Remove unnecessary toString(). Better local variable name.
---
 java/org/apache/catalina/realm/CombinedRealm.java | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/catalina/realm/CombinedRealm.java b/java/org/apache/catalina/realm/CombinedRealm.java
index 6390dde..026af6d 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -336,22 +336,18 @@ public class CombinedRealm extends RealmBase {
     public Principal authenticate(GSSContext gssContext, boolean storeCred) {
         if (gssContext.isEstablished()) {
             Principal authenticatedUser = null;
-            String username = null;
-
-            GSSName name = null;
+            GSSName gssName = null;
             try {
-                name = gssContext.getSrcName();
+                gssName = gssContext.getSrcName();
             } catch (GSSException e) {
                 log.warn(sm.getString("realmBase.gssNameFail"), e);
                 return null;
             }
 
-            username = name.toString();
-
             for (Realm realm : realms) {
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString("combinedRealm.authStart",
-                            username, realm.getInfo()));
+                            gssName, realm.getInfo()));
                 }
 
                 authenticatedUser = realm.authenticate(gssContext, storeCred);
@@ -359,12 +355,12 @@ public class CombinedRealm extends RealmBase {
                 if (authenticatedUser == null) {
                     if (log.isDebugEnabled()) {
                         log.debug(sm.getString("combinedRealm.authFail",
-                                username, realm.getInfo()));
+                                gssName, realm.getInfo()));
                     }
                 } else {
                     if (log.isDebugEnabled()) {
                         log.debug(sm.getString("combinedRealm.authSuccess",
-                                username, realm.getInfo()));
+                                gssName, realm.getInfo()));
                     }
                     break;
                 }
@@ -382,18 +378,17 @@ public class CombinedRealm extends RealmBase {
     @Override
     public Principal authenticate(GSSName gssName, GSSCredential gssCredential) {
         Principal authenticatedUser = null;
-        String username = gssName.toString();
 
         for (Realm realm : realms) {
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("combinedRealm.authStart",
-                        username, realm.getClass().getName()));
+                        gssName, realm.getClass().getName()));
             }
 
             if (!(realm instanceof GSSRealm)) {
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString("combinedRealm.authFail",
-                            username, realm.getClass().getName()));
+                            gssName, realm.getClass().getName()));
                 }
 
                 continue;
@@ -404,12 +399,12 @@ public class CombinedRealm extends RealmBase {
             if (authenticatedUser == null) {
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString("combinedRealm.authFail",
-                            username, realm.getClass().getName()));
+                            gssName, realm.getClass().getName()));
                 }
             } else {
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString("combinedRealm.authSuccess",
-                            username, realm.getClass().getName()));
+                            gssName, realm.getClass().getName()));
                 }
                 break;
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]