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

ASF GitHub Bot commented on KYLIN-3582:
---------------------------------------

shaofengshi closed pull request #244: KYLIN-3582 String compare should use 
equals method
URL: https://github.com/apache/kylin/pull/244
 
 
   

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/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java 
b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
index 894386ee9b..6452d78242 100644
--- 
a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
+++ 
b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEvent.java
@@ -262,11 +262,10 @@ public String toString() {
 
         public RecordReserveKeyEnum getByKey(String key) {
             for (RecordReserveKeyEnum reserveKey : 
RecordReserveKeyEnum.values()) {
-                if (reserveKey.reserveKey == key) {
+                if (reserveKey.reserveKey.equals(key)) {
                     return reserveKey;
                 }
             }
-
             return null;
         }
     }


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> String comparison should not use == in RecordEvent
> --------------------------------------------------
>
>                 Key: KYLIN-3582
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3582
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is related code:
> {code}
>             for (RecordReserveKeyEnum reserveKey : 
> RecordReserveKeyEnum.values()) {
>                 if (reserveKey.reserveKey == key) {
> {code}
> equals() should be used to compare Strings.



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

Reply via email to