Repository: mina-sshd
Updated Branches:
  refs/heads/master 655e7dbd7 -> 87b87f7da


[SSHD-739] A call to resolvePropertyValue can be very inefficient

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/87b87f7d
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/87b87f7d
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/87b87f7d

Branch: refs/heads/master
Commit: 87b87f7dad2f28b94e616688e4e5bb47dc75f459
Parents: d6bb25d
Author: Guillaume Nodet <gno...@apache.org>
Authored: Wed Apr 12 21:17:32 2017 +0200
Committer: Guillaume Nodet <gno...@apache.org>
Committed: Wed Apr 12 21:18:49 2017 +0200

----------------------------------------------------------------------
 .../sshd/common/PropertyResolverUtils.java      | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/87b87f7d/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java 
b/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
index a4fc994..584668e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/PropertyResolverUtils.java
@@ -355,7 +355,7 @@ public final class PropertyResolverUtils {
 
     public static Object resolvePropertyValue(Map<String, ?> props, String 
name) {
         String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property 
name");
-        return GenericUtils.isEmpty(props) ? null : props.get(key);
+        return props != null ? props.get(key) : null;
     }
 
     /**
@@ -392,16 +392,14 @@ public final class PropertyResolverUtils {
         String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property 
name");
         for (PropertyResolver r = resolver; r != null; r = 
r.getParentPropertyResolver()) {
             Map<String, ?> props = r.getProperties();
-            Object value = GenericUtils.isEmpty(props) ? null : props.get(key);
-            if (value != null) {
-                return value;
+            if (props != null) {
+                Object value = props.get(key);
+                if (value != null) {
+                    return value;
+                }
             }
         }
 
-        if (key.startsWith("org.apache.sshd")) {
-            return System.getProperty(key);
-        }
-
         return null;
     }
 
@@ -417,9 +415,11 @@ public final class PropertyResolverUtils {
         String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property 
name");
         for (PropertyResolver r = resolver; r != null; r = 
r.getParentPropertyResolver()) {
             Map<String, Object> props = r.getProperties();
-            Object value = GenericUtils.isEmpty(props) ? null : props.get(key);
-            if (value != null) {
-                return props;
+            if (props != null) {
+                Object value = props.get(key);
+                if (value != null) {
+                    return props;
+                }
             }
         }
 

Reply via email to