diff -r b18d50d9e32e netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Mon Jun 30 11:34:15 2014 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Tue Jul 01 16:51:47 2014 +0200 @@ -321,18 +321,12 @@ */ private void addProperties(JNLPFile file, String[] props) throws LaunchException { ResourcesDesc resources = file.getResources(); - - for (int i = 0; i < props.length; i++) { - // allows empty property, not sure about validity of that. - int equals = props[i].indexOf("="); - if (equals == -1) { - throw launchError(new LaunchException(R("BBadProp", props[i]))); + for (String prop : props) { + try{ + resources.addResource(PropertyDesc.fromString(prop, R("BBadProp", prop))); + }catch (LaunchException ex){ + throw launchError(ex); } - - String key = props[i].substring(0, equals); - String value = props[i].substring(equals + 1, props[i].length()); - - resources.addResource(new PropertyDesc(key, value)); } } diff -r b18d50d9e32e netx/net/sourceforge/jnlp/PropertyDesc.java --- a/netx/net/sourceforge/jnlp/PropertyDesc.java Mon Jun 30 11:34:15 2014 -0400 +++ b/netx/net/sourceforge/jnlp/PropertyDesc.java Tue Jul 01 16:51:47 2014 +0200 @@ -24,11 +24,30 @@ */ public class PropertyDesc { + /** + * + * @param prop - the property to be parsed from format key=value + * @param errorMEssage - the message for error. We do not wont to bother PropertyDesc with localization overhead + * @return new PropertyDesc based on parsed key=value, though composed from key and value + */ + public static PropertyDesc fromString(String prop, String errorMEssage) throws LaunchException { + // allows empty property, not sure about validity of that. + int equals = prop.indexOf("="); + if (equals == -1) { + throw new LaunchException(errorMEssage); + } + String key = prop.substring(0, equals); + String value = prop.substring(equals + 1, prop.length()); + + return new PropertyDesc(key, value); + + } + /** the key name */ - private String key; + final private String key; /** the value */ - private String value; + final private String value; /** * Creates a property descriptor. diff -r b18d50d9e32e netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Mon Jun 30 11:34:15 2014 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Tue Jul 01 16:51:47 2014 +0200 @@ -33,6 +33,7 @@ import net.sourceforge.jnlp.LaunchException; import net.sourceforge.jnlp.Launcher; import net.sourceforge.jnlp.ParserSettings; +import net.sourceforge.jnlp.PropertyDesc; import net.sourceforge.jnlp.about.AboutDialog; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.UpdatePolicy; @@ -138,6 +139,17 @@ if (null != getOption("-headless")) { JNLPRuntime.setHeadless(true); } + String[] properties = getOptions("-property"); + if (properties != null) { + for (String prop : properties) { + try { + PropertyDesc propDesc = PropertyDesc.fromString(prop, "Unlocalised error for parsing the property. It must be in fomrat key=value. It is: " + prop); + JNLPRuntime.getConfiguration().setProperty(propDesc.getKey(), propDesc.getValue()); + } catch (LaunchException ex) { + OutputController.getLogger().log(ex); + } + } + } DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched();