Mercurial > hg > release > icedtea-web-1.6
changeset 1192:1dc3e6bdf364
All reading from file properties repalced by getter from PathsAndFiles
line wrap: on
line diff
--- a/ChangeLog Thu Apr 02 20:09:00 2015 +0200 +++ b/ChangeLog Thu Apr 02 20:48:51 2015 +0200 @@ -1,3 +1,51 @@ +2015-04-02 Jiri Vanek <jvanek@redhat.com> + + All reading from file properties repalced by getter from PathsAndFiles + *netx/net/sourceforge/jnlp/cache/CacheUtil.java: read from KEY_USER_NETX_RUNNING_FILE + property replaced by get from MAIN_LOCK. + *netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: similarly for + KEY_USER_PERSISTENCE_CACHE_DIR -> PCACHE_DIR and KEY_USER_LOG_DIR -> LOG_DIR + and KEY_USER_TMP_DIR -> TMP_DIR + *netx/net/sourceforge/jnlp/config/PathsAndFiles.java: added overrides of getFullPath + to RECENTLY_USED_FILE, SYS_CER and all USER keystores. All fields in InfrastructureFileDescriptor + made private final, and reasonable ones got protected setters. + *netx/net/sourceforge/jnlp/controlpanel/CachePane.java: KEY_USER_CACHE_DIR -> + CACHE_DIR, KEY_USER_NETX_RUNNING_FILE -> MAIN_LOCK. Config param removed. + *netx/net/sourceforge/jnlp/controlpanel/CacheViewer.java: adapted to + configless constructor + *netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: same + *netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java: same + *netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java: KEY_USER_LOG_DIR + -> LOG_DIR, config made final. + *netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java: + removed redundant boxing, KEY_USER_CACHE_DIR -> CACHE_DIR + *netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java: KEY_USER_SECURITY_POLICY + -> JAVA_POLICY. getPolicyFromConfig splited into getPolicyFromConfig and + getPolicyFromUrl + *netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: read from KEY_USER_NETX_RUNNING_FILE + property replaced by get from MAIN_LOCK. + *netx/net/sourceforge/jnlp/security/KeyStores.java: removed config field and its filling. + (getKeyStoreLocation) all keystores properties replaced by correct PahtsAndFiles. + *netx/net/sourceforge/jnlp/security/SecurityUtil.java: adapted to getKeyStoreLocation + changed return type + *netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java: same + *netx/net/sourceforge/jnlp/security/dialogs/TemporaryPermissionsButton.java: same + *netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java: same + *netx/net/sourceforge/jnlp/services/SingleInstanceLock.java: KEY_USER_LOCKS_DIR + -> LOCKS_DIR + *netx/net/sourceforge/jnlp/services/XPersistenceService.java: + KEY_USER_PERSISTENCE_CACHE_DIR -> PCACHE_DIR + *netx/net/sourceforge/jnlp/util/XDesktopEntry.java: KEY_USER_TMP_DIR -> TMP_DIR + *netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: adapted + to existence of file protocol by new method removeFileProtocol + *netx/net/sourceforge/jnlp/util/logging/LogConfig.java: KEY_USER_LOG_DIR -> LOG_DIR + *tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java: KEY_USER_CACHE_DIR -> + CACHE_DIR + *tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java: same + *tests/netx/unit/net/sourceforge/jnlp/cache/ResourceTrackerTest.java: same + *tests/netx/unit/net/sourceforge/jnlp/security/KeyStoresTest.java: adapted to + getKeyStoreLocation + 2015-04-02 Jiri Vanek <jvanek@redhat.com> * tests/netx/unit/net/sourceforge/jnlp/security/KeyStoresTest.java: new file,
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java Thu Apr 02 20:48:51 2015 +0200 @@ -40,6 +40,7 @@ import net.sourceforge.jnlp.Version; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.ApplicationInstance; import net.sourceforge.jnlp.runtime.JNLPRuntime; import static net.sourceforge.jnlp.runtime.Translator.R; @@ -170,7 +171,7 @@ * @return true if the cache can be cleared at this time without problems */ private static boolean okToClearCache() { - File otherJavawsRunning = new File(JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE)); + File otherJavawsRunning = PathsAndFiles.MAIN_LOCK.getFile(); FileLock locking = null; try { if (otherJavawsRunning.isFile()) {
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Thu Apr 02 20:48:51 2015 +0200 @@ -766,11 +766,11 @@ } String legacyPcahceDir = LEGACY_USER_HOME + File.separator + "pcache"; - String currentPcacheDir = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR).getDefaultValue(); + String currentPcacheDir = PathsAndFiles.PCACHE_DIR.getDefaultFullPath(); errors += moveLegacyToCurrent(legacyPcahceDir, currentPcacheDir); String legacyLogDir = LEGACY_USER_HOME + File.separator + "log"; - String currentLogDir = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_LOG_DIR).getDefaultValue(); + String currentLogDir = PathsAndFiles.LOG_DIR.getDefaultFullPath(); errors += moveLegacyToCurrent(legacyLogDir, currentLogDir); String legacyProperties = LEGACY_USER_HOME + File.separator + DEPLOYMENT_PROPERTIES; @@ -787,7 +787,7 @@ errors += moveLegacyToCurrent(legacyAppletTrust, currentAppletTrust); String legacyTmp = LEGACY_USER_HOME + File.separator + "tmp"; - String currentTmp = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_TMP_DIR).getDefaultValue(); + String currentTmp = PathsAndFiles.TMP_DIR.getDefaultFullPath(); errors += moveLegacyToCurrent(legacyTmp, currentTmp); OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Removing now empty " + LEGACY_USER_HOME);
--- a/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Thu Apr 02 20:48:51 2015 +0200 @@ -131,7 +131,14 @@ } 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); + static final InfrastructureFileDescriptor RECENTLY_USED_FILE = new ItwCacheFileDescriptor(CACHE_INDEX_FILE_NAME, CACHE_DIR.getFile().getName(), "FILErecentlyUsed", Target.JAVAWS, Target.ITWEB_SETTINGS){ + + @Override + public String getFullPath() { + return clean(CACHE_DIR.getFullPath()+File.separator+this.getFileName()); + } + + }; } public static final InfrastructureFileDescriptor PCACHE_DIR = new ItwCacheFileDescriptor("pcache", "FILEappdata", Target.JAVAWS, Target.ITWEB_SETTINGS){ @@ -200,12 +207,41 @@ } }; - 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 USER_CACERTS = new UserCacertsFileDescriptor("trusted.cacerts") { + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TRUSTED_CA_CERTS); + } + + }; + public static final InfrastructureFileDescriptor USER_JSSECAC = new UserCacertsFileDescriptor("trusted.jssecacerts") { + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CA_CERTS); + } + }; + public static final InfrastructureFileDescriptor USER_CERTS = new UserCacertsFileDescriptor("trusted.certs") { + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TRUSTED_CERTS); + } + + }; + public static final InfrastructureFileDescriptor USER_JSSECER = new UserCacertsFileDescriptor("trusted.jssecerts") { + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CERTS); + } + + }; + public static final InfrastructureFileDescriptor USER_CLIENTCERT = new UserCacertsFileDescriptor("trusted.clientcerts") { + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_USER_TRUSTED_CLIENT_CERTS); + } + + }; public static final InfrastructureFileDescriptor SYS_CACERT = new SystemJavaSecurityFileDescriptor("cacerts") { @Override @@ -222,7 +258,12 @@ } }; - public static final InfrastructureFileDescriptor SYS_CERT = new SystemJavaSecurityFileDescriptor("trusted.certs"); + public static final InfrastructureFileDescriptor SYS_CERT = new SystemJavaSecurityFileDescriptor("trusted.certs"){ + @Override + public String getFullPath() { + return gcpd(DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CERTS); + } + }; public static final InfrastructureFileDescriptor SYS_JSSECERT = new SystemJavaSecurityFileDescriptor("trusted.jssecerts") { @Override @@ -243,7 +284,7 @@ @Override public String getDescription() { - return Translator.R(descriptionKey, DeploymentConfiguration.KEY_JRE_DIR); + return Translator.R(getDescriptionKey(), DeploymentConfiguration.KEY_JRE_DIR); } }; @@ -299,10 +340,10 @@ public static class InfrastructureFileDescriptor { - public final String fileName; - public final String pathStub; - public final String systemPathStub; - protected final String descriptionKey; + private final String fileName; + private final String pathStub; + private final String systemPathStub; + private final String descriptionKey; private final Target[] target; private InfrastructureFileDescriptor(String fileName, String pathStub, String systemPathStub, String descriptionKey, Target... target) { @@ -343,6 +384,16 @@ return systemPathStub; } + protected String getFileName() { + return fileName; + } + + protected String getDescriptionKey() { + return descriptionKey; + } + + + /** * This remaining part of file declaration, when acronym is removed. * See getDirViaAcronym. @@ -380,7 +431,7 @@ * @param s string to be cleaned * @return cleaned string */ - private String clean(String s) { + protected String clean(String s) { while (s.contains(File.separator + File.separator)) { s = s.replace(File.separator + File.separator, File.separator);
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Thu Apr 02 20:48:51 2015 +0200 @@ -60,7 +60,6 @@ import net.sourceforge.jnlp.cache.CacheDirectory; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.DirectoryNode; -import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; @@ -70,7 +69,6 @@ public class CachePane extends JPanel { JDialog parent; - DeploymentConfiguration config; private final String location; private JComponent defaultFocusComponent; DirectoryNode root; @@ -88,13 +86,11 @@ * Creates a new instance of the CachePane. * * @param parent The parent dialog that uses this pane. - * @param config The DeploymentConfiguration file. */ - public CachePane(JDialog parent, DeploymentConfiguration config) { + public CachePane(JDialog parent) { super(new BorderLayout()); this.parent = parent; - this.config = config; - location = config.getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR); + location = PathsAndFiles.CACHE_DIR.getFullPath(); addComponents(); } @@ -272,7 +268,7 @@ public void run() { try { FileLock fl = null; - File netxRunningFile = new File(config.getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE)); + File netxRunningFile = PathsAndFiles.MAIN_LOCK.getFile(); if (!netxRunningFile.exists()) { try { FileUtils.createParentDir(netxRunningFile);
--- a/netx/net/sourceforge/jnlp/controlpanel/CacheViewer.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/CacheViewer.java Thu Apr 02 20:48:51 2015 +0200 @@ -72,7 +72,7 @@ c.weighty = 1; c.gridx = 0; c.gridy = 0; - topPanel = new CachePane(this, this.config); + topPanel = new CachePane(this); contentPane.add(topPanel, c); pack();
--- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Thu Apr 02 20:48:51 2015 +0200 @@ -360,7 +360,7 @@ } private JPanel createPolicySettingsPanel() { - return new PolicyPanel(this, this.config); + return new PolicyPanel(this); } private JPanel createJVMSettingsPanel() { @@ -429,7 +429,6 @@ // ignore; not a big deal } - KeyStores.setConfiguration(config); SwingUtilities.invokeLater(new Runnable() { @Override
--- a/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Thu Apr 02 20:48:51 2015 +0200 @@ -38,8 +38,8 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import net.sourceforge.jnlp.config.Defaults; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.logging.LogConfig; @@ -61,7 +61,7 @@ }; - private DeploymentConfiguration config; + private final DeploymentConfiguration config; /** * Create a new instance of the debugging panel. @@ -86,7 +86,7 @@ final JLabel debuggingDescription = new JLabel("<html>" + Translator.R("CPDebuggingDescription") + "<hr /><br /></html>"); final JLabel logsDestinationTitle = new JLabel(Translator.R("CPFilesLogsDestDir")+": "); - final JTextField logsDestination = new JTextField(config.getProperty(DeploymentConfiguration.KEY_USER_LOG_DIR)); + final JTextField logsDestination = new JTextField(PathsAndFiles.LOG_DIR.getFullPath()); logsDestination.getDocument().addDocumentListener(new DocumentListener() { @@ -115,7 +115,7 @@ @Override public void actionPerformed(ActionEvent e) { - logsDestination.setText(Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_LOG_DIR).getDefaultValue()); + logsDestination.setText(PathsAndFiles.LOG_DIR.getDefaultFullPath()); } });
--- a/netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java Thu Apr 02 20:48:51 2015 +0200 @@ -57,7 +57,7 @@ import javax.swing.JTextField; import javax.swing.SwingUtilities; -import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.security.policyeditor.PolicyEditor; import net.sourceforge.jnlp.security.policyeditor.PolicyEditor.PolicyEditorWindow; import net.sourceforge.jnlp.util.FileUtils; @@ -74,15 +74,15 @@ private PolicyEditorWindow policyEditor = null; - public PolicyPanel(final JFrame frame, final DeploymentConfiguration config) { + public PolicyPanel(final JFrame frame) { super(R("CPHeadPolicy"), new GridBagLayout()); - addComponents(frame, config); + addComponents(frame); } - private void addComponents(final JFrame frame, final DeploymentConfiguration config) { + private void addComponents(final JFrame frame) { JLabel aboutLabel = new JLabel("<html>" + R("CPPolicyDetail") + "</html>"); - final String fileUrlString = config.getProperty(DeploymentConfiguration.KEY_USER_SECURITY_POLICY); + final String fileUrlString = PathsAndFiles.JAVA_POLICY.getFullPath(); final JButton simpleEditorButton = new JButton(R("CPButSimpleEditor")); simpleEditorButton.addActionListener(new LaunchSimplePolicyEditorAction(frame, fileUrlString));
--- a/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java Thu Apr 02 20:48:51 2015 +0200 @@ -48,6 +48,7 @@ import javax.swing.event.ChangeListener; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.Translator; /** @@ -62,10 +63,10 @@ @SuppressWarnings("serial") public class TemporaryInternetFilesPanel extends NamedBorderPanel { - private static final Long CACHE_UNLIMITED_SIZE = Long.valueOf(-1l); - private static final Long CACHE_MIN_SIZE = Long.valueOf(0l); + private static final Long CACHE_UNLIMITED_SIZE = -1l; + private static final Long CACHE_MIN_SIZE = 0l; private static final Long CACHE_MAX_SIZE = (long) Integer.MAX_VALUE; - private static final Long SPINNER_STEP_SIZE = Long.valueOf(10l); + private static final Long SPINNER_STEP_SIZE = 10l; private final JSpinner cacheSizeSpinner; private static final long BYTES_TO_MEGABYTES = 1024l * 1024l; @@ -107,14 +108,14 @@ lCompression = new JLabel(Translator.R("TIFPCompressionLevel") + ":"); // Sets compression level for jar files. bLocation = new JButton(Translator.R("TIFPChange") + "..."); - location = new JTextField(this.config.getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR)); + location = new JTextField(PathsAndFiles.CACHE_DIR.getFullPath()); locationDescription = new JLabel(Translator.R("TIFPLocationLabel") + ":"); bViewFiles = new JButton(Translator.R("TIFPViewFiles")); diskSpacePanel = new JPanel(); diskSpacePanel.setLayout(new GridBagLayout()); - cacheDir = new File(this.config.getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR)); + cacheDir = PathsAndFiles.CACHE_DIR.getFile(); usableDiskSpace = cacheDir.getUsableSpace() / BYTES_TO_MEGABYTES; // getUsableSpace returns bytes addComponents();
--- a/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java Thu Apr 02 20:48:51 2015 +0200 @@ -23,6 +23,7 @@ import java.util.Enumeration; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.util.logging.OutputController; /** @@ -60,7 +61,7 @@ systemPolicy = Policy.getPolicy(); systemJnlpPolicy = getPolicyFromConfig(DeploymentConfiguration.KEY_SYSTEM_SECURITY_POLICY); - userJnlpPolicy = getPolicyFromConfig(DeploymentConfiguration.KEY_USER_SECURITY_POLICY); + userJnlpPolicy = getPolicyFromUrl(PathsAndFiles.JAVA_POLICY.getFullPath()); String jre = System.getProperty("java.home"); jreExtDir = jre + File.separator + "lib" + File.separator + "ext"; @@ -170,19 +171,23 @@ * @return a policy based on the configuration set by the user */ private Policy getPolicyFromConfig(String key) { + DeploymentConfiguration config = JNLPRuntime.getConfiguration(); + String policyLocation = config.getProperty(key); + return getPolicyFromUrl(policyLocation); + } + + /** + * Constructs a delegate policy based on a config setting + * @param key a KEY_* in DeploymentConfiguration + * @return a policy based on the configuration set by the user + */ + private Policy getPolicyFromUrl(String policyLocation) { Policy policy = null; - String policyLocation = null; - DeploymentConfiguration config = JNLPRuntime.getConfiguration(); - policyLocation = config.getProperty(key); if (policyLocation != null) { try { URI policyUri = new URI(policyLocation); policy = getInstance("JavaPolicy", new URIParameter(policyUri)); - } catch (IllegalArgumentException e) { - OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); - } catch (NoSuchAlgorithmException e) { - OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); - } catch (URISyntaxException e) { + } catch (IllegalArgumentException | NoSuchAlgorithmException | URISyntaxException e) { OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } }
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Thu Apr 02 20:48:51 2015 +0200 @@ -61,6 +61,7 @@ import net.sourceforge.jnlp.cache.DownloadIndicator; import net.sourceforge.jnlp.cache.UpdatePolicy; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.security.JNLPAuthenticator; import net.sourceforge.jnlp.security.KeyStores; import net.sourceforge.jnlp.security.SecurityDialogMessageHandler; @@ -226,7 +227,6 @@ } OutputController.getLogger().log(OutputController.Level.WARNING_ALL, R("RConfigurationError")+": "+getConfiguration().getLoadingException().getMessage()); } - KeyStores.setConfiguration(getConfiguration()); isWebstartApplication = isApplication; @@ -762,8 +762,7 @@ try { String message = "This file is used to check if netx is running"; - File netxRunningFile = new File(JNLPRuntime.getConfiguration() - .getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE)); + File netxRunningFile = PathsAndFiles.MAIN_LOCK.getFile(); if (!netxRunningFile.exists()) { FileUtils.createParentDir(netxRunningFile); FileUtils.createRestrictedFile(netxRunningFile, true); @@ -815,8 +814,7 @@ fileLock.release(); fileLock.channel().close(); fileLock = null; - OutputController.getLogger().log("Release shared lock on " + JNLPRuntime.getConfiguration() - .getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE)); + OutputController.getLogger().log("Release shared lock on " + PathsAndFiles.MAIN_LOCK.getFullPath()); } catch (IOException e) { OutputController.getLogger().log(e); }
--- a/netx/net/sourceforge/jnlp/security/KeyStores.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/security/KeyStores.java Thu Apr 02 20:48:51 2015 +0200 @@ -52,7 +52,7 @@ import java.util.Map; import java.util.StringTokenizer; -import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.logging.OutputController; @@ -80,8 +80,6 @@ public static final Map<Integer,String> keystoresPaths=new HashMap<Integer, String>(); - private static DeploymentConfiguration config = null; - private static final String KEYSTORE_TYPE = "JKS"; /** the default password used to protect the KeyStores */ private static final String DEFAULT_PASSWORD = "changeit"; @@ -89,17 +87,7 @@ public static char[] getPassword() { return DEFAULT_PASSWORD.toCharArray(); } - - /** Set the configuration object to use for getting KeyStore paths */ - public static void setConfiguration(DeploymentConfiguration newConfig) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new AllPermission()); - } - - config = newConfig; - } - + /** * Returns a KeyStore corresponding to the appropriate level level (user or * system) and type. @@ -134,7 +122,7 @@ sm.checkPermission(new AllPermission()); } - String location = getKeyStoreLocation(level, type); + String location = getKeyStoreLocation(level, type).getFullPath(); KeyStore ks = null; try { ks = createKeyStoreFromFile(new File(location), create, DEFAULT_PASSWORD); @@ -252,54 +240,40 @@ * @param type the specified type of the key store to be returned. * @return the location of the key store. */ - public static final String getKeyStoreLocation(Level level, Type type) { - String configKey = null; + public static final PathsAndFiles.InfrastructureFileDescriptor getKeyStoreLocation(Level level, Type type) { switch (level) { case SYSTEM: switch (type) { case JSSE_CA_CERTS: - configKey = DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS; - break; + return PathsAndFiles.SYS_JSSECAC; case CA_CERTS: - configKey = DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CA_CERTS; - break; + return PathsAndFiles.SYS_CACERT; case JSSE_CERTS: - configKey = DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CERTS; - break; + return PathsAndFiles.SYS_JSSECERT; case CERTS: - configKey = DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CERTS; - break; + return PathsAndFiles.SYS_CERT; case CLIENT_CERTS: - configKey = DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CLIENT_CERTS; - break; + return PathsAndFiles.SYS_CLIENTCERT; } break; case USER: switch (type) { case JSSE_CA_CERTS: - configKey = DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CA_CERTS; - break; + return PathsAndFiles.USER_JSSECAC; case CA_CERTS: - configKey = DeploymentConfiguration.KEY_USER_TRUSTED_CA_CERTS; - break; + return PathsAndFiles.USER_CACERTS; case JSSE_CERTS: - configKey = DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CERTS; - break; + return PathsAndFiles.USER_JSSECER; case CERTS: - configKey = DeploymentConfiguration.KEY_USER_TRUSTED_CERTS; - break; + return PathsAndFiles.USER_CERTS; case CLIENT_CERTS: - configKey = DeploymentConfiguration.KEY_USER_TRUSTED_CLIENT_CERTS; - break; + return PathsAndFiles.USER_CLIENTCERT; } break; } - if (configKey == null) { - throw new RuntimeException("Unspported"); - } + throw new RuntimeException("Unspported"); - return config.getProperty(configKey); } /**
--- a/netx/net/sourceforge/jnlp/security/SecurityUtil.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java Thu Apr 02 20:48:51 2015 +0200 @@ -51,7 +51,7 @@ private static final char[] password = "changeit".toCharArray(); public static String getTrustedCertsFilename() throws Exception { - return KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS); + return KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS).getFullPath(); } public static char[] getTrustedCertsPassword() {
--- a/netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java Thu Apr 02 20:48:51 2015 +0200 @@ -353,7 +353,7 @@ KeyStore ks = KeyStores.getKeyStore(Level.USER, Type.CERTS); X509Certificate c = (X509Certificate) parent.getCertVerifier().getPublisher(null); CertificateUtils.addToKeyStore(c, ks); - File keyStoreFile = new File(KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS)); + File keyStoreFile = KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS).getFile(); if (!keyStoreFile.isFile()) { FileUtils.createRestrictedFile(keyStoreFile, true); }
--- a/netx/net/sourceforge/jnlp/security/dialogs/TemporaryPermissionsButton.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/security/dialogs/TemporaryPermissionsButton.java Thu Apr 02 20:48:51 2015 +0200 @@ -57,9 +57,8 @@ import javax.swing.JPopupMenu; import net.sourceforge.jnlp.JNLPFile; -import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPClassLoader.SecurityDelegate; -import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.policyeditor.PolicyEditor; import net.sourceforge.jnlp.security.policyeditor.PolicyEditor.PolicyEditorWindow; import net.sourceforge.jnlp.security.policyeditor.PolicyEditorPermissions; @@ -160,7 +159,7 @@ private class PolicyEditorLaunchListener implements ActionListener { @Override public void actionPerformed(final ActionEvent e) { - final String rawFilepath = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_SECURITY_POLICY); + final String rawFilepath = PathsAndFiles.JAVA_POLICY.getFullPath(); String filepath; try { filepath = new URL(rawFilepath).getPath();
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Thu Apr 02 20:48:51 2015 +0200 @@ -394,8 +394,7 @@ } else { CertificateUtils.addToKeyStore(chooser.getSelectedFile(), ks); } - File keyStoreFile = new File(KeyStores - .getKeyStoreLocation(currentKeyStoreLevel, currentKeyStoreType)); + File keyStoreFile = KeyStores.getKeyStoreLocation(currentKeyStoreLevel, currentKeyStoreType).getFile(); if (!keyStoreFile.isFile()) { FileUtils.createRestrictedFile(keyStoreFile, true); } @@ -485,8 +484,7 @@ JOptionPane.YES_NO_OPTION); if (i == 0) { keyStore.deleteEntry(alias); - File keyStoreFile = new File(KeyStores - .getKeyStoreLocation(currentKeyStoreLevel, currentKeyStoreType)); + File keyStoreFile = KeyStores.getKeyStoreLocation(currentKeyStoreLevel, currentKeyStoreType).getFile(); if (!keyStoreFile.isFile()) { FileUtils.createRestrictedFile(keyStoreFile, true); }
--- a/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Thu Apr 02 20:48:51 2015 +0200 @@ -28,8 +28,7 @@ import java.net.ServerSocket; import net.sourceforge.jnlp.JNLPFile; -import net.sourceforge.jnlp.config.DeploymentConfiguration; -import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.util.FileUtils; /** @@ -130,8 +129,7 @@ * may or may not exist. */ private File getLockFile() { - File baseDir = new File(JNLPRuntime.getConfiguration() - .getProperty(DeploymentConfiguration.KEY_USER_LOCKS_DIR)); + File baseDir = PathsAndFiles.LOCKS_DIR.getFile(); if (!baseDir.isDirectory()) { if (!baseDir.getParentFile().isDirectory() && !baseDir.getParentFile().mkdirs()) {
--- a/netx/net/sourceforge/jnlp/services/XPersistenceService.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/services/XPersistenceService.java Thu Apr 02 20:48:51 2015 +0200 @@ -22,7 +22,7 @@ import javax.jnlp.*; import net.sourceforge.jnlp.cache.*; -import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.*; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.logging.OutputController; @@ -83,8 +83,7 @@ * @return the file */ protected File toCacheFile(URL location) throws MalformedURLException { - String pcache = JNLPRuntime.getConfiguration() - .getProperty(DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR); + String pcache = PathsAndFiles.PCACHE_DIR.getFullPath(); return CacheUtil.urlToPath(location, pcache); }
--- a/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Thu Apr 02 20:48:51 2015 +0200 @@ -44,7 +44,6 @@ import net.sourceforge.jnlp.StreamEater; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.UpdatePolicy; -import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.dialogs.AccessWarningPaneComplexReturn; @@ -262,7 +261,7 @@ } public File getShortcutTmpFile() { - String userTmp = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_TMP_DIR); + String userTmp = PathsAndFiles.TMP_DIR.getFullPath(); File shortcutFile = new File(userTmp + File.separator + FileUtils.sanitizeFileName(file.getTitle()) + ".desktop"); return shortcutFile; }
--- a/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Thu Apr 02 20:48:51 2015 +0200 @@ -174,7 +174,9 @@ for (PathsAndFiles.InfrastructureFileDescriptor f : files) { String path = expandVariables ? f.getFullPath() : f.toString(); String modified = ""; - if (!f.getFullPath().equals(f.getDefaultFullPath()) && expandVariables){ + String fGetFullPath=removeFileProtocol(f.getFullPath()); + String fGetDefaultFullPath=removeFileProtocol(f.getDefaultFullPath()); + if (!fGetFullPath.equals(fGetDefaultFullPath) && expandVariables){ modified=getFormatter().getBold("["+Translator.R("BUTmodified")+"] "); } String controlledBy = ""; @@ -681,4 +683,14 @@ this.seeAlso = seeAlso; } + private String removeFileProtocol(String s) { + if (s == null){ + return s; + } + if (s.startsWith("file://")){ + s = s.substring(7); + } + return s; + } + }
--- a/netx/net/sourceforge/jnlp/util/logging/LogConfig.java Thu Apr 02 20:09:00 2015 +0200 +++ b/netx/net/sourceforge/jnlp/util/logging/LogConfig.java Thu Apr 02 20:48:51 2015 +0200 @@ -38,6 +38,7 @@ import java.io.File; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPRuntime; /** @@ -66,7 +67,7 @@ logToSysLog = Boolean.parseBoolean(config.getProperty(DeploymentConfiguration.KEY_ENABLE_LOGGING_TOSYSTEMLOG)); // Get log directory, create it if it doesn't exist. If unable to create and doesn't exist, don't log. - icedteaLogDir = config.getProperty(DeploymentConfiguration.KEY_USER_LOG_DIR); + icedteaLogDir = PathsAndFiles.LOG_DIR.getFullPath(); if (icedteaLogDir != null) { File f = new File(icedteaLogDir); if (f.isDirectory() || f.mkdirs()) { @@ -74,6 +75,8 @@ } else { enableLogging = false; } + } else { + enableLogging = false; } }
--- a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java Thu Apr 02 20:09:00 2015 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java Thu Apr 02 20:48:51 2015 +0200 @@ -36,6 +36,7 @@ import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.UpdatePolicy; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.logging.NoStdOutErrTest; import net.sourceforge.jnlp.util.replacements.BASE64Encoder; @@ -85,7 +86,7 @@ @BeforeClass public static void setup() { - originalCacheDir = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR); + originalCacheDir = PathsAndFiles.CACHE_DIR.getFullPath(); JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR, System.getProperty("java.io.tmpdir") + File.separator + "tempcache"); } @@ -312,7 +313,7 @@ Assert.assertTrue(jars.length == 2); //Resource can be in any order - List<String> resourceLocations = new ArrayList<String>(); + List<String> resourceLocations = new ArrayList<>(); resourceLocations.add(jars[0].getLocation().toExternalForm()); resourceLocations.add(jars[1].getLocation().toExternalForm());
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java Thu Apr 02 20:09:00 2015 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java Thu Apr 02 20:48:51 2015 +0200 @@ -30,6 +30,7 @@ import net.sourceforge.jnlp.ServerLauncher; import net.sourceforge.jnlp.Version; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.JarFile; import net.sourceforge.jnlp.util.logging.NoStdOutErrTest; @@ -310,7 +311,7 @@ downloadServer = ServerAccess.getIndependentInstance(dir.getAbsolutePath(), ServerAccess.findFreePort()); redirectErrBack(); - cacheDir = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR); + cacheDir = PathsAndFiles.CACHE_DIR.getFullPath(); JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR, System.getProperty("java.io.tmpdir") + File.separator + "tempcache"); }
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceTrackerTest.java Thu Apr 02 20:09:00 2015 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceTrackerTest.java Thu Apr 02 20:48:51 2015 +0200 @@ -64,6 +64,7 @@ import net.sourceforge.jnlp.ServerLauncher; import net.sourceforge.jnlp.Version; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.UrlUtils; import net.sourceforge.jnlp.util.logging.NoStdOutErrTest; @@ -249,7 +250,7 @@ downloadServer = ServerAccess.getIndependentInstance(dir.getAbsolutePath(), ServerAccess.findFreePort()); redirectErrBack(); - cacheDir = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR); + cacheDir = PathsAndFiles.CACHE_DIR.getFullPath(); JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR, System.getProperty("java.io.tmpdir") + File.separator + "tempcache"); }
--- a/tests/netx/unit/net/sourceforge/jnlp/security/KeyStoresTest.java Thu Apr 02 20:09:00 2015 +0200 +++ b/tests/netx/unit/net/sourceforge/jnlp/security/KeyStoresTest.java Thu Apr 02 20:48:51 2015 +0200 @@ -36,10 +36,8 @@ */ package net.sourceforge.jnlp.security; -import java.io.File; import java.security.Permission; import net.sourceforge.jnlp.config.PathsAndFiles; -import net.sourceforge.jnlp.runtime.JNLPRuntime; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Test; @@ -64,54 +62,51 @@ //TODO once setConfig is removed, ensure SM is enforced also from PathsAndFiles @Test public void getKeyStoreUserLocationTest() { - String s; + PathsAndFiles.InfrastructureFileDescriptor s; System.setSecurityManager(null); - KeyStores.setConfiguration(JNLPRuntime.getConfiguration()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CACERTS.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CACERTS.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CERTS.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CERTS.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CLIENT_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CLIENTCERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CLIENTCERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.JSSE_CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_JSSECAC.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_JSSECAC.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.JSSE_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_JSSECER.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_JSSECER.getFile()); } @Test public void getKeyStoreSystemLocationTest() { - String s; + PathsAndFiles.InfrastructureFileDescriptor s; System.setSecurityManager(null); - KeyStores.setConfiguration(JNLPRuntime.getConfiguration()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CACERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CACERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CLIENT_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CLIENTCERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CLIENTCERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.JSSE_CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_JSSECAC.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_JSSECAC.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.JSSE_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_JSSECERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_JSSECERT.getFile()); } @Test public void getKeyStoreUserLocationTestSM() { DummySM dm = new DummySM(); System.setSecurityManager(dm); - String s; - KeyStores.setConfiguration(JNLPRuntime.getConfiguration()); + PathsAndFiles.InfrastructureFileDescriptor s; s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CACERTS.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CACERTS.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CERTS.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CERTS.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.CLIENT_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_CLIENTCERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_CLIENTCERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.JSSE_CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_JSSECAC.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_JSSECAC.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.USER, KeyStores.Type.JSSE_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.USER_JSSECER.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.USER_JSSECER.getFile()); Assert.assertEquals(true, dm.called); } @@ -119,18 +114,17 @@ public void getKeyStoreSystemLocationTestSM() { DummySM dm = new DummySM(); System.setSecurityManager(dm); - String s; - KeyStores.setConfiguration(JNLPRuntime.getConfiguration()); + PathsAndFiles.InfrastructureFileDescriptor s; s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CACERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CACERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.CLIENT_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_CLIENTCERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_CLIENTCERT.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.JSSE_CA_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_JSSECAC.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_JSSECAC.getFile()); s = KeyStores.getKeyStoreLocation(KeyStores.Level.SYSTEM, KeyStores.Type.JSSE_CERTS); - Assert.assertEquals(new File(s), PathsAndFiles.SYS_JSSECERT.getFile()); + Assert.assertEquals(s.getFile(), PathsAndFiles.SYS_JSSECERT.getFile()); Assert.assertEquals(true, dm.called); }