RFR: 7432: Update the spotbugs maven plugin [v5]

Patrick Reinhart reinhapa at openjdk.java.net
Fri Dec 10 19:06:18 UTC 2021


On Tue, 7 Dec 2021 15:43:50 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:

>> Patrick Reinhart has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>> 
>>   7432: Update the spotbugs maven plugin
>>   
>>   Signed-off-by: Patrick Reinhart <patrick at reini.net>
>
> Error:
> 
> Error:  High: Random object created and used only once in org.openjdk.jmc.console.twitter.TwitterOAuthHeaderGenerator.getNonce() [org.openjdk.jmc.console.twitter.TwitterOAuthHeaderGenerator] At TwitterOAuthHeaderGenerator.java:[line 188] DMI_RANDOM_USED_ONLY_ONCE
> 
> Bug description: https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#dmi-random-object-created-and-used-only-once-dmi-random-used-only-once
> 
> TwitterOAuthHeaderGenerator @ line 188: https://github.com/openjdk/jmc/blob/master/application/org.openjdk.jmc.console.twitter/src/main/java/org/openjdk/jmc/console/twitter/TwitterOAuthHeaderGenerator.java#L188
> 
> It looks to be complaining that we're creating a new Random object at line 186 everytime `getNonce()` is used.

@aptmac I already got a working version here locally but I'm not yet happy with it... Seems that storing the Random in an instance variable does not help. The only way things pass at the moment is using a `ThreadLocalRandom.current()` instance...

-------------

PR: https://git.openjdk.java.net/jmc/pull/324


More information about the jmc-dev mailing list