Align Code with Javadoc
Fixes: gh-6734
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,16 +37,15 @@ public class SecureRandomFactoryBean implements FactoryBean<SecureRandom> {
|
||||
public SecureRandom getObject() throws Exception {
|
||||
SecureRandom rnd = SecureRandom.getInstance(algorithm);
|
||||
|
||||
// Request the next bytes, thus eagerly incurring the expense of default
|
||||
// seeding and to prevent the see from replacing the entire state
|
||||
rnd.nextBytes(new byte[1]);
|
||||
|
||||
if (seed != null) {
|
||||
// Seed specified, so use it
|
||||
byte[] seedBytes = FileCopyUtils.copyToByteArray(seed.getInputStream());
|
||||
rnd.setSeed(seedBytes);
|
||||
}
|
||||
else {
|
||||
// Request the next bytes, thus eagerly incurring the expense of default
|
||||
// seeding
|
||||
rnd.nextBytes(new byte[1]);
|
||||
}
|
||||
|
||||
return rnd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user