8185855: Debug exception stacks should be clearer

Reviewed-by: mullan, ascarpino
This commit is contained in:
Sean Coffey 2017-12-06 14:33:33 +00:00
parent a923e57c7b
commit 0c7be1d9e7
11 changed files with 15 additions and 24 deletions

View file

@ -90,8 +90,8 @@ class IdentityScope extends Identity {
try {
Class.forName(classname);
} catch (ClassNotFoundException e) {
//Security.error("unable to establish a system scope from " +
// classname);
System.err.println("unable to establish a system scope from " +
classname);
e.printStackTrace();
}
}

View file

@ -1074,7 +1074,7 @@ public abstract class Signature extends SignatureSpi {
debug.println("Further warnings of this type will "
+ "be suppressed");
}
new Exception("Call trace").printStackTrace();
new Exception("Debug call trace").printStackTrace();
}
}
Exception lastException = null;

View file

@ -308,7 +308,7 @@ public final class ProviderList {
}
if (debug != null) {
debug.println("Loading all providers");
new Exception("Call trace").printStackTrace();
new Exception("Debug Info. Call trace:").printStackTrace();
}
int n = 0;
for (int i = 0; i < configs.length; i++) {

View file

@ -346,7 +346,6 @@ public class PKCS8Key implements PrivateKey {
}
} catch (IOException e) {
// e.printStackTrace ();
throw new InvalidKeyException("IOException : " +
e.getMessage());
}

View file

@ -187,6 +187,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy {
} catch (Exception e) {
// ignore, treat it like we have no keystore
if (debug != null) {
debug.println("Debug info only. No keystore.");
e.printStackTrace();
}
return null;
@ -261,7 +262,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy {
loaded_one = true;
} catch (Exception e) {
if (debug != null) {
debug.println("error reading policy " + e);
debug.println("Debug info only. Error reading policy " + e);
e.printStackTrace();
}
// ignore that policy

View file

@ -490,18 +490,6 @@ abstract class DSA extends SignatureSpi {
return printable;
}
private static void debug(Exception e) {
if (debug) {
e.printStackTrace();
}
}
private static void debug(String s) {
if (debug) {
System.err.println(s);
}
}
/**
* Standard SHA224withDSA implementation as defined in FIPS186-3.
*/

View file

@ -512,7 +512,8 @@ public class PolicyFile extends java.security.Policy {
}
} catch (Exception e) {
if (debug != null) {
debug.println("error reading policy "+e);
debug.println(
"Debug info only. Error reading policy " +e);
e.printStackTrace();
}
// ignore that policy
@ -559,6 +560,7 @@ public class PolicyFile extends java.security.Policy {
} catch (Exception e) {
// ignore, treat it like we have no keystore
if (debug != null) {
debug.println("Debug info only. Ignoring exception.");
e.printStackTrace();
}
}

View file

@ -75,8 +75,8 @@ public class AnchorCertificates {
} catch (Exception e) {
if (debug != null) {
debug.println("Error parsing cacerts");
e.printStackTrace();
}
e.printStackTrace();
}
return null;
}

View file

@ -386,8 +386,9 @@ public class SignatureFileVerifier {
if (e.getMessage() != null) {
debug.println(key + ": " + e.getMessage());
} else {
debug.println(key + ": " + algorithm +
" was disabled, no exception msg given.");
debug.println("Debug info only. " + key + ": " +
algorithm +
" was disabled, no exception msg given.");
e.printStackTrace();
}
}

View file

@ -124,7 +124,8 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
unparseableExtensions.put(ext.getExtensionId().toString(),
new UnparseableExtension(ext, e));
if (debug != null) {
debug.println("Error parsing extension: " + ext);
debug.println("Debug info only." +
" Error parsing extension: " + ext);
e.printStackTrace();
HexDumpEncoder h = new HexDumpEncoder();
System.err.println(h.encodeBuffer(ext.getExtensionValue()));

View file

@ -392,7 +392,6 @@ public class X509Key implements PublicKey {
throw new InvalidKeyException ("excess key data");
} catch (IOException e) {
// e.printStackTrace ();
throw new InvalidKeyException("IOException: " +
e.getMessage());
}