Skip to content

Commit

Permalink
Attempt to fix the race issue with random token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid committed Feb 26, 2024
1 parent 6fa6506 commit 6ba5af0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import javax.transaction.Transactional;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.math3.random.RandomDataGenerator;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -433,7 +434,8 @@ public void tryToCreateRefreshTokenWithInvalidParentTokenValueTest() {
}

private long getRandom() {
Random random = new Random(System.currentTimeMillis());
return random.nextLong();
long leftLimit = 10L;
long rightLimit = 10000000L;
return new RandomDataGenerator().nextLong(leftLimit, rightLimit);
}
}

0 comments on commit 6ba5af0

Please sign in to comment.