Commit 482a9feb authored by Costin Grigoras's avatar Costin Grigoras
Browse files

Fix initialization sequence

parent 4b6f43c0
......@@ -142,7 +142,7 @@ public class Xrootd extends Protocol {
final ProcessBuilder pBuilder = new ProcessBuilder(Arrays.asList(xrdcpPath, "--version"));
checkLibraryPath(pBuilder);
checkLibraryPath(pBuilder, defaultPath);
pBuilder.redirectErrorStream(true);
......@@ -1818,7 +1818,7 @@ public class Xrootd extends Protocol {
if (line != null) {
line = line.trim();
if (!line.equals("version") && !line.startsWith("["))
if (!"version".equals(line) && !line.startsWith("["))
if (line.startsWith("v"))
ret.setVersion("Xrootd", line);
else if (line.startsWith("dCache "))
......
......@@ -123,23 +123,23 @@ public class JAKeyStore {
static {
Security.addProvider(new BouncyCastleProvider());
KeyStore ktmp = null;
try {
ktmp = KeyStore.getInstance("JKS");
ktmp.load(null, pass);
loadTrusts(ktmp);
loadTrusts(ktmp, true);
}
catch (final KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) {
logger.log(Level.SEVERE, "Exception during loading trust stores (static block)", e);
e.printStackTrace();
}
trustStore = ktmp;
}
private static void loadTrusts(final KeyStore keystore) {
private static void loadTrusts(final KeyStore keystore, final boolean isTrustStore) {
final String trustsDirSet = ConfigUtils.getConfig().gets("trusted.certificates.location",
UserFactory.getUserHome() + System.getProperty("file.separator") + ".j" + System.getProperty("file.separator") + "trusts");
......@@ -191,9 +191,9 @@ public class JAKeyStore {
logger.log(Level.SEVERE, "Cannot load the default trust keystore from classpath", t);
}
if (keystore.equals(trustStore)) {
if (isTrustStore) {
final TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(trustStore);
tmf.init(keystore);
trusts = tmf.getTrustManagers();
}
}
......@@ -384,7 +384,7 @@ public class JAKeyStore {
try {
ks = KeyStore.getInstance("JKS");
ks.load(null, pass);
loadTrusts(ks);
loadTrusts(ks, false);
addKeyPairToKeyStore(ks, "User.cert", key, cert);
logger.log(Level.SEVERE, "Loaded " + message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment