aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/JNLPFile.java
diff options
context:
space:
mode:
authorSaad Mohammad <[email protected]>2011-08-22 15:09:47 -0400
committerSaad Mohammad <[email protected]>2011-08-22 15:09:47 -0400
commitca57a77f66bbca5e2be1da83868ba0b5daab0ca3 (patch)
tree69fae35674d0d6c7059b2eea12685a3fffcb89a2 /netx/net/sourceforge/jnlp/JNLPFile.java
parent3fdbc63fe69b247c9aaa49a322142a2085248095 (diff)
Checks and verifies a signed JNLP file at the launch of the application. A signed JNLP warning is displayed if appropriate.
Diffstat (limited to 'netx/net/sourceforge/jnlp/JNLPFile.java')
-rw-r--r--netx/net/sourceforge/jnlp/JNLPFile.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java
index 183f6b1..714ff7e 100644
--- a/netx/net/sourceforge/jnlp/JNLPFile.java
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java
@@ -107,7 +107,18 @@ public class JNLPFile {
/** the default jvm */
protected String defaultArch = null;
+
+ /** A signed JNLP file is missing from the main jar */
+ private boolean missingSignedJNLP = false;
+
+ /** JNLP file contains special properties */
+ private boolean containsSpecialProperties = false;
+ /**
+ * List of acceptable properties (not-special)
+ */
+ private String[] generalProperties = SecurityDesc.getJnlpRIAPermissions();
+
{ // initialize defaults if security allows
try {
defaultLocale = Locale.getDefault();
@@ -608,6 +619,9 @@ public class JNLPFile {
launchType = parser.getLauncher(root);
component = parser.getComponent(root);
security = parser.getSecurity(root);
+
+ checkForSpecialProperties();
+
} catch (ParseException ex) {
throw ex;
} catch (Exception ex) {
@@ -619,6 +633,30 @@ public class JNLPFile {
}
/**
+ * Inspects the JNLP file to check if it contains any special properties
+ */
+ private void checkForSpecialProperties() {
+
+ for (ResourcesDesc res : resources) {
+ for (PropertyDesc propertyDesc : res.getProperties()) {
+
+ for (int i = 0; i < generalProperties.length; i++) {
+ String property = propertyDesc.getKey();
+
+ if (property.equals(generalProperties[i])) {
+ break;
+ } else if (!property.equals(generalProperties[i])
+ && i == generalProperties.length - 1) {
+ containsSpecialProperties = true;
+ return;
+ }
+ }
+
+ }
+ }
+ }
+
+ /**
*
* @return true if the JNLP file specifies things that can only be
* applied on a new vm (eg: different max heap memory)
@@ -690,4 +728,21 @@ public class JNLPFile {
return new DownloadOptions(usePack, useVersion);
}
+ /**
+ * Returns a boolean after determining if a signed JNLP warning should be
+ * displayed in the 'More Information' panel.
+ *
+ * @return true if a warning should be displayed; otherwise false
+ */
+ public boolean requiresSignedJNLPWarning() {
+ return (missingSignedJNLP && containsSpecialProperties);
+ }
+
+ /**
+ * Informs that a signed JNLP file is missing in the main jar
+ */
+ public void setSignedJNLPAsMissing() {
+ missingSignedJNLP = true;
+ }
+
}