changeset in /hg/icedtea: 2009-06-17 Omair Majid <omajid at redha...
Omair Majid
omajid at redhat.com
Tue Aug 4 09:07:33 PDT 2009
changeset 2bf6d173f425 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=2bf6d173f425
description:
2009-06-17 Omair Majid <omajid at redhat.com>
* netx/net/sourceforge/jnlp/runtime/Boot.java: Remove aboutFile.
(getAboutFile): Get path from JNLPRuntime.
(getBaseDir): Fix comments.
* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Add HOME_DIR,
NETXRC_FILE, NETX_DIR, SECURITY_DIR, CERTIFICATES_FILE, LOCKS_DIR,
JAVA_HOME_DIR, and NETX_ABOUT_FILE.
(getDefaultBaseDir): Remove calls to loadWindowIcon and isHeadless()
because they are unused. Use HOME_DIR and NETX_DIR. Be prepared for
existing NETX_DIR.
(getProperties): Use NETXRC_FILE instead of hardcoded file name.
* netx/net/sourceforge/jnlp/security/SecurityUtil.java
Remove homeDir, certDir and certFile.
(getTrustedCertsFilename): Use HOME_DIR and CERTIFICATES_FILE.
(checkTrustedCertsFile): Find parent directory from certFile.
diffstat:
4 files changed, 61 insertions(+), 27 deletions(-)
ChangeLog | 19 +++++++-
netx/net/sourceforge/jnlp/runtime/Boot.java | 16 ++----
netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 42 +++++++++++++-----
netx/net/sourceforge/jnlp/security/SecurityUtil.java | 11 ++--
diffs (183 lines):
diff -r f04f94067be0 -r 2bf6d173f425 ChangeLog
--- a/ChangeLog Wed Jun 17 15:13:34 2009 -0400
+++ b/ChangeLog Wed Jun 17 17:10:39 2009 -0400
@@ -1,6 +1,23 @@ 2009-06-17 Omair Majid <omajid at redhat.
2009-06-17 Omair Majid <omajid at redhat.com>
- * * netx/javax/jnlp/ExtendedService.java: New file.
+ * netx/net/sourceforge/jnlp/runtime/Boot.java: Remove aboutFile.
+ (getAboutFile): Get path from JNLPRuntime.
+ (getBaseDir): Fix comments.
+ * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Add HOME_DIR,
+ NETXRC_FILE, NETX_DIR, SECURITY_DIR, CERTIFICATES_FILE, LOCKS_DIR,
+ JAVA_HOME_DIR, and NETX_ABOUT_FILE.
+ (getDefaultBaseDir): Remove calls to loadWindowIcon and isHeadless()
+ because they are unused. Use HOME_DIR and NETX_DIR. Be prepared for
+ existing NETX_DIR.
+ (getProperties): Use NETXRC_FILE instead of hardcoded file name.
+ * netx/net/sourceforge/jnlp/security/SecurityUtil.java
+ Remove homeDir, certDir and certFile.
+ (getTrustedCertsFilename): Use HOME_DIR and CERTIFICATES_FILE.
+ (checkTrustedCertsFile): Find parent directory from certFile.
+
+2009-06-17 Omair Majid <omajid at redhat.com>
+
+ * netx/javax/jnlp/ExtendedService.java: New file.
* netx/net/sourceforge/jnlp/services/XExtendedService.java: New file.
* netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add
ExtendedService to serviceNames. Create a proxy for XExtendedService to
diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/runtime/Boot.java
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 17 15:13:34 2009 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 17 17:10:39 2009 -0400
@@ -67,10 +67,6 @@ public final class Boot implements Privi
private static final String version = "0.5";
- /** the JNLP file to open to display the network-based about window */
- private static final String aboutFile =
- System.getProperty("java.home") + "/lib/about.jnlp";
-
/** the text to display before launching the about link */
private static final String aboutMessage = ""
+ "netx v"+version+" - (C)2001-2003 Jon A. Maxwell (jmaxwell at users.sourceforge.net)\n"
@@ -234,8 +230,8 @@ public final class Boot implements Privi
*/
private static String getAboutFile() {
- if (new File(aboutFile).exists())
- return aboutFile;
+ if (new File(JNLPRuntime.NETX_ABOUT_FILE).exists())
+ return JNLPRuntime.NETX_ABOUT_FILE;
else
return null;
}
@@ -424,9 +420,9 @@ public final class Boot implements Privi
/**
* Return the base dir. If the base dir parameter is not set
- * the value is read from the "${user.home}/.netxrc" file (as
- * defined by JNLPRuntime). If that file does not exist, an
- * install dialog is displayed to select the base directory.
+ * the value is read from JNLPRuntime.NETX_ABOUT_FILE file.
+ * If that file does not exist, an install dialog is displayed
+ * to select the base directory.
*/
private static File getBaseDir() {
if (getOption("-basedir") != null) {
@@ -438,7 +434,7 @@ public final class Boot implements Privi
return basedir;
}
- // check .netxrc, display dialog
+ // check .netxrc
File basedir = JNLPRuntime.getDefaultBaseDir();
if (basedir == null)
fatalError(R("BNoBase"));
diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 17 15:13:34 2009 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 17 17:10:39 2009 -0400
@@ -104,6 +104,34 @@ public class JNLPRuntime {
/** contains the arguments passed to the jnlp runtime */
private static List<String> initialArguments;
+ /** User's home directory */
+ public static final String HOME_DIR = System.getProperty("user.home");
+
+ /** the ~/.netxrc file containing netx settings */
+ public static final String NETXRC_FILE = HOME_DIR + File.separator + ".netxrc";
+
+ /** the ~/.netx directory containing user-specific data */
+ public static final String NETX_DIR = HOME_DIR + File.separator + ".netx";
+
+ /** the ~/.netx/security directory containing security related information */
+ public static final String SECURITY_DIR = NETX_DIR + File.separator + "security";
+
+ /** the ~/.netx/security/trusted.certs file containing trusted certificates */
+ public static final String CERTIFICATES_FILE = SECURITY_DIR + File.separator + "trusted.certs";
+
+ /**
+ * the ~/.netx/locks/ directory containing locks for single instance
+ * applications
+ */
+ public static final String LOCKS_DIR = NETX_DIR + File.separator + "locks";
+
+ public static final String JAVA_HOME_DIR = System.getProperty("java.home");
+
+ /** the JNLP file to open to display the network-based about window */
+ public static final String NETX_ABOUT_FILE = JAVA_HOME_DIR + File.separator + "lib"
+ + File.separator + "about.jnlp";
+
+
/**
* Returns whether the JNLP runtime environment has been
@@ -279,18 +307,13 @@ public class JNLPRuntime {
public static File getDefaultBaseDir() {
PropertiesFile props = JNLPRuntime.getProperties();
- loadWindowIcon();
-
String baseStr = props.getProperty("basedir");
if (baseStr != null)
return new File(baseStr);
- if (isHeadless())
- return null;
-
- String homeDir = System.getProperty("user.home");
- File baseDir = new File(homeDir + "/.netx/");
- if (homeDir == null || !baseDir.mkdir())
+ String homeDir = HOME_DIR;
+ File baseDir = new File(NETX_DIR);
+ if (homeDir == null || (!baseDir.isDirectory() && !baseDir.mkdir()))
return null;
props.setProperty("basedir", baseDir.toString());
@@ -332,8 +355,7 @@ public class JNLPRuntime {
* properties file.
*/
public static PropertiesFile getProperties() {
- File netxrc = new File(System.getProperty("user.home"), ".netxrc");
-
+ File netxrc = new File(NETXRC_FILE);
return new PropertiesFile(netxrc);
}
diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/security/SecurityUtil.java
--- a/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 17 15:13:34 2009 -0400
+++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 17 17:10:39 2009 -0400
@@ -42,21 +42,20 @@ import java.io.FileOutputStream;
import java.io.FileOutputStream;
import java.security.KeyStore;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
public class SecurityUtil {
- private static String homeDir = null;
- private static final String certDir = "/.netx/security/";
- private static final String certFile = "trusted.certs";
private static final char[] password = "changeit".toCharArray();
public static String getTrustedCertsFilename() throws Exception{
- homeDir = System.getProperty("user.home");
+ String homeDir = JNLPRuntime.HOME_DIR;
if (homeDir == null) {
throw new Exception("Could not access home directory");
} else {
- return homeDir + certDir + certFile;
+ return JNLPRuntime.CERTIFICATES_FILE;
}
}
@@ -90,7 +89,7 @@ public class SecurityUtil {
//file does not exist
if (!certFile.isFile()) {
- File dir = new File(homeDir+certDir);
+ File dir = certFile.getAbsoluteFile().getParentFile();
boolean madeDir = false;
if (!dir.isDirectory()) {
madeDir = dir.mkdirs();
More information about the distro-pkg-dev
mailing list