Skip to content

Commit

Permalink
OWS-631: Fix properties defined in Jnlp not passed to application
Browse files Browse the repository at this point in the history
  • Loading branch information
janakmulani committed Jun 4, 2024
1 parent c139a18 commit 28614e5
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package net.sourceforge.jnlp.runtime;

import net.adoptopenjdk.icedteaweb.JavaSystemPropertiesConstants;
import net.adoptopenjdk.icedteaweb.jnlp.element.resource.ExtensionDesc;
import net.adoptopenjdk.icedteaweb.jnlp.element.resource.PropertyDesc;
import net.adoptopenjdk.icedteaweb.jnlp.element.security.SecurityDesc;
Expand Down Expand Up @@ -143,9 +144,6 @@ private void installEnvironment() {
}

private void setSystemPropertiesFromJnlp() {
if ("true".equalsIgnoreCase(System.getenv(IGNORE_JNLP_RESOURCE_PROPERTIES))) {
return;
}
final List<PropertyDesc> props = collectPropertiesFromJnlpHierarchy(new ArrayList<>(), file);

if (!(props.size() == 0)) {
Expand All @@ -158,8 +156,11 @@ private void setSystemPropertiesFromJnlp() {

final PrivilegedAction<Object> setPropertiesAction = () -> {
for (PropertyDesc propDesc : props) {
LOG.debug("Setting System Property {} with value {}", propDesc.getKey(), propDesc.getValue());
System.setProperty(propDesc.getKey(), propDesc.getValue());
if (!propDesc.getKey().equals(JavaSystemPropertiesConstants.HTTP_AGENT)) {
setSystemProperty(propDesc);
} else if (!"true".equalsIgnoreCase(System.getenv(ApplicationInstance.IGNORE_JNLP_RESOURCE_PROPERTIES))) {
setSystemProperty(propDesc);
}
}
return null;
};
Expand All @@ -169,6 +170,11 @@ private void setSystemPropertiesFromJnlp() {
}
}

private void setSystemProperty(PropertyDesc propDesc) {
LOG.debug("Setting System Property {} with value {}", propDesc.getKey(), propDesc.getValue());
System.setProperty(propDesc.getKey(), propDesc.getValue());
}

/**
* Returns the jnlpfile on which is this application based
* @return JNLP file for this task.
Expand Down

0 comments on commit 28614e5

Please sign in to comment.