Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
79d646d3
Commit
79d646d3
authored
Apr 24, 2022
by
memetrollsXD
Browse files
Remove last catch and init another variable as placeholder
parent
bed31812
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
79d646d3
...
@@ -177,11 +177,12 @@ public final class DispatchServer {
...
@@ -177,11 +177,12 @@ public final class DispatchServer {
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePath
))
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePath
))
{
char
[]
keystorePassword
=
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePassword
.
toCharArray
();
char
[]
keystorePassword
=
Grasscutter
.
getConfig
().
getDispatchOptions
().
KeystorePassword
.
toCharArray
();
KeyManagerFactory
_kmf
;
try
{
try
{
KeyStore
ks
=
KeyStore
.
getInstance
(
"PKCS12"
);
KeyStore
ks
=
KeyStore
.
getInstance
(
"PKCS12"
);
ks
.
load
(
fis
,
keystorePassword
);
ks
.
load
(
fis
,
keystorePassword
);
KeyManagerFactory
kmf
=
KeyManagerFactory
.
getInstance
(
"SunX509"
);
KeyManagerFactory
kmf
=
KeyManagerFactory
.
getInstance
(
"SunX509"
);
_kmf
=
kmf
;
kmf
.
init
(
ks
,
keystorePassword
);
kmf
.
init
(
ks
,
keystorePassword
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
warn
(
"[Dispatch] Unable to load keystore. Using default keystore password..."
);
Grasscutter
.
getLogger
().
warn
(
"[Dispatch] Unable to load keystore. Using default keystore password..."
);
...
@@ -189,11 +190,10 @@ public final class DispatchServer {
...
@@ -189,11 +190,10 @@ public final class DispatchServer {
ks
.
load
(
fis
,
"123456"
.
toCharArray
());
ks
.
load
(
fis
,
"123456"
.
toCharArray
());
KeyManagerFactory
kmf
=
KeyManagerFactory
.
getInstance
(
"SunX509"
);
KeyManagerFactory
kmf
=
KeyManagerFactory
.
getInstance
(
"SunX509"
);
kmf
.
init
(
ks
,
"123456"
.
toCharArray
());
kmf
.
init
(
ks
,
"123456"
.
toCharArray
());
}
catch
(
Exception
e
)
{
_kmf
=
kmf
;
Grasscutter
.
getLogger
().
warn
(
"[Dispatch] Error while loading keystore!"
);
}
}
sslContext
.
init
(
kmf
.
getKeyManagers
(),
null
,
null
);
sslContext
.
init
(
_
kmf
.
getKeyManagers
(),
null
,
null
);
httpsServer
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
httpsServer
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
server
=
httpsServer
;
server
=
httpsServer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment