Skip to content

Commit

Permalink
Merge pull request AdoptOpenJDK#887 from AdoptOpenJDK/ows170_changes
Browse files Browse the repository at this point in the history
Ows170 changes
  • Loading branch information
sclassen authored Nov 25, 2022
2 parents 99b7db0 + 319985d commit 83206bf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,11 @@ public void lock() throws IOException {
return;
}

logger.debug("Trying to create lock file {}", lockFile.getPath());
while (file.exists() && !tryLock()) {
try {
Thread.sleep(500);
logger.debug("Trying to create lock file {}", lockFile.getPath());
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ public void actionPerformed(ActionEvent e) {
if (returnVal == JFileChooser.APPROVE_OPTION) {
try {
KeyStore ks = keyStore.getKs();
if (currentKeyStoreType == KeyStores.Type.CLIENT_CERTS) {
LOG.debug("Importing Cert " + chooser.getSelectedFile().getName() + " into " + keyStore.getPath());
if (currentKeyStoreType == KeyStores.Type.CLIENT_CERTS && !JNLPRuntime.getExtensionPoint().enableClientCertImportWithoutPassword()) {
char[] password = getPassword(R("CVImportPasswordMessage"));
if (password != null) {
final KeyStore caks = KeyStores.getKeyStore(currentKeyStoreLevel, KeyStores.Type.CA_CERTS).getKs();
Expand All @@ -433,7 +434,6 @@ public void actionPerformed(ActionEvent e) {
CertificateUtils.addToKeyStore(chooser.getSelectedFile(), ks);
}
storeKeyStore(ks, currentKeyStoreType);

repopulateTables();
} catch (Exception ex) {
// TODO: handle exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ default List<String> getTranslationResources() {
default String uniqueShortcutSuffix(JNLPFile jnlpFile) {
return "";
}

default boolean enableClientCertImportWithoutPassword() {
return false;
}
}
4 changes: 2 additions & 2 deletions core/src/main/java/net/sourceforge/jnlp/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ private IconDesc getIcon(XmlNode node) throws ParseException {
String sizeInString = getAttribute(node, IconDesc.SIZE_ATTRIBUTE, "-1");
try {
size = Integer.parseInt(sizeInString);
}
catch (NumberFormatException NumberFormatException) {
}
catch (NumberFormatException numberFormatException) {
String[] WidthXHeight = sizeInString.split("x");
width = Integer.parseInt(WidthXHeight[0]);
height = Integer.parseInt(WidthXHeight[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ static boolean checkUrl(final URL file) {
* @throws ConfigurationException if it encounters a fatal error.
*/
public void load() throws ConfigurationException {
LOG.debug("Start DeploymentConfiguration.load()");
try {
load(true);
} catch (final MalformedURLException ex) {
throw new ConfigurationException(ex.toString());
} finally {
LOG.debug("End DeploymentConfiguration.load()");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ private Policy getPolicyFromConfig(String key) {
* @return a policy based on the configuration set by the user
*/
private Policy getPolicyFromUrl(String policyLocation) {
LOG.debug("Begin getPolicyFromUrl({})", policyLocation);
Policy policy = null;
if (policyLocation != null) {
try {
Expand All @@ -237,11 +238,14 @@ private Policy getPolicyFromUrl(String policyLocation) {
} else {
policyUri = new URI(policyLocation.replace("\\", "/"));
}
LOG.debug("Start Policy.getInstance({})", policyUri.toString());
policy = getInstance("JavaPolicy", new URIParameter(policyUri));
LOG.debug("End Policy.getInstance({})", policyUri.toString());
} catch (Exception e) {
LOG.error("Error while loading the policy from URL " + policyLocation, e);
}
}
LOG.debug("End getPolicyFromUrl()");
return policy;
}

Expand Down
12 changes: 10 additions & 2 deletions core/src/main/java/net/sourceforge/jnlp/runtime/JNLPRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public static boolean isInitialized() {
* @throws IllegalStateException if the runtime was previously initialized
*/
public static void initialize() throws IllegalStateException {
LOG.debug("Begin JNLPRuntime.initialize()");
checkInitialized();

try {
Expand Down Expand Up @@ -256,7 +257,10 @@ public static void initialize() throws IllegalStateException {

ServiceManager.setServiceManagerStub(new XServiceManagerStub()); // ignored if we're running under Web Start

LOG.debug("Start get JavaPolicy");
policy = new JNLPPolicy();
LOG.debug("Finished get JavaPolicy");

security = new JNLPSecurityManager(); // side effect: create JWindow

doMainAppContextHacks();
Expand All @@ -267,6 +271,7 @@ public static void initialize() throws IllegalStateException {
}

securityDialogMessageHandler = startSecurityThreads();
LOG.debug("Started Security Thread");

// wire in custom authenticator for SSL connections
try {
Expand All @@ -286,8 +291,10 @@ public static void initialize() throws IllegalStateException {

// plug in a custom authenticator and proxy selector
Authenticator.setDefault(new JNLPAuthenticator());
LOG.debug("Start Proxy Selector");
ProxySelector proxySelector = getExtensionPoint().createProxySelector(getConfiguration());
ProxySelector.setDefault(proxySelector);
LOG.debug("Finished Proxy Selector");

// Restrict access to netx classes
Security.setProperty("package.access",
Expand All @@ -296,12 +303,13 @@ public static void initialize() throws IllegalStateException {
URLJarFile.setCallBack(CachedJarFileCallback.getInstance());

initialized = true;

LOG.debug("End JNLPRuntime.initialize()");
}

public static void reloadPolicy() {
LOG.debug("Start JNLPRuntime.reloadPolicy()");
policy.refresh();

LOG.debug("End JNLPRuntime.reloadPolicy()");
}

/**
Expand Down

0 comments on commit 83206bf

Please sign in to comment.