flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] hiroakiy opened a new pull request #6591: [FLINK-10186] Fix FindBugs warnings: Random object created and used o…
Date Tue, 21 Aug 2018 01:41:00 GMT
hiroakiy opened a new pull request #6591: [FLINK-10186] Fix FindBugs warnings: Random object
created and used o…
URL: https://github.com/apache/flink/pull/6591
 
 
   This PR fixes a DMI_RANDOM_USED_ONLY_ONCE warning reported by FindBugs-3.0.1 ([http://findbugs.sourceforge.net/](http://findbugs.sourceforge.net/)):
   ```
   H B DMI: Random object created and used only once in new org.apache.flink.streaming.runtime.io.BufferSpiller(IOManager,
int)  At BufferSpiller.java:[line 118]
   ```
   The description of the bug is as follows:
   > **DMI: Random object created and used only once (DMI_RANDOM_USED_ONLY_ONCE)**
   > This code creates a java.util.Random object, uses it to generate one random number,
and then discards the Random object. This produces mediocre quality random numbers and is
inefficient. If possible, rewrite the code so that the Random object is created once and saved,
and each time a new random number is required invoke a method on the existing Random object
to obtain it.
   > If it is important that the generated Random numbers not be guessable, you must not
create a new Random for each random number; the values are too easily guessable. You should
strongly consider using a java.security.SecureRandom instead (and avoid allocating a new SecureRandom
for each random number needed).
   > [http://findbugs.sourceforge.net/bugDescriptions.html#DMI_RANDOM_USED_ONLY_ONCE](http://findbugs.sourceforge.net/bugDescriptions.html#DMI_RANDOM_USED_ONLY_ONCE)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message