aboutsummaryrefslogtreecommitdiffstats
path: root/netx
diff options
context:
space:
mode:
authorAdam Domurad <[email protected]>2012-07-10 10:35:52 -0400
committerAdam Domurad <[email protected]>2012-07-10 10:35:52 -0400
commitb70936939cf57d11448538dbbcb5ecc535a603dc (patch)
treed5b191c9f887ae54af64138ac75c40f3d0bbf623 /netx
parentd61edd76c23e6a1e85a117f39c77ae6a9ac5f8ca (diff)
Refactor Object launchType; to LaunchDesc launchType; in JNLPFile
Diffstat (limited to 'netx')
-rw-r--r--netx/net/sourceforge/jnlp/AppletDesc.java3
-rw-r--r--netx/net/sourceforge/jnlp/ApplicationDesc.java3
-rw-r--r--netx/net/sourceforge/jnlp/InstallerDesc.java3
-rw-r--r--netx/net/sourceforge/jnlp/JNLPFile.java4
-rw-r--r--netx/net/sourceforge/jnlp/Parser.java2
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java19
6 files changed, 17 insertions, 17 deletions
diff --git a/netx/net/sourceforge/jnlp/AppletDesc.java b/netx/net/sourceforge/jnlp/AppletDesc.java
index da8021e..cde5fbe 100644
--- a/netx/net/sourceforge/jnlp/AppletDesc.java
+++ b/netx/net/sourceforge/jnlp/AppletDesc.java
@@ -25,7 +25,7 @@ import java.util.*;
* @author <a href="mailto:[email protected]">Jon A. Maxwell (JAM)</a> - initial author
* @version $Revision: 1.8 $
*/
-public class AppletDesc {
+public class AppletDesc implements LaunchDesc {
/** the applet name */
private String name;
@@ -75,6 +75,7 @@ public class AppletDesc {
/**
* Returns the main class name in the dot-separated form (eg: foo.bar.Baz)
*/
+ @Override
public String getMainClass() {
return mainClass;
}
diff --git a/netx/net/sourceforge/jnlp/ApplicationDesc.java b/netx/net/sourceforge/jnlp/ApplicationDesc.java
index 6d07043..99b3af8 100644
--- a/netx/net/sourceforge/jnlp/ApplicationDesc.java
+++ b/netx/net/sourceforge/jnlp/ApplicationDesc.java
@@ -24,7 +24,7 @@ import java.util.*;
* @author <a href="mailto:[email protected]">Jon A. Maxwell (JAM)</a> - initial author
* @version $Revision: 1.7 $
*/
-public class ApplicationDesc {
+public class ApplicationDesc implements LaunchDesc {
/** the main class name and package */
private String mainClass;
@@ -46,6 +46,7 @@ public class ApplicationDesc {
/**
* Returns the main class name
*/
+ @Override
public String getMainClass() {
return mainClass;
}
diff --git a/netx/net/sourceforge/jnlp/InstallerDesc.java b/netx/net/sourceforge/jnlp/InstallerDesc.java
index 84e8892..165d795 100644
--- a/netx/net/sourceforge/jnlp/InstallerDesc.java
+++ b/netx/net/sourceforge/jnlp/InstallerDesc.java
@@ -22,7 +22,7 @@ package net.sourceforge.jnlp;
* @author <a href="mailto:[email protected]">Jon A. Maxwell (JAM)</a> - initial author
* @version $Revision: 1.6 $
*/
-public class InstallerDesc {
+public class InstallerDesc implements LaunchDesc {
/** the main class name and package. */
private String mainClass;
@@ -39,6 +39,7 @@ public class InstallerDesc {
/**
* Returns the main class name and package.
*/
+ @Override
public String getMainClass() {
return mainClass;
}
diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java
index 41354d3..6c458f8 100644
--- a/netx/net/sourceforge/jnlp/JNLPFile.java
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java
@@ -91,7 +91,7 @@ public class JNLPFile {
protected ResourcesDesc sharedResources = new ResourcesDesc(this, null, null, null);
/** the application description */
- protected Object launchType;
+ protected LaunchDesc launchType;
/** the component description */
protected ComponentDesc component;
@@ -446,7 +446,7 @@ public class JNLPFile {
* Returns an object of one of the following types: AppletDesc,
* ApplicationDesc and InstallerDesc
*/
- public Object getLaunchInfo() {
+ public LaunchDesc getLaunchInfo() {
return launchType;
}
diff --git a/netx/net/sourceforge/jnlp/Parser.java b/netx/net/sourceforge/jnlp/Parser.java
index a823562..60cd9b4 100644
--- a/netx/net/sourceforge/jnlp/Parser.java
+++ b/netx/net/sourceforge/jnlp/Parser.java
@@ -609,7 +609,7 @@ class Parser {
* @param parent the parent node
* @throws ParseException if the JNLP file is invalid
*/
- public Object getLauncher(Node parent) throws ParseException {
+ public LaunchDesc getLauncher(Node parent) throws ParseException {
// check for other than one application type
if (1 < getChildNodes(parent, "applet-desc").length
+ getChildNodes(parent, "application-desc").length
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index 83ffcb5..86eda20 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -67,6 +67,7 @@ import net.sourceforge.jnlp.JARDesc;
import net.sourceforge.jnlp.JNLPFile;
import net.sourceforge.jnlp.JNLPMatcher;
import net.sourceforge.jnlp.JNLPMatcherException;
+import net.sourceforge.jnlp.LaunchDesc;
import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.ParseException;
import net.sourceforge.jnlp.PluginBridge;
@@ -636,8 +637,7 @@ public class JNLPClassLoader extends URLClassLoader {
// If jar with main class was not found and there are no more
// available jars, throw a LaunchException
- if (file.getLaunchInfo() instanceof AppletDesc ||
- file.getLaunchInfo() instanceof ApplicationDesc) {
+ if (file.getLaunchInfo() != null) {
if (!foundMainJar
&& (available == null || available.size() == 0))
throw new LaunchException(file, null, R("LSFatal"),
@@ -729,17 +729,14 @@ public class JNLPClassLoader extends URLClassLoader {
*/
private void checkForMain(List<JARDesc> jars) throws LaunchException {
+ // Check launch info
if (mainClass == null) {
- Object obj = file.getLaunchInfo();
-
- if (obj instanceof ApplicationDesc) {
- ApplicationDesc ad = (ApplicationDesc) file.getLaunchInfo();
- mainClass = ad.getMainClass();
- } else if (obj instanceof AppletDesc) {
- AppletDesc ad = (AppletDesc) file.getLaunchInfo();
- mainClass = ad.getMainClass();
- } else
+ LaunchDesc launchDesc = file.getLaunchInfo();
+ if (launchDesc == null) {
return;
+ }
+
+ mainClass = launchDesc.getMainClass();
}
// The main class may be specified in the manifest