package com.santhosh.random;
import java.util.Random;
import org.apache.commons.lang3.StringUtils;
public class SequenceGenerator {
private final Random random;
public SequenceGenerator() {
random = new Random();
}
/**
* Returns a pseudo-random integer between 0 and n-1.
*
* @see Random#nextInt(int)
*/
public int nextInt(int n) {
return random.nextInt(n);
}
public static void main(String[] args) {
SequenceGenerator g = new SequenceGenerator();
String result = StringUtils.leftPad(String.valueOf(g.nextInt(99999)),
5, '0');
System.out.println(result);
}
}
Fixing Log4j Vulnerability
The easiest way to remediate this is to update to log4j version 2.15.0 or later, as this behavior is now disabled by default. In previous releases (>2.10) this behavior can be mitigated by setting the system property log4j2.formatMsgNoLookups to true by adding the following Java parameter: -Dlog4j2.formatMsgNoLookups=true Alternatively, you can mitigate this vulnerability by removing…