提交 4e54e999 编写于 作者: C coffeys

8185855: Debug exception stacks should be clearer

Reviewed-by: mullan, ascarpino
上级 1f86a9b8
...@@ -88,8 +88,8 @@ class IdentityScope extends Identity { ...@@ -88,8 +88,8 @@ class IdentityScope extends Identity {
try { try {
Class.forName(classname); Class.forName(classname);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
//Security.error("unable to establish a system scope from " + System.err.println("unable to establish a system scope from " +
// classname); classname);
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -1051,7 +1051,7 @@ public abstract class Signature extends SignatureSpi { ...@@ -1051,7 +1051,7 @@ public abstract class Signature extends SignatureSpi {
debug.println("Further warnings of this type will " debug.println("Further warnings of this type will "
+ "be suppressed"); + "be suppressed");
} }
new Exception("Call trace").printStackTrace(); new Exception("Debug call trace").printStackTrace();
} }
} }
Exception lastException = null; Exception lastException = null;
......
...@@ -275,7 +275,7 @@ public final class ProviderList { ...@@ -275,7 +275,7 @@ public final class ProviderList {
} }
if (debug != null) { if (debug != null) {
debug.println("Loading all providers"); debug.println("Loading all providers");
new Exception("Call trace").printStackTrace(); new Exception("Debug Info. Call trace:").printStackTrace();
} }
int n = 0; int n = 0;
for (int i = 0; i < configs.length; i++) { for (int i = 0; i < configs.length; i++) {
......
...@@ -347,7 +347,6 @@ public class PKCS8Key implements PrivateKey { ...@@ -347,7 +347,6 @@ public class PKCS8Key implements PrivateKey {
} }
} catch (IOException e) { } catch (IOException e) {
// e.printStackTrace ();
throw new InvalidKeyException("IOException : " + throw new InvalidKeyException("IOException : " +
e.getMessage()); e.getMessage());
} }
......
...@@ -186,6 +186,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy { ...@@ -186,6 +186,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy {
} catch (Exception e) { } catch (Exception e) {
// ignore, treat it like we have no keystore // ignore, treat it like we have no keystore
if (debug != null) { if (debug != null) {
debug.println("Debug info only. No keystore.");
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
...@@ -260,7 +261,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy { ...@@ -260,7 +261,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy {
loaded_one = true; loaded_one = true;
} catch (Exception e) { } catch (Exception e) {
if (debug != null) { if (debug != null) {
debug.println("error reading policy " + e); debug.println("Debug info only. Error reading policy " + e);
e.printStackTrace(); e.printStackTrace();
} }
// ignore that policy // ignore that policy
......
...@@ -434,18 +434,6 @@ abstract class DSA extends SignatureSpi { ...@@ -434,18 +434,6 @@ abstract class DSA extends SignatureSpi {
return printable; 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. * Standard SHA224withDSA implementation as defined in FIPS186-3.
*/ */
......
...@@ -563,7 +563,8 @@ public class PolicyFile extends java.security.Policy { ...@@ -563,7 +563,8 @@ public class PolicyFile extends java.security.Policy {
loaded_policy = true; loaded_policy = true;
} catch (Exception e) { } catch (Exception e) {
if (debug != null) { if (debug != null) {
debug.println("error reading policy "+e); debug.println(
"Debug info only. Error reading policy " +e);
e.printStackTrace(); e.printStackTrace();
} }
// ignore that policy // ignore that policy
...@@ -616,6 +617,7 @@ public class PolicyFile extends java.security.Policy { ...@@ -616,6 +617,7 @@ public class PolicyFile extends java.security.Policy {
} catch (Exception e) { } catch (Exception e) {
// ignore, treat it like we have no keystore // ignore, treat it like we have no keystore
if (debug != null) { if (debug != null) {
debug.println("Debug info only. Ignoring exception.");
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -75,8 +75,8 @@ public class AnchorCertificates { ...@@ -75,8 +75,8 @@ public class AnchorCertificates {
} catch (Exception e) { } catch (Exception e) {
if (debug != null) { if (debug != null) {
debug.println("Error parsing cacerts"); debug.println("Error parsing cacerts");
e.printStackTrace();
} }
e.printStackTrace();
} }
return null; return null;
} }
......
...@@ -380,8 +380,9 @@ public class SignatureFileVerifier { ...@@ -380,8 +380,9 @@ public class SignatureFileVerifier {
if (e.getMessage() != null) { if (e.getMessage() != null) {
debug.println(key + ": " + e.getMessage()); debug.println(key + ": " + e.getMessage());
} else { } else {
debug.println(key + ": " + algorithm + debug.println("Debug info only. " + key + ": " +
" was disabled, no exception msg given."); algorithm +
" was disabled, no exception msg given.");
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -124,7 +124,8 @@ public class CertificateExtensions implements CertAttrSet<Extension> { ...@@ -124,7 +124,8 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
unparseableExtensions.put(ext.getExtensionId().toString(), unparseableExtensions.put(ext.getExtensionId().toString(),
new UnparseableExtension(ext, e)); new UnparseableExtension(ext, e));
if (debug != null) { if (debug != null) {
debug.println("Error parsing extension: " + ext); debug.println("Debug info only." +
" Error parsing extension: " + ext);
e.printStackTrace(); e.printStackTrace();
HexDumpEncoder h = new HexDumpEncoder(); HexDumpEncoder h = new HexDumpEncoder();
System.err.println(h.encodeBuffer(ext.getExtensionValue())); System.err.println(h.encodeBuffer(ext.getExtensionValue()));
......
...@@ -393,7 +393,6 @@ public class X509Key implements PublicKey { ...@@ -393,7 +393,6 @@ public class X509Key implements PublicKey {
throw new InvalidKeyException ("excess key data"); throw new InvalidKeyException ("excess key data");
} catch (IOException e) { } catch (IOException e) {
// e.printStackTrace ();
throw new InvalidKeyException("IOException: " + throw new InvalidKeyException("IOException: " +
e.getMessage()); e.getMessage());
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册