[ https://issues.apache.org/jira/browse/CAMEL-12730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16580770#comment-16580770 ]
ASF GitHub Bot commented on CAMEL-12730: ---------------------------------------- davsclaus closed pull request #2472: CAMEL-12730: Fix FindBugs warnings: Suspicious reference comparison URL: https://github.com/apache/camel/pull/2472 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/camel-core/src/main/java/org/apache/camel/processor/Throttler.java b/camel-core/src/main/java/org/apache/camel/processor/Throttler.java index 963330fcd26..4191c062da2 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/Throttler.java +++ b/camel-core/src/main/java/org/apache/camel/processor/Throttler.java @@ -309,7 +309,7 @@ protected void calculateAndSetMaxRequestsPerPeriod(final Exchange exchange) thro } if (newThrottle != null) { - if (newThrottle != throttleRate) { + if (!newThrottle.equals(throttleRate)) { // get the queue from the cache // decrease if (throttleRate > newThrottle) { @@ -357,7 +357,7 @@ protected void calculateAndSetMaxRequestsPerPeriod(DelayQueue<ThrottlePermit> de } if (newThrottle != null) { - if (newThrottle != throttleRatesMap.get(key)) { + if (!newThrottle.equals(throttleRatesMap.get(key))) { // get the queue from the cache // decrease if (throttleRatesMap.get(key) > newThrottle) { ---------------------------------------------------------------- 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 > FindBugs warnings: Suspicious reference comparison > -------------------------------------------------- > > Key: CAMEL-12730 > URL: https://issues.apache.org/jira/browse/CAMEL-12730 > Project: Camel > Issue Type: Bug > Components: camel-core > Reporter: Hiroaki Yoshida > Priority: Major > > FindBugs-3.0.1 ([http://findbugs.sourceforge.net/]) reported 2 > RC_REF_COMPARISON warnings on master: > {code:java} > H C RC: Suspicious comparison of Integer references in > org.apache.camel.processor.Throttler.calculateAndSetMaxRequestsPerPeriod(Exchange) > At Throttler.java:[line 312] > H C RC: Suspicious comparison of Integer references in > org.apache.camel.processor.Throttler.calculateAndSetMaxRequestsPerPeriod(DelayQueue, > Exchange, Integer) At Throttler.java:[line 360] > {code} > The description of the bug is as follows: > {quote}*RC: Suspicious reference comparison (RC_REF_COMPARISON)* > This method compares two reference values using the == or != operator, where > the correct way to compare instances of this type is generally with the > equals() method. It is possible to create distinct instances that are equal > but do not compare as == since they are different objects. Examples of > classes which should generally not be compared by reference are > java.lang.Integer, java.lang.Float, etc. > [http://findbugs.sourceforge.net/bugDescriptions.html#RC_REF_COMPARISON] > {quote} -- This message was sent by Atlassian JIRA (v7.6.3#76005)