From 1842c70b8da5383a698d6adcd8c9ca68310100ef Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 11 Jan 2018 14:22:09 +0900 Subject: [PATCH] PackInserterTest#newLargeBlob: Factor Random instance out to class member Instead of instantiating a new Random on each invocation of newLargeBlob, create it once and reuse it. This fixes a warning raised by Spotbugs about the Random object being created and only used once. Change-Id: I5b8e6ccbbc92641811537808aed9eae2034c1133 Signed-off-by: David Pursehouse --- .../eclipse/jgit/internal/storage/file/PackInserterTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java index b782ce87f..8e438bc0e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java @@ -95,6 +95,8 @@ public class PackInserterTest extends RepositoryTestCase { private WindowCacheConfig origWindowCacheConfig; + private static final Random random = new Random(0); + @Before public void setWindowCacheConfig() { origWindowCacheConfig = new WindowCacheConfig(); @@ -518,7 +520,7 @@ private PackInserter newInserter() { private static byte[] newLargeBlob() { byte[] blob = new byte[10240]; - new Random(0).nextBytes(blob); + random.nextBytes(blob); return blob; }