After updating to Java 8 update 101, I am getting exception in following code. It was working fine with Java 8 update 91.
Accessing keystore:
KeyStore ks = KeyStore.getInstance("WINDOWS-MY");
ks.load(null, null);
Field field = ks.getClass().getDeclaredField("keyStoreSpi");
field.setAccessible(true);
KeyStoreSpi kss = (KeyStoreSpi) field.get(ks);
Collection entries;
field = kss.getClass().getEnclosingClass().getDeclaredField("entries");
field.setAccessible(true);
// This is where the exception happens
entries = (Collection) field.get(kss);
// I then have to loop on these entries, something like this:
for (Object entry : entries) { //code }
Type casting, exception is thrown:
java.util.HashMap cannot be cast to java.util.Collection
Any recent changes in Java 8 update 101? How to solve it?