[ 
https://issues.apache.org/jira/browse/SCB-884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16602551#comment-16602551
 ] 

ASF GitHub Bot commented on SCB-884:
------------------------------------

liubao68 closed pull request #887: [SCB-884] Already return, no need else
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/887
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
index 2ce09e3a1..e7a88e00d 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
@@ -128,9 +128,8 @@ public int getRetryOnNext(String microservice) {
       int result = Integer.parseInt(p);
       if (result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
     } catch (NumberFormatException e) {
       return defaultValue;
     }
@@ -145,9 +144,8 @@ public int getRetryOnSame(String microservice) {
       int result = Integer.parseInt(p);
       if (result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
     } catch (NumberFormatException e) {
       return defaultValue;
     }
@@ -169,9 +167,8 @@ public int getErrorThresholdPercentage(String microservice) 
{
       int result = Integer.parseInt(p);
       if (result <= PERCENT && result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
     } catch (NumberFormatException e) {
       return defaultValue;
     }
@@ -186,9 +183,8 @@ public int getEnableRequestThreshold(String microservice) {
       int result = Integer.parseInt(p);
       if (result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
     } catch (NumberFormatException e) {
       return defaultValue;
     }
@@ -203,9 +199,9 @@ public int getSingleTestTime(String microservice) {
       int result = Integer.parseInt(p);
       if (result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
+
     } catch (NumberFormatException e) {
       return defaultValue;
     }
@@ -221,15 +217,11 @@ public static String getStringProperty(String 
defaultValue, String... keys) {
     for (String key : keys) {
       property = DynamicPropertyFactory.getInstance().getStringProperty(key, 
null).get();
       if (property != null) {
-        break;
+        return property;
       }
     }
 
-    if (property != null) {
-      return property;
-    } else {
-      return defaultValue;
-    }
+    return defaultValue;
   }
 
   public int getContinuousFailureThreshold(String microservice) {
@@ -241,9 +233,8 @@ public int getContinuousFailureThreshold(String 
microservice) {
       int result = Integer.parseInt(p);
       if (result > 0) {
         return result;
-      } else {
-        return defaultValue;
       }
+      return defaultValue;
     } catch (NumberFormatException e) {
       return defaultValue;
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> already return, no need else
> ----------------------------
>
>                 Key: SCB-884
>                 URL: https://issues.apache.org/jira/browse/SCB-884
>             Project: Apache ServiceComb
>          Issue Type: Task
>            Reporter: laijianbin
>            Assignee: laijianbin
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to