Skip to content

Commit

Permalink
Cleaning up some Exception handling in SSLSocketFactory
Browse files Browse the repository at this point in the history
relates #1018
  • Loading branch information
jbaiera committed Jul 19, 2017
1 parent 4e1e6a1 commit 56582fd
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,18 @@ private KeyStore loadKeyStore(String location, char[] pass) throws GeneralSecuri
if (LOG.isDebugEnabled()) {
LOG.debug("Loading keystore located at [" + location + "]");
}
in = IOUtils.open(location);
if (in == null) {

try {
in = IOUtils.open(location);
if (in == null) {
throw new EsHadoopIllegalArgumentException(String.format("Could not locate [%s] on classpath", location));
}
} catch (Exception e) {
throw new EsHadoopIllegalArgumentException(String.format("Expected to find keystore file at [%s] but " +
"was unable to. Make sure that it is available on the classpath, or if not, that you have " +
"specified a valid URI.", location));
}

keyStore.load(in, pass);
}
finally {
Expand Down

0 comments on commit 56582fd

Please sign in to comment.