Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -144,7 +144,7 @@ public void generate(String name) {
}

} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage());
throw new IllegalArgumentException(e.getMessage(), e);
}
generateInternal();
}
Expand All @@ -160,7 +160,7 @@ public void generate(int keyBits) {
keyGen.initialize(keyBits, prng);

} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage());
throw new IllegalArgumentException(e.getMessage(), e);
}
}
generateInternal();
Expand Down Expand Up @@ -317,7 +317,7 @@ public X509Certificate getSelfCertificate (X500Name myname, Date firstDate,

} catch (IOException e) {
throw new CertificateEncodingException("getSelfCert: " +
e.getMessage());
e.getMessage(), e);
} catch (InvalidAlgorithmParameterException e2) {
throw new SignatureException(
"Unsupported PSSParameterSpec: " + e2.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private static String expand(final String s) throws IOException {
try {
return PropertyExpander.expand(s);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
throw new RuntimeException(e.getMessage(), e);
}
}

Expand Down Expand Up @@ -395,6 +395,10 @@ private ConfigurationException excLine(String msg) {
return new ConfigurationException(msg + ", line " + st.lineno());
}

private ConfigurationException excLine(String msg, Throwable e) {
return new ConfigurationException(msg + ", line " + st.lineno(), e);
}

private void parse() throws IOException {
while (true) {
int token = nextToken();
Expand Down Expand Up @@ -799,7 +803,7 @@ private long parseMechanism(String mech) throws IOException {
try {
return Functions.getMechanismId(mech);
} catch (IllegalArgumentException e) {
throw excLine("Unknown mechanism: " + mech);
throw excLine("Unknown mechanism: " + mech, e);
}
}
}
Expand Down Expand Up @@ -959,7 +963,7 @@ private long parseObjectClass() throws IOException {
try {
return Functions.getObjectClassId(name);
} catch (IllegalArgumentException e) {
throw excLine("Unknown object class " + name);
throw excLine("Unknown object class " + name, e);
}
}

Expand All @@ -971,7 +975,7 @@ private long parseKeyAlgorithm() throws IOException {
try {
return Functions.getKeyId(name);
} catch (IllegalArgumentException e) {
throw excLine("Unknown key algorithm " + name);
throw excLine("Unknown key algorithm " + name, e);
}
}
}
Expand All @@ -983,7 +987,7 @@ private long decodeAttributeName(String name) throws IOException {
try {
return Functions.getAttributeId(name);
} catch (IllegalArgumentException e) {
throw excLine("Unknown attribute name " + name);
throw excLine("Unknown attribute name " + name, e);
}
}
}
Expand Down Expand Up @@ -1039,4 +1043,8 @@ class ConfigurationException extends IOException {
ConfigurationException(String msg) {
super(msg);
}

ConfigurationException(String msg, Throwable e) {
super(msg, e);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -139,7 +139,7 @@ private enum Transformation {
try {
engineSetPadding(algoParts[2]);
} catch (NoSuchPaddingException e) {
throw new NoSuchAlgorithmException();
throw new NoSuchAlgorithmException(e);
}
} else if (algoParts[0].equals("ChaCha20-Poly1305")) {
fixedKeySize = 32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void initialize(int keySize, SecureRandom random) {
try {
checkKeySize(keySize, null);
} catch (InvalidAlgorithmParameterException e) {
throw new InvalidParameterException(e.getMessage());
throw (InvalidParameterException) new InvalidParameterException(e.getMessage()).initCause(e);
}
this.params = null;
if (algorithm.equals("EC")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ private PrivateKey loadPkey(Session session, long oHandle)
RSAKeyFactory.checkKeyLengths(keyLength, null,
-1, Integer.MAX_VALUE);
} catch (InvalidKeyException e) {
throw new KeyStoreException(e.getMessage());
throw new KeyStoreException(e.getMessage(), e);
}

return P11Key.privateKey(session,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private void checkRSAKeyLength(int len) throws InvalidKeyException {
padding = RSAPadding.getInstance
(RSAPadding.PAD_BLOCKTYPE_1, (len + 7) >> 3);
} catch (InvalidAlgorithmParameterException iape) {
throw new InvalidKeyException(iape.getMessage());
throw new InvalidKeyException(iape.getMessage(), iape);
}
int maxDataSize = padding.getMaxDataSize();
int encodedLength;
Expand Down Expand Up @@ -801,7 +801,7 @@ private static byte[] dsaToASN1(byte[] signature) {
DerValue result = new DerValue(DerValue.tag_Sequence,
outseq.toByteArray());
return result.toByteArray();
} catch (java.io.IOException e) {
} catch (IOException e) {
throw new RuntimeException("Internal error", e);
}
}
Expand Down