Fixed cacerts reading issue. Symbols and images should now downloaded properly. For #9135 and #9401.

This commit is contained in:
Alex Vasile 2022-08-25 19:43:13 -04:00
parent 9d54aee3ba
commit 65ed0f84fc
2 changed files with 14 additions and 2 deletions

View file

@ -73,6 +73,7 @@ import java.io.InputStream;
import java.net.SocketException; import java.net.SocketException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.*; import java.util.*;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -192,8 +193,19 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
* Creates new form MageFrame * Creates new form MageFrame
*/ */
public MageFrame() throws MageException { public MageFrame() throws MageException {
System.setProperty("javax.net.ssl.trustStore", System.getProperty("user.dir") + "/src/main/resources/cacerts".replace('/', File.separatorChar)); File cacertsFile = new File(System.getProperty("user.dir") + "/release/cacerts").getAbsoluteFile();
System.setProperty("javax.net.ssl.trustStorePassword","changeit"); if (!cacertsFile.exists()) { // When running from the jar file the contents of the /release folder will have been expanded into the home folder as part of packaging
cacertsFile = new File(System.getProperty("user.dir") + "/cacerts").getAbsoluteFile();
}
if (cacertsFile.exists()) {
LOGGER.info("Custom (or bundled) Java certificate file (cacerts) file found");
String cacertsPath = cacertsFile.getPath();
System.setProperty("javax.net.ssl.trustStore", cacertsPath);
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
} else {
LOGGER.info("custom Java certificate file not found at: " + cacertsFile.getAbsolutePath());
}
setWindowTitle(); setWindowTitle();
EDTExceptionHandler.registerExceptionHandler(); EDTExceptionHandler.registerExceptionHandler();