Skip to content

Commit 28614e5

Browse files
committed
OWS-631: Fix properties defined in Jnlp not passed to application
1 parent c139a18 commit 28614e5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

core/src/main/java/net/sourceforge/jnlp/runtime/ApplicationInstance.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package net.sourceforge.jnlp.runtime;
1818

19+
import net.adoptopenjdk.icedteaweb.JavaSystemPropertiesConstants;
1920
import net.adoptopenjdk.icedteaweb.jnlp.element.resource.ExtensionDesc;
2021
import net.adoptopenjdk.icedteaweb.jnlp.element.resource.PropertyDesc;
2122
import net.adoptopenjdk.icedteaweb.jnlp.element.security.SecurityDesc;
@@ -143,9 +144,6 @@ private void installEnvironment() {
143144
}
144145

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

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

159157
final PrivilegedAction<Object> setPropertiesAction = () -> {
160158
for (PropertyDesc propDesc : props) {
161-
LOG.debug("Setting System Property {} with value {}", propDesc.getKey(), propDesc.getValue());
162-
System.setProperty(propDesc.getKey(), propDesc.getValue());
159+
if (!propDesc.getKey().equals(JavaSystemPropertiesConstants.HTTP_AGENT)) {
160+
setSystemProperty(propDesc);
161+
} else if (!"true".equalsIgnoreCase(System.getenv(ApplicationInstance.IGNORE_JNLP_RESOURCE_PROPERTIES))) {
162+
setSystemProperty(propDesc);
163+
}
163164
}
164165
return null;
165166
};
@@ -169,6 +170,11 @@ private void setSystemPropertiesFromJnlp() {
169170
}
170171
}
171172

173+
private void setSystemProperty(PropertyDesc propDesc) {
174+
LOG.debug("Setting System Property {} with value {}", propDesc.getKey(), propDesc.getValue());
175+
System.setProperty(propDesc.getKey(), propDesc.getValue());
176+
}
177+
172178
/**
173179
* Returns the jnlpfile on which is this application based
174180
* @return JNLP file for this task.

0 commit comments

Comments
 (0)