Mercurial > hg > release > icedtea-web-1.7
changeset 1189:cbc450f7203f
PathsAndFiles definitions made aware of deployment.properties which can change them
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Wed, 01 Apr 2015 18:39:20 +0200 |
parents | 8661e15b9f1b |
children | c1ee9d4fa266 |
files | ChangeLog netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java netx/net/sourceforge/jnlp/config/Defaults.java netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java netx/net/sourceforge/jnlp/config/PathsAndFiles.java netx/net/sourceforge/jnlp/controlpanel/CachePane.java netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java |
diffstat | 9 files changed, 225 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Apr 01 18:09:27 2015 +0200 +++ b/ChangeLog Wed Apr 01 18:39:20 2015 +0200 @@ -1,3 +1,22 @@ +2015-04-01 Jiri Vanek <jvanek@redhat.com> + + PathsAndFiles definitions made aware of deployment.properties which can change them + * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java: (CacheLRUWrapper) used + gette rinstead of field for RECENTLY_USED_FILE + * netx/net/sourceforge/jnlp/config/Defaults.java: all getFullPath replaced + by getDefaultFullPath. + * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: removed read + from properties and repalced by getters from PathsAndFiles. + * netx/net/sourceforge/jnlp/controlpanel/CachePane.java: same + * tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java: same + * netx/net/sourceforge/jnlp/config/PathsAndFiles.java: Or setup-able InfrastructureFileDescriptor + now can return their non-default value by overriden getFullPath and reading + from properties. + * netx/net/sourceforge/jnlp/resources/Messages.properties: added BUTControlledBy + of Controlled by and BUTmodified of modified + * netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: now uses new + Messages.properties keys + 2015-03-31 Jiri Vanek <jvanek@redhat.com> PolicyEditor now honor verbose switch
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Wed Apr 01 18:39:20 2015 +0200 @@ -71,7 +71,7 @@ private final File cacheDir; public CacheLRUWrapper() { - this(PathsAndFiles.RECENTLY_USED_FILE.getFile(), PathsAndFiles.CACHE_DIR.getFile()); + this(PathsAndFiles.getRecentlyUsedFile().getFile(), PathsAndFiles.CACHE_DIR.getFile()); }
--- a/netx/net/sourceforge/jnlp/config/Defaults.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/config/Defaults.java Wed Apr 01 18:39:20 2015 +0200 @@ -59,6 +59,7 @@ public static Map<String, Setting<String>> getDefaults() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { + sm.checkRead(USER_DEPLOYMENT_FILE.getDefaultFullPath()); sm.checkRead(USER_DEPLOYMENT_FILE.getFullPath()); } @@ -79,12 +80,12 @@ { DeploymentConfiguration.KEY_USER_CACHE_DIR, BasicValueValidators.getFilePathValidator(), - CACHE_DIR.getFullPath() + CACHE_DIR.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR, BasicValueValidators.getFilePathValidator(), - PCACHE_DIR.getFullPath() + PCACHE_DIR.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_CACHE_DIR, @@ -94,53 +95,53 @@ { DeploymentConfiguration.KEY_USER_LOG_DIR, BasicValueValidators.getFilePathValidator(), - LOG_DIR.getFullPath() + LOG_DIR.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TMP_DIR, BasicValueValidators.getFilePathValidator(), - TMP_DIR.getFullPath() + TMP_DIR.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_LOCKS_DIR, BasicValueValidators.getFilePathValidator(), - LOCKS_DIR.getFullPath() + LOCKS_DIR.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE, BasicValueValidators.getFilePathValidator(), - MAIN_LOCK.getFullPath() + MAIN_LOCK.getDefaultFullPath() }, /* certificates and policy files */ { DeploymentConfiguration.KEY_USER_SECURITY_POLICY, BasicValueValidators.getUrlValidator(), - "file://" + JAVA_POLICY.getFullPath() + "file://" + JAVA_POLICY.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TRUSTED_CA_CERTS, BasicValueValidators.getFilePathValidator(), - USER_CACERTS.getFullPath() + USER_CACERTS.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CA_CERTS, BasicValueValidators.getFilePathValidator(), - USER_JSSECAC.getFullPath() + USER_JSSECAC.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TRUSTED_CERTS, BasicValueValidators.getFilePathValidator(), - USER_CERTS.getFullPath() + USER_CERTS.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CERTS, BasicValueValidators.getFilePathValidator(), - USER_JSSECER.getFullPath() + USER_JSSECER.getDefaultFullPath() }, { DeploymentConfiguration.KEY_USER_TRUSTED_CLIENT_CERTS, BasicValueValidators.getFilePathValidator(), - USER_CLIENTCERT.getFullPath() + USER_CLIENTCERT.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_SECURITY_POLICY, @@ -150,27 +151,27 @@ { DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CA_CERTS, BasicValueValidators.getFilePathValidator(), - SYS_CACERT.getFullPath() + SYS_CACERT.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS, BasicValueValidators.getFilePathValidator(), - SYS_JSSECAC.getFullPath() + SYS_JSSECAC.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CERTS, BasicValueValidators.getFilePathValidator(), - SYS_CERT.getFullPath() + SYS_CERT.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CERTS, BasicValueValidators.getFilePathValidator(), - SYS_JSSECERT.getFullPath() + SYS_JSSECERT.getDefaultFullPath() }, { DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CLIENT_CERTS, BasicValueValidators.getFilePathValidator(), - SYS_CLIENTCERT.getFullPath() + SYS_CLIENTCERT.getDefaultFullPath() }, /* security access and control */ {
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Wed Apr 01 18:39:20 2015 +0200 @@ -16,11 +16,6 @@ package net.sourceforge.jnlp.config; -import static net.sourceforge.jnlp.config.PathsAndFiles.JAVA_DEPLOYMENT_PROP_FILE; -import static net.sourceforge.jnlp.config.PathsAndFiles.USER_CACHE_HOME; -import static net.sourceforge.jnlp.config.PathsAndFiles.USER_CONFIG_HOME; -import static net.sourceforge.jnlp.config.PathsAndFiles.USER_DEPLOYMENT_FILE; -import static net.sourceforge.jnlp.config.PathsAndFiles.USER_SECURITY; import static net.sourceforge.jnlp.runtime.Translator.R; import java.io.BufferedOutputStream; @@ -287,12 +282,12 @@ public void load(boolean fixIssues) throws ConfigurationException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkRead(USER_DEPLOYMENT_FILE.getFullPath()); + sm.checkRead(PathsAndFiles.USER_DEPLOYMENT_FILE.getFullPath()); } File systemConfigFile = findSystemConfigFile(); - load(systemConfigFile, USER_DEPLOYMENT_FILE.getFile(), fixIssues); + load(systemConfigFile, PathsAndFiles.USER_DEPLOYMENT_FILE.getFile(), fixIssues); } void load(File systemConfigFile, File userFile, boolean fixIssues) throws ConfigurationException { @@ -475,7 +470,7 @@ String jrePath = null; try { - Map<String, Setting<String>> tmpProperties = parsePropertiesFile(USER_DEPLOYMENT_FILE.getFile()); + Map<String, Setting<String>> tmpProperties = parsePropertiesFile(PathsAndFiles.USER_DEPLOYMENT_FILE.getFile()); Setting<String> jreSetting = tmpProperties.get(KEY_JRE_DIR); if (jreSetting != null) { jrePath = jreSetting.getValue(); @@ -490,7 +485,7 @@ jreFile = new File(jrePath + File.separator + "lib" + File.separator + DEPLOYMENT_CONFIG_FILE); } else { - jreFile = JAVA_DEPLOYMENT_PROP_FILE.getFile(); + jreFile = PathsAndFiles.JAVA_DEPLOYMENT_PROP_FILE.getFile(); } if (jreFile.isFile()) { return jreFile; @@ -735,24 +730,24 @@ int errors = 0; String PRE_15_DEPLOYMENT_DIR = ".icedtea"; String LEGACY_USER_HOME = System.getProperty("user.home") + File.separator + PRE_15_DEPLOYMENT_DIR; - File configDir = new File(USER_CONFIG_HOME); - File cacheDir = new File(USER_CACHE_HOME); + File configDir = new File(PathsAndFiles.USER_CONFIG_HOME); + File cacheDir = new File(PathsAndFiles.USER_CACHE_HOME); File legacyUserDir = new File(LEGACY_USER_HOME); if (legacyUserDir.exists()) { OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Legacy configuration and cache found. Those will be now transported to new locations"); - OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, USER_CONFIG_HOME + " and " + USER_CACHE_HOME); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, PathsAndFiles.USER_CONFIG_HOME + " and " + PathsAndFiles.USER_CACHE_HOME); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "You should not see this message next time you run icedtea-web!"); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Your custom dirs will not be touched and will work"); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "-----------------------------------------------"); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Preparing new directories:"); - OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, " " + USER_CONFIG_HOME); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, " " + PathsAndFiles.USER_CONFIG_HOME); errors += resultToStd(configDir.mkdirs()); - OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, " " + USER_CACHE_HOME); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, " " + PathsAndFiles.USER_CACHE_HOME); errors += resultToStd(cacheDir.mkdirs()); String legacySecurity = LEGACY_USER_HOME + File.separator + "security"; - String currentSecurity = USER_SECURITY; + String currentSecurity = PathsAndFiles.USER_SECURITY; errors += moveLegacyToCurrent(legacySecurity, currentSecurity); String legacyCache = LEGACY_USER_HOME + File.separator + "cache"; @@ -761,7 +756,7 @@ OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Adapting " + PathsAndFiles.CACHE_INDEX_FILE_NAME + " to new destination"); //replace all legacyCache by currentCache in new recently_used try { - File f = PathsAndFiles.RECENTLY_USED_FILE.getFile(); + File f = PathsAndFiles.getRecentlyUsedFile().getFile(); String s = FileUtils.loadFileAsString(f); s = s.replace(legacyCache, currentCache); FileUtils.saveFile(s, f); @@ -779,11 +774,11 @@ errors += moveLegacyToCurrent(legacyLogDir, currentLogDir); String legacyProperties = LEGACY_USER_HOME + File.separator + DEPLOYMENT_PROPERTIES; - String currentProperties = USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES; + String currentProperties = PathsAndFiles.USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES; errors += moveLegacyToCurrent(legacyProperties, currentProperties); String legacyPropertiesOld = LEGACY_USER_HOME + File.separator + DEPLOYMENT_PROPERTIES + ".old"; - String currentPropertiesOld = USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES + ".old"; + String currentPropertiesOld = PathsAndFiles.USER_CONFIG_HOME + File.separator + DEPLOYMENT_PROPERTIES + ".old"; errors += moveLegacyToCurrent(legacyPropertiesOld, currentPropertiesOld); @@ -801,19 +796,19 @@ if (errors != 0) { OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "There occureed " + errors + " errors"); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Please double check content of old data in " + LEGACY_USER_HOME + " with "); - OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "new " + USER_CONFIG_HOME + " and " + USER_CACHE_HOME); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "new " + PathsAndFiles.USER_CONFIG_HOME + " and " + PathsAndFiles.USER_CACHE_HOME); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "To disable this check again, please remove " + LEGACY_USER_HOME); } } else { OutputController.getLogger().log("System is already following XDG .cache and .config specifications"); try { - OutputController.getLogger().log("config: " + USER_CONFIG_HOME + " file exists: " + configDir.exists()); + OutputController.getLogger().log("config: " + PathsAndFiles.USER_CONFIG_HOME + " file exists: " + configDir.exists()); } catch (Exception ex) { OutputController.getLogger().log(ex); } try { - OutputController.getLogger().log("cache: " + USER_CACHE_HOME + " file exists:" + cacheDir.exists()); + OutputController.getLogger().log("cache: " + PathsAndFiles.USER_CACHE_HOME + " file exists:" + cacheDir.exists()); } catch (Exception ex) { OutputController.getLogger().log(ex); }
--- a/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Wed Apr 01 18:39:20 2015 +0200 @@ -115,10 +115,41 @@ public static final InfrastructureFileDescriptor OPERA_64 = new InfrastructureFileDescriptor(ICEDTEA_SO, "/usr/lib64/opera/plugins/", "", "FILEopera64", Target.PLUGIN); public static final InfrastructureFileDescriptor OPERA_32 = new InfrastructureFileDescriptor(ICEDTEA_SO, "/usr/lib/opera/plugins/", "", "FILEopera32", Target.PLUGIN); - public static final InfrastructureFileDescriptor CACHE_DIR = new ItwCacheFileDescriptor("cache", "FILEcache", Target.JAVAWS, Target.ITWEB_SETTINGS); - public static final InfrastructureFileDescriptor RECENTLY_USED_FILE = new ItwCacheFileDescriptor(CACHE_INDEX_FILE_NAME, CACHE_DIR.getFile().getName(), "FILErecentlyUsed", Target.JAVAWS, Target.ITWEB_SETTINGS); - public static final InfrastructureFileDescriptor PCACHE_DIR = new ItwCacheFileDescriptor("pcache", "FILEappdata", Target.JAVAWS, Target.ITWEB_SETTINGS); - public static final InfrastructureFileDescriptor LOG_DIR = new ItwConfigFileDescriptor("log", "FILElogs", Target.JAVAWS, Target.ITWEB_SETTINGS); + public static final InfrastructureFileDescriptor CACHE_DIR = new ItwCacheFileDescriptor("cache", "FILEcache", Target.JAVAWS, Target.ITWEB_SETTINGS) { + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_CACHE_DIR); + } + + }; + + + // this one is depnding on CACHE_DIR, so initialize it lazily + public static InfrastructureFileDescriptor getRecentlyUsedFile() { + return RECENTLY_USED_FILE_HOLDER.RECENTLY_USED_FILE; + } + + private static class RECENTLY_USED_FILE_HOLDER { + static final InfrastructureFileDescriptor RECENTLY_USED_FILE = new ItwCacheFileDescriptor(CACHE_INDEX_FILE_NAME, CACHE_DIR.getFile().getName(), "FILErecentlyUsed", Target.JAVAWS, Target.ITWEB_SETTINGS); + } + + public static final InfrastructureFileDescriptor PCACHE_DIR = new ItwCacheFileDescriptor("pcache", "FILEappdata", Target.JAVAWS, Target.ITWEB_SETTINGS){ + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR); + } + }; + public static final InfrastructureFileDescriptor LOG_DIR = new ItwConfigFileDescriptor("log", "FILElogs", Target.JAVAWS, Target.ITWEB_SETTINGS){ + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_LOG_DIR); + } + + + }; //javaws is saving here, itweb-settings may modify them public static final InfrastructureFileDescriptor ICONS_DIR = new ItwConfigFileDescriptor("icons", "FILEicons", Target.JAVAWS, Target.ITWEB_SETTINGS); public static final InfrastructureFileDescriptor GEN_JNLPS_DIR = new ItwConfigFileDescriptor("generated_jnlps", "FILEjnlps", Target.PLUGIN, Target.ITWEB_SETTINGS); @@ -127,25 +158,88 @@ public static final InfrastructureFileDescriptor APPLET_TRUST_SETTINGS_USER = new ItwConfigFileDescriptor(APPLET_TRUST_SETTINGS, "FILEextasuser", Target.JAVAWS, Target.ITWEB_SETTINGS); public static final InfrastructureFileDescriptor APPLET_TRUST_SETTINGS_SYS = new SystemDeploymentCofigFileDescriptor(APPLET_TRUST_SETTINGS, "FILEextasadmin", Target.JAVAWS, Target.ITWEB_SETTINGS); public static final InfrastructureFileDescriptor ETC_DEPLOYMENT_CFG = new SystemDeploymentCofigFileDescriptor(DEPLOYMENT_CONFIG_FILE, "FILEglobaldp", Target.JAVAWS, Target.ITWEB_SETTINGS); - public static final InfrastructureFileDescriptor TMP_DIR = new ItwCacheFileDescriptor("tmp", "FILEtmpappdata", Target.JAVAWS, Target.ITWEB_SETTINGS); + public static final InfrastructureFileDescriptor TMP_DIR = new ItwCacheFileDescriptor("tmp", "FILEtmpappdata", Target.JAVAWS, Target.ITWEB_SETTINGS){ + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TMP_DIR); + } + + }; + public static final InfrastructureFileDescriptor LOCKS_DIR = new TmpUsrFileDescriptor("locks", "netx", "FILElocksdir", Target.JAVAWS) { + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_LOCKS_DIR); + } + + }; + public static final InfrastructureFileDescriptor MAIN_LOCK = new TmpUsrFileDescriptor("netx_running", "netx" + File.separator + "locks", "FILEmainlock", Target.JAVAWS) { - public static final InfrastructureFileDescriptor LOCKS_DIR = new TmpUsrFileDescriptor("locks", "netx", "FILElocksdir", Target.JAVAWS); - public static final InfrastructureFileDescriptor MAIN_LOCK = new TmpUsrFileDescriptor("netx_running", "netx" + File.separator + "locks", "FILEmainlock", Target.JAVAWS); + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE); + } + + }; + public static final InfrastructureFileDescriptor JAVA_POLICY = new UserSecurityConfigFileDescriptor("java.policy", "FILEpolicy", Target.JAVAWS, Target.POLICY_EDITOR){ - public static final InfrastructureFileDescriptor JAVA_POLICY = new UserSecurityConfigFileDescriptor("java.policy", "FILEpolicy", Target.JAVAWS, Target.POLICY_EDITOR); + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_SECURITY_POLICY); + } + + @Override + public File getFile() { + throw new IllegalStateException("Only getFullPath should be used. This is returning URL String."); + } + + @Override + public File getDefaultFile() { + throw new IllegalStateException("Only getDefaultFullPath should be used. This is returning URL String."); + } + + }; public static final InfrastructureFileDescriptor USER_CACERTS = new UserCacertsFileDescriptor("trusted.cacerts"); public static final InfrastructureFileDescriptor USER_JSSECAC = new UserCacertsFileDescriptor("trusted.jssecacerts"); public static final InfrastructureFileDescriptor USER_CERTS = new UserCacertsFileDescriptor("trusted.certs"); public static final InfrastructureFileDescriptor USER_JSSECER = new UserCacertsFileDescriptor("trusted.jssecerts"); public static final InfrastructureFileDescriptor USER_CLIENTCERT = new UserCacertsFileDescriptor("trusted.clientcerts"); - public static final InfrastructureFileDescriptor SYS_CACERT = new SystemJavaSecurityFileDescriptor("cacerts"); - public static final InfrastructureFileDescriptor SYS_JSSECAC = new SystemJavaSecurityFileDescriptor("jssecacerts"); + public static final InfrastructureFileDescriptor SYS_CACERT = new SystemJavaSecurityFileDescriptor("cacerts") { + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CA_CERTS); + } + + }; + public static final InfrastructureFileDescriptor SYS_JSSECAC = new SystemJavaSecurityFileDescriptor("jssecacerts") { + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS); + } + + }; public static final InfrastructureFileDescriptor SYS_CERT = new SystemJavaSecurityFileDescriptor("trusted.certs"); - public static final InfrastructureFileDescriptor SYS_JSSECERT = new SystemJavaSecurityFileDescriptor("trusted.jssecerts"); - public static final InfrastructureFileDescriptor SYS_CLIENTCERT = new SystemJavaSecurityFileDescriptor("trusted.clientcerts"); + public static final InfrastructureFileDescriptor SYS_JSSECERT = new SystemJavaSecurityFileDescriptor("trusted.jssecerts") { - public static final InfrastructureFileDescriptor JAVA_DEPLOYMENT_PROP_FILE = new SystemJavaLibFileDescriptor(DEPLOYMENT_CONFIG_FILE, "FILEjavadp", Target.JAVAWS, Target.ITWEB_SETTINGS){ + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CERTS); + } + + }; + public static final InfrastructureFileDescriptor SYS_CLIENTCERT = new SystemJavaSecurityFileDescriptor("trusted.clientcerts") { + + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CLIENT_CERTS); + } + + }; + public static final InfrastructureFileDescriptor JAVA_DEPLOYMENT_PROP_FILE = new SystemJavaLibFileDescriptor(DEPLOYMENT_CONFIG_FILE, "FILEjavadp", Target.JAVAWS, Target.ITWEB_SETTINGS) { @Override public String getDescription() { @@ -183,7 +277,7 @@ } } - + r.add(getRecentlyUsedFile()); return r; } @@ -218,36 +312,74 @@ this.descriptionKey = descriptionKey; this.target = target; } - public File getFile() { - return new File(getFullPath()); - } - - public String getStub() { - return clean(pathStub + File.separator + fileName); + return new File(getFullPath()); } public String getDir() { + return getFile().getParent(); + } + + //setupable files may override this (and maybe also getDir if needed) + public String getFullPath() { + return getDefaultFullPath(); + } + //its not recommended to override default locations methods + + public File getDefaultFile() { + return new File(getDefaultFullPath()); + } + + public String getDefaultDir() { return clean(systemPathStub + File.separator + pathStub); } - public String getFullPath() { + public String getDefaultFullPath() { return clean(systemPathStub + File.separator + pathStub + File.separator + fileName); } - public String getSystemPathStubAcronym() { + //returns path acronym for default location + protected String getSystemPathStubAcronym() { return systemPathStub; } + /** + * This remaining part of file declaration, when acronym is removed. + * See getDirViaAcronym. + * + * @return + */ + private String getStub() { + return clean(pathStub + File.separator + fileName); + } + @Override public String toString() { return clean(getSystemPathStubAcronym() + File.separator + getStub()); } + /** + * For documentation purposes, the descriptor may be created as VARIABLE/custom/path. + * + * This is whole part, which is considered as setup-able. + * @return + */ public String getDirViaAcronym() { return clean(getSystemPathStubAcronym() + File.separator + pathStub); } + /** + * Remove garbage from paths. + * + * Currently this methods unify all multiple occurrences of separators + * to single one. Eg /path/to//file will become /path/to/file. + * + * Those artifacts maybe spread during various s=path+deparator+subdir+separator + * file=s+separator+filename + * + * @param s string to be cleaned + * @return cleaned string + */ private String clean(String s) { while (s.contains(File.separator + File.separator)) { s = s.replace(File.separator + File.separator, File.separator); @@ -440,5 +572,9 @@ } }; + + private static String gcpd(String key) { + return JNLPRuntime.getConfiguration().getProperty(key); + } }
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 01 18:39:20 2015 +0200 @@ -323,7 +323,7 @@ } private void updateRecentlyUsed(File f) { - File recentlyUsedFile = PathsAndFiles.RECENTLY_USED_FILE.getFile(); + File recentlyUsedFile = PathsAndFiles.getRecentlyUsedFile().getFile(); PropertiesFile pf = new PropertiesFile(recentlyUsedFile); pf.load(); Enumeration<Object> en = pf.keys();
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Apr 01 18:39:20 2015 +0200 @@ -25,6 +25,8 @@ ButHideDetails=Hide Details ButYes=Yes ButNo=No +BUTControlledBy=Controlled by {0} +BUTmodified=modified CertWarnRunTip=Trust this applet and run with full permissions CertWarnSandboxTip=Do not trust this applet and run with restricted permissions
--- a/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Wed Apr 01 18:09:27 2015 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Wed Apr 01 18:39:20 2015 +0200 @@ -54,6 +54,7 @@ import net.sourceforge.jnlp.OptionsDefinitions; import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.config.Setting; +import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.docprovider.formatters.formatters.Formatter; import net.sourceforge.jnlp.util.docprovider.formatters.formatters.HtmlFormatter; import net.sourceforge.jnlp.util.docprovider.formatters.formatters.ManFormatter; @@ -172,14 +173,19 @@ }); for (PathsAndFiles.InfrastructureFileDescriptor f : files) { String path = expandVariables ? f.getFullPath() : f.toString(); + String modified = ""; + if (!f.getFullPath().equals(f.getDefaultFullPath()) && expandVariables){ + modified=getFormatter().getBold("["+Translator.R("BUTmodified")+"] "); + } String controlledBy = ""; for (Map.Entry<String, Setting<String>> entry : defs) { if (matchSttingsValueWithInfrastrucutreFile(entry.getValue(), f)) { - controlledBy = " Controlled by " + getFormatter().getBold(entry.getKey()); + controlledBy = " " + Translator.R("BUTControlledBy", getFormatter().getBold(entry.getKey())); + break; } } - sb.append(getFormatter().getOption(path, f.getDescription() + controlledBy)); + sb.append(getFormatter().getOption(path, modified+f.getDescription() + controlledBy)); } return formatter.wrapParagraph(sb.toString()); } @@ -188,7 +194,7 @@ if (entry == null || entry.getDefaultValue() == null) { return false; } - return entry.getDefaultValue().equals(f.getFullPath()) || entry.getDefaultValue().equals("file://" + f.getFullPath()); + return entry.getDefaultValue().equals(f.getDefaultFullPath()) || entry.getDefaultValue().equals("file://" + f.getDefaultFullPath()); }
--- a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Wed Apr 01 18:09:27 2015 +0200 +++ b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Wed Apr 01 18:39:20 2015 +0200 @@ -72,7 +72,7 @@ private static final int PERMANENT_FILES = 1; private static final File icedteaCache = PathsAndFiles.CACHE_DIR.getFile(); - private static final File icedteaCacheFile = PathsAndFiles.RECENTLY_USED_FILE.getFile(); + private static final File icedteaCacheFile = PathsAndFiles.getRECENTLY_USED_FILE().getFile(); private static final File netxLock = PathsAndFiles.MAIN_LOCK.getFile(); String testS = "#netx file\n"