1717package net .sourceforge .jnlp .runtime ;
1818
1919import net .adoptopenjdk .icedteaweb .JavaSystemPropertiesConstants ;
20+ import net .adoptopenjdk .icedteaweb .StringUtils ;
2021import net .adoptopenjdk .icedteaweb .jnlp .element .resource .ExtensionDesc ;
2122import net .adoptopenjdk .icedteaweb .jnlp .element .resource .PropertyDesc ;
2223import net .adoptopenjdk .icedteaweb .jnlp .element .security .SecurityDesc ;
3940import java .security .ProtectionDomain ;
4041import java .util .ArrayList ;
4142import java .util .Arrays ;
43+ import java .util .Collections ;
44+ import java .util .HashSet ;
4245import java .util .List ;
46+ import java .util .Set ;
47+
4348/**
4449 * Represents a running instance of an application described in a
4550 * JNLPFile. This class provides a way to track the application's
@@ -54,7 +59,16 @@ public class ApplicationInstance {
5459
5560 private static final String DEPLOYMENT_SYSPROP = "deployment.javaws" ;
5661 private static final String DEPLOYMENT_SYSPROP_VALUE = "IcedTea-Web" ;
57- public static final String IGNORE_HTTP_AGENT_PROPERTY = "ignoreHttpAgentProperty" ;
62+ public static final String BLACKLIST_FOR_JNLP_PROPERTIES = "blacklistForJnlpProperties" ;
63+ public static final String BLACKLISTED_PROPERTIES_SEPARATOR = "=" ;
64+
65+ public static Set <String > getBlackListedJnlpProperties () {
66+ final String blackListedProprtiesString = System .getenv (BLACKLIST_FOR_JNLP_PROPERTIES );
67+ if (StringUtils .isBlank (blackListedProprtiesString )) {
68+ return Collections .emptySet ();
69+ }
70+ return new HashSet <>(Arrays .asList (blackListedProprtiesString .split (BLACKLISTED_PROPERTIES_SEPARATOR )));
71+ }
5872
5973 // todo: should attempt to unload the environment variables
6074 // installed by the application.
@@ -155,10 +169,9 @@ private void setSystemPropertiesFromJnlp() {
155169 final AccessControlContext acc = new AccessControlContext (new ProtectionDomain [] { pd });
156170
157171 final PrivilegedAction <Object > setPropertiesAction = () -> {
172+ final Set <String > blackListedJnlpProperties = getBlackListedJnlpProperties ();
158173 for (PropertyDesc propDesc : props ) {
159- if (!propDesc .getKey ().equals (JavaSystemPropertiesConstants .HTTP_AGENT )) {
160- setSystemProperty (propDesc );
161- } else if (!"true" .equalsIgnoreCase (System .getenv (ApplicationInstance .IGNORE_HTTP_AGENT_PROPERTY ))) {
174+ if (!blackListedJnlpProperties .contains (propDesc .getKey ())) {
162175 setSystemProperty (propDesc );
163176 }
164177 }
0 commit comments