Revert "Java: Remove e.printStracktrace() in favor of a cause (#207)" (#219)

This reverts commit 6495d823d96860bedd177e712b73bae94da01d45.
diff --git a/java/src/main/java/com/google/crypto/tink/subtle/EngineFactory.java b/java/src/main/java/com/google/crypto/tink/subtle/EngineFactory.java
index a88b0a2..5b2a4fb 100644
--- a/java/src/main/java/com/google/crypto/tink/subtle/EngineFactory.java
+++ b/java/src/main/java/com/google/crypto/tink/subtle/EngineFactory.java
@@ -155,23 +155,28 @@
   }
 
   public T_ENGINE getInstance(String algorithm) throws GeneralSecurityException {
-    Exception cause = null;
-    for (Provider provider : this.policy) {
-      try {
-        return this.instanceBuilder.getInstance(algorithm, provider);
-      } catch (Exception e) {
-        if (cause == null) {
-          cause = e;
-        }
+    for (Provider p : this.policy) {
+      if (tryProvider(algorithm, p)) {
+        return this.instanceBuilder.getInstance(algorithm, p);
       }
     }
     if (letFallback) {
       return this.instanceBuilder.getInstance(algorithm, null);
     }
-    throw new GeneralSecurityException("No good Provider found.", cause);
+    throw new GeneralSecurityException("No good Provider found.");
   }
 
   private T_WRAPPER instanceBuilder;
   private List<Provider> policy;
   private boolean letFallback;
+
+  private boolean tryProvider(String algorithm, Provider provider) {
+    try {
+      this.instanceBuilder.getInstance(algorithm, provider);
+      return true;
+    } catch (Exception e) { // Don't care which one specifically.
+      e.printStackTrace();
+      return false;
+    }
+  }
 }