commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Created: (VFS-331) Random object created and used only once in DefaultFileReplicator
Date Tue, 02 Nov 2010 19:30:24 GMT
Random object created and used only once in DefaultFileReplicator
-----------------------------------------------------------------

                 Key: VFS-331
                 URL: https://issues.apache.org/jira/browse/VFS-331
             Project: Commons VFS
          Issue Type: Bug
            Reporter: Sebb


Random object created and used only once in DefaultFileReplicator

Findbugs:
{quote}
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). 
{quote}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message