You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/02/16 12:26:52 UTC

[camel] branch master updated (41a8f36b -> 3530e69)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 41a8f36b Add unit test for default property placeholder syntax
     new a90d32a  CAMEL-16218 - Mark use of java.util.Random with NOSONAR to not have false flags in code analysis reports
     new 3530e69  Regen

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/camel/language/csimple/CSimpleHelper.java  | 3 +--
 .../org/apache/camel/language/simple/SimpleExpressionBuilder.java   | 6 ++----
 .../org/apache/camel/processor/errorhandler/RedeliveryPolicy.java   | 6 ++----
 3 files changed, 5 insertions(+), 10 deletions(-)


[camel] 01/02: CAMEL-16218 - Mark use of java.util.Random with NOSONAR to not have false flags in code analysis reports

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a90d32afe73daae33acfd675bd6ef711255fe360
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Feb 16 13:15:30 2021 +0100

    CAMEL-16218 - Mark use of java.util.Random with NOSONAR to not have false flags in code analysis reports
---
 .../java/org/apache/camel/language/csimple/CSimpleHelper.java     | 3 +--
 .../org/apache/camel/language/simple/SimpleExpressionBuilder.java | 6 ++----
 .../org/apache/camel/processor/errorhandler/RedeliveryPolicy.java | 8 +++-----
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
index 7041e29..4786e2b 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
@@ -465,8 +465,7 @@ public final class CSimpleHelper {
     public static int random(Exchange exchange, Object min, Object max) {
         int num1 = exchange.getContext().getTypeConverter().tryConvertTo(int.class, exchange, min);
         int num2 = exchange.getContext().getTypeConverter().tryConvertTo(int.class, exchange, max);
-        // NOSONAR
-        Random random = new Random();
+        Random random = new Random(); // NOSONAR
         return random.nextInt(num2 - num1) + num1;
     }
 
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
index 9844780..47f2857 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionBuilder.java
@@ -190,8 +190,7 @@ public final class SimpleExpressionBuilder {
             public Object evaluate(Exchange exchange) {
                 int num1 = exp1.evaluate(exchange, Integer.class);
                 int num2 = exp2.evaluate(exchange, Integer.class);
-                // NOSONAR
-                Random random = new Random();
+                Random random = new Random(); // NOSONAR
                 int randomNum = random.nextInt(num2 - num1) + num1;
                 return randomNum;
             }
@@ -224,8 +223,7 @@ public final class SimpleExpressionBuilder {
     public static Expression randomExpression(final int min, final int max) {
         return new ExpressionAdapter() {
             public Object evaluate(Exchange exchange) {
-                // NOSONAR
-                Random random = new Random();
+                Random random = new Random(); // NOSONAR
                 int randomNum = random.nextInt(max - min) + min;
                 return randomNum;
             }
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
index 27cabda..233bdc0 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
@@ -230,9 +230,8 @@ public class RedeliveryPolicy implements Cloneable, Serializable {
             /*
              * First random determines +/-, second random determines how far to
              * go in that direction. -cgs
-             */
-            // NOSONAR
-            Random random = getRandomNumberGenerator();
+             */ 
+            Random random = getRandomNumberGenerator(); // NOSONAR
             double variance = (random.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor)
                               * random.nextDouble();
             redeliveryDelayResult += redeliveryDelayResult * variance;
@@ -564,8 +563,7 @@ public class RedeliveryPolicy implements Cloneable, Serializable {
 
     protected static synchronized Random getRandomNumberGenerator() {
         if (randomNumberGenerator == null) {
-            // NOSONAR
-            randomNumberGenerator = new Random();
+            randomNumberGenerator = new Random(); // NOSONAR
         }
         return randomNumberGenerator;
     }


[camel] 02/02: Regen

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3530e69d45fa5b6ce74d27f3dc543255814cb49f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Feb 16 13:25:50 2021 +0100

    Regen
---
 .../java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
index 233bdc0..dab9f10 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryPolicy.java
@@ -230,7 +230,7 @@ public class RedeliveryPolicy implements Cloneable, Serializable {
             /*
              * First random determines +/-, second random determines how far to
              * go in that direction. -cgs
-             */ 
+             */
             Random random = getRandomNumberGenerator(); // NOSONAR
             double variance = (random.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor)
                               * random.nextDouble();