Skip to content

Commit

Permalink
Update Server.java
Browse files Browse the repository at this point in the history
1. remove superfluous URISyntaxException
2. change System.out.printf to LOGGER.debug
3. use `createSSLContext(boolean)` instead of deprecated API `createSSLContext()`
  • Loading branch information
leaf-soba committed Sep 10, 2024
1 parent 7d09ec5 commit 7314a83
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/org/jabref/http/server/Server.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jabref.http.server;

import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -32,7 +31,7 @@ public class Server {
* Starts an http server serving the last files opened in JabRef<br>
* More files can be provided as args.
*/
public static void main(final String[] args) throws InterruptedException, URISyntaxException {
public static void main(final String[] args) throws InterruptedException {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();

Expand Down Expand Up @@ -86,12 +85,12 @@ private static void startServer() {
SeBootstrap.start(Application.class, configuration).thenAccept(instance -> {
LOGGER.debug("Server started.");
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
LOGGER.debug("Stop result: {} [Native stop result: {}].", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
LOGGER.debug("Instance {} running at {} [Native handle: {}].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
LOGGER.debug("Send SIGKILL to shutdown.");
serverInstance = instance;
});
}
Expand All @@ -111,7 +110,7 @@ private static SSLContext getSslContext() {
LOGGER.error("Could not find server key store {}.", serverKeyStore);
LOGGER.error("One create one by following the steps described in [http-server.md](/docs/code-howtos/http-server.md), which is rendered at <https://devdocs.jabref.org/code-howtos/http-server.html>");
}
return sslContextConfig.createSSLContext();
return sslContextConfig.createSSLContext(false);
}

static void stopServer() {
Expand Down

0 comments on commit 7314a83

Please sign in to comment.