From 04dd85923b7af9f5009d9aa557f60731e619780a Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sun, 21 Jun 2015 04:52:57 -0700 Subject: Make sure the Services cache is refreshed During the class initialization, a special path is taken when all the built-in providers are initialized. This means that the "needsRefresh" flag is not set initially and the cache is not refreshed when the SecureRandom service is checked. Bug: 21970647 Change-Id: Idb796ec5e3ac04424e5fd3a90607666ae23817d5 (cherry picked from commit 10dced1155cb3689ca63383a3b0b794bc3735268) --- luni/src/main/java/org/apache/harmony/security/fortress/Services.java | 1 + luni/src/test/java/libcore/java/security/SecureRandomTest.java | 2 ++ 2 files changed, 3 insertions(+) (limited to 'luni') diff --git a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java index 5f3dfe0..234f4a2 100644 --- a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java +++ b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java @@ -90,6 +90,7 @@ public class Services { } } Engine.door.renumProviders(); + setNeedRefresh(); } /** diff --git a/luni/src/test/java/libcore/java/security/SecureRandomTest.java b/luni/src/test/java/libcore/java/security/SecureRandomTest.java index f9edbaa..cf12120 100644 --- a/luni/src/test/java/libcore/java/security/SecureRandomTest.java +++ b/luni/src/test/java/libcore/java/security/SecureRandomTest.java @@ -102,6 +102,8 @@ public class SecureRandomTest extends TestCase { public void testNewConstructors_Success() throws Exception { SecureRandom sr1 = new SecureRandom(); + assertNotNull(sr1); + assertNotNull(sr1.getProvider()); assertEquals(EXPECTED_PROVIDER, sr1.getProvider().getClass().getName()); test_SecureRandom(sr1); -- cgit v1.1