openjdk: fix truststore-from-env patch for jdk10

storePropName will be jsseDefaultStore if the property isn't present, and
jsseDefaultStore is never null, so the branch to use the environment variable
would never be taken.

The env var is supposed to be preferred to jssecacerts, so we can use it as
the default in the call to System.getProperty, and use the null check to fall
back on jsseDefaultStore instead.
This commit is contained in:
Philip Lewis 2018-06-09 20:20:47 -04:00
parent 1aaab72291
commit 129ea5ed81

View File

@ -8,12 +8,22 @@
* jssecacerts * jssecacerts
* cacerts * cacerts
*/ */
@@ -144,6 +145,9 @@ @@ -132,7 +133,8 @@
public TrustStoreDescriptor run() {
// Get the system properties for trust store.
String storePropName = System.getProperty(
- "javax.net.ssl.trustStore", jsseDefaultStore);
+ "javax.net.ssl.trustStore",
+ System.getenv("JAVAX_NET_SSL_TRUSTSTORE"));
String storePropType = System.getProperty(
"javax.net.ssl.trustStoreType",
KeyStore.getDefaultType());
@@ -144,6 +146,9 @@
String temporaryName = ""; String temporaryName = "";
File temporaryFile = null; File temporaryFile = null;
long temporaryTime = 0L; long temporaryTime = 0L;
+ if (storePropName == null){ + if (storePropName == null) {
+ storePropName = System.getenv("JAVAX_NET_SSL_TRUSTSTORE"); + storePropName = jsseDefaultStore;
+ } + }
if (!"NONE".equals(storePropName)) { if (!"NONE".equals(storePropName)) {
String[] fileNames = String[] fileNames =