Skip to content

Commit 172adba

Browse files
committed
Throwing exception if TLS.keystore_path doesn't exist
1 parent e0cf7b2 commit 172adba

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/org/jgroups/stack/GossipRouter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ public GossipRouter init() throws Exception {
170170
.registerProbeHandler(this)
171171
.printHeaders(b -> String.format("GossipRouter [addr=%s, cluster=GossipRouter, version=%s]\n",
172172
localAddress(), Version.description));
173-
tls.init();
174173
return this;
175174
}
176175

@@ -919,6 +918,7 @@ public static void main(String[] args) throws Exception {
919918
.setPasscode(diag_passcode);
920919
String type="";
921920
if(tls.enabled()) {
921+
tls.init();
922922
SSLContext context=tls.createContext();
923923
SocketFactory socket_factory=tls.createSocketFactory(context);
924924
router.socketFactory(socket_factory);

src/org/jgroups/util/TLS.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import javax.net.ssl.SSLContext;
99
import javax.net.ssl.SSLParameters;
1010
import javax.net.ssl.SSLServerSocket;
11+
import java.io.File;
12+
import java.io.FileNotFoundException;
1113
import java.util.ArrayList;
1214
import java.util.List;
1315

@@ -111,6 +113,11 @@ public void init() throws Exception {
111113
truststore_type=keystore_type;
112114
truststore_password=keystore_password;
113115
}
116+
if(keystore_path != null) {
117+
File tmp=new File(keystore_path);
118+
if(!tmp.exists())
119+
throw new FileNotFoundException(keystore_path);
120+
}
114121
}
115122

116123
public SSLContext createContext() {

0 commit comments

Comments
 (0)