Mercurial > hg > release > icedtea-web-1.3
changeset 467:b1b5b91b9830
Refactor launch type of JNLPFile into its own type, LaunchDesc
author | Adam Domurad <adomurad@redhat.com> |
---|---|
date | Tue, 24 Jul 2012 10:34:08 -0400 |
parents | c9d0e375f07c |
children | 14fbe4fcec25 |
files | ChangeLog netx/net/sourceforge/jnlp/AppletDesc.java netx/net/sourceforge/jnlp/ApplicationDesc.java netx/net/sourceforge/jnlp/InstallerDesc.java netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/LaunchDesc.java netx/net/sourceforge/jnlp/Parser.java netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |
diffstat | 8 files changed, 75 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jul 20 10:44:46 2012 -0400 +++ b/ChangeLog Tue Jul 24 10:34:08 2012 -0400 @@ -1,3 +1,19 @@ +2012-07-24 Adam Domurad <adomurad@redhat.com> + + Refactor JNLPFile#launchType into its own interface type (as opposed to + Object), LaunchDesc. + * netx/net/sourceforge/jnlp/AppletDesc.java: Add override annotation to + getMainClass(). + * netx/net/sourceforge/jnlp/ApplicationDesc.java: Same as above + * netx/net/sourceforge/jnlp/InstallerDesc.java: Same as above + * netx/net/sourceforge/jnlp/JNLPFile.java: Make launchType a + LaunchDesc object. Update getLaunchInfo() accordingly. + * netx/net/sourceforge/jnlp/LaunchDesc.java: New launch description. + * netx/net/sourceforge/jnlp/Parser.java + (getLauncher): Return type changed to LaunchDesc + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Replace + occurences of instanceof with respect to launchType. + 2012-07-18 Danesh Dadachanji <ddadacha@redhat.com> Fix RH838417, Fix RH838559: Disambiguate signed applet security prompt
--- a/netx/net/sourceforge/jnlp/AppletDesc.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/AppletDesc.java Tue Jul 24 10:34:08 2012 -0400 @@ -25,7 +25,7 @@ * @author <a href="mailto:jmaxwell@users.sourceforge.net">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 @@ /** * Returns the main class name in the dot-separated form (eg: foo.bar.Baz) */ + @Override public String getMainClass() { return mainClass; }
--- a/netx/net/sourceforge/jnlp/ApplicationDesc.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/ApplicationDesc.java Tue Jul 24 10:34:08 2012 -0400 @@ -24,7 +24,7 @@ * @author <a href="mailto:jmaxwell@users.sourceforge.net">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 @@ /** * Returns the main class name */ + @Override public String getMainClass() { return mainClass; }
--- a/netx/net/sourceforge/jnlp/InstallerDesc.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/InstallerDesc.java Tue Jul 24 10:34:08 2012 -0400 @@ -22,7 +22,7 @@ * @author <a href="mailto:jmaxwell@users.sourceforge.net">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 @@ /** * Returns the main class name and package. */ + @Override public String getMainClass() { return mainClass; }
--- a/netx/net/sourceforge/jnlp/JNLPFile.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Tue Jul 24 10:34:08 2012 -0400 @@ -91,7 +91,7 @@ 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 @@ * Returns an object of one of the following types: AppletDesc, * ApplicationDesc and InstallerDesc */ - public Object getLaunchInfo() { + public LaunchDesc getLaunchInfo() { return launchType; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/LaunchDesc.java Tue Jul 24 10:34:08 2012 -0400 @@ -0,0 +1,42 @@ +/* LaunchDesc -- Represents a launch description + Copyright (C) 2012 Red Hat + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package net.sourceforge.jnlp; + +public interface LaunchDesc { + public String getMainClass(); +}
--- a/netx/net/sourceforge/jnlp/Parser.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Tue Jul 24 10:34:08 2012 -0400 @@ -609,7 +609,7 @@ * @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
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Fri Jul 20 10:44:46 2012 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jul 24 10:34:08 2012 -0400 @@ -67,6 +67,7 @@ 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 @@ // 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 @@ */ private void checkForMain(List<JARDesc> jars) throws LaunchException { + // Check launch info if (mainClass == null) { - Object obj = file.getLaunchInfo(); + LaunchDesc launchDesc = file.getLaunchInfo(); + if (launchDesc == null) { + return; + } - 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 - return; + mainClass = launchDesc.getMainClass(); } // The main class may be specified in the manifest