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/15 12:55:54 UTC

[camel] 02/05: CAMEL-16193 - Use SecureRandom instead of Random - Camel-Saxon

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 90892bf4ae82575879f358113db52cc6403d861b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Feb 15 13:47:47 2021 +0100

    CAMEL-16193 - Use SecureRandom instead of Random - Camel-Saxon
---
 .../org/apache/camel/component/xquery/XQueryConcurrencyTest.java     | 5 +++--
 .../apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
index ef9ed9f..f2daf6d 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryConcurrencyTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.xquery;
 
-import java.util.Random;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -26,6 +25,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 import static org.apache.camel.test.junit5.TestSupport.body;
 
+import java.security.SecureRandom;
+
 /**
  * Concurrency test of XQuery using transform.xquery DSL.
  */
@@ -52,7 +53,7 @@ public class XQueryConcurrencyTest extends CamelTestSupport {
                     for (int i = 0; i < 200; i++) {
                         try {
                             // do some random sleep to simulate spread in user activity
-                            Thread.sleep(new Random().nextInt(10));
+                            Thread.sleep(new SecureRandom().nextInt(10));
                         } catch (InterruptedException e) {
                             // ignore
                         }
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
index 46c6555..83cdaab 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryURLBasedConcurrencyTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.xquery;
 
-import java.util.Random;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -26,6 +25,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 import static org.apache.camel.test.junit5.TestSupport.bodyAs;
 
+import java.security.SecureRandom;
+
 /**
  * Concurrency test of XQuery using classpath resources (to).
  */
@@ -50,7 +51,7 @@ public class XQueryURLBasedConcurrencyTest extends CamelTestSupport {
                     for (int i = 0; i < 200; i++) {
                         try {
                             // do some random sleep to simulate spread in user activity
-                            Thread.sleep(new Random().nextInt(10));
+                            Thread.sleep(new SecureRandom().nextInt(10));
                         } catch (InterruptedException e) {
                             // ignore
                         }