Mercurial > hg > release > icedtea-web-1.3
changeset 458:f7191afb7ab9
Fix PR1040, PR1041, PR1042: Allows signed jars to function correctly using extensions
line wrap: on
line diff
--- a/ChangeLog Tue Jul 03 16:42:52 2012 +0200 +++ b/ChangeLog Tue Jul 03 17:00:49 2012 -0400 @@ -1,3 +1,47 @@ +2012-07-03 Saad Mohammad <smohammad@redhat.com> + + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: + (JNLPClassLoader): New constructor that accepts an additional parameter + containing the main class name. + (getInstance): Accepts mainName as parameter to override application's + main class name + (initializeExtensions): Passes in the name of the application's main class + when creating a new JNLPClassLoader instance. + (initializeResources): If the loader owns no jars, it will consider + itself as signed if all of the extension loaders are signed. Also, if the + extension jars have the main class, it will set foundMainJar to true. + (initializeResources): If the main class was not found, check if it was + found within the extension jars. + (checkForMain): Uses the overwritten main class name (if set) when + searching for the main within the jars. + (hasMainJar): Returns true if this loader holds the main jar. + (hasMainInExtensions): Returns true if extension loaders have the main jar + * tests/jnlp_tests/signed/ExtensionJnlp/resources/UsesSignedJarExtension.jnlp: + * tests/jnlp_tests/signed/ExtensionJnlp/resources/UsesSignedJnlpExtension.jnlp: + * tests/jnlp_tests/signed/ExtensionJnlp/resources/UsesSignedJnlpJarAndSignedJarExtension.jnlp: + Launching jnlps that use extension jnlp as its resource. + * tests/jnlp_tests/signed/ExtensionJnlp/resources/UsesSignedJar.jnlp: + Launching jnlp that directly launches SignedJarResource class. + * tests/jnlp_tests/signed/ExtensionJnlp/resources/UsesSignedJnlp.jnlp: + Launching jnlp that directly launches SignedJnlpResource class. + * tests/jnlp_tests/signed/ExtensionJnlp/testcases/ExtensionJnlpTest.java: + Testcase that tests the launching of jnlp files containing extension jnlps + as resource. + * tests/jnlp_tests/signed/SignedJarResource/resources/SignedJarExtension.jnlp: + Component jnlp file that is used as an extension resource. + * tests/jnlp_tests/signed/SignedJarResource/srcs/SignedJarResource.java: + A simple java class that outputs a string. + * tests/jnlp_tests/signed/SignedJnlpResource/resources/UnmatchingSignedJnlpExtension.jnlp: + Component jnlp file that is used as an extension resource and does not + match the signed jnlp file. + * tests/jnlp_tests/signed/SignedJnlpResource/resources/MatchingSignedJnlpExtension.jnlp: + Component jnlp file that is used as an extension resource and matches the + signed jnlp file. + * tests/jnlp_tests/signed/SignedJnlpResource/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp: + Signed jnlp file. + * tests/jnlp_tests/signed/SignedJnlpResource/srcs/SignedJnlpResource.java: + A simple java class that outputs a string. + 2012-07-02 Jiri Vanek <jvanek@redhat.com> Added missing headers
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jul 03 16:42:52 2012 +0200 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jul 03 17:00:49 2012 -0400 @@ -183,6 +183,9 @@ * */ private boolean foundMainJar= false; + /** Name of the application's main class */ + private String mainClass = null; + /** * Variable to track how many times this loader is in use */ @@ -194,6 +197,16 @@ * @param file the JNLP file */ protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy) throws LaunchException { + this(file,policy,null); + } + + /** + * Create a new JNLPClassLoader from the specified file. + * + * @param file the JNLP file + * @param name of the application's main class + */ + protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy, String mainName) throws LaunchException { super(new URL[0], JNLPClassLoader.class.getClassLoader()); if (JNLPRuntime.isDebug()) @@ -203,6 +216,8 @@ this.updatePolicy = policy; this.resources = file.getResources(); + this.mainClass = mainName; + // initialize extensions initializeExtensions(); @@ -309,6 +324,17 @@ * @param policy the update policy to use when downloading resources */ public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy) throws LaunchException { + return getInstance(file, policy, null); + } + + /** + * Returns a JNLP classloader for the specified JNLP file. + * + * @param file the file to load classes for + * @param policy the update policy to use when downloading resources + * @param mainName Overrides the main class name of the application + */ + public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, String mainName) throws LaunchException { JNLPClassLoader baseLoader = null; JNLPClassLoader loader = null; String uniqueKey = file.getUniqueKey(); @@ -325,7 +351,7 @@ (file.isApplication() && !baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation()))) { - loader = new JNLPClassLoader(file, policy); + loader = new JNLPClassLoader(file, policy, mainName); // New loader init may have caused extentions to create a // loader for this unique key. Check. @@ -343,14 +369,14 @@ // loader is now current + ext. But we also need to think of // the baseLoader if (baseLoader != null && baseLoader != loader) { - loader.merge(baseLoader); + loader.merge(baseLoader); } } else { // if key is same and locations match, this is the loader we want if (!file.isApplication()) { // If this is an applet, we do need to consider its loader - loader = new JNLPClassLoader(file, policy); + loader = new JNLPClassLoader(file, policy, mainName); if (baseLoader != null) baseLoader.merge(loader); @@ -380,13 +406,17 @@ * @param location the file's location * @param version the file's version * @param policy the update policy to use when downloading resources + * @param mainName Overrides the main class name of the application */ - public static JNLPClassLoader getInstance(URL location, String uniqueKey, Version version, UpdatePolicy policy) + public static JNLPClassLoader getInstance(URL location, String uniqueKey, Version version, UpdatePolicy policy, String mainName) throws IOException, ParseException, LaunchException { JNLPClassLoader loader = urlToLoader.get(uniqueKey); - if (loader == null || !location.equals(loader.getJNLPFile().getFileLocation())) - loader = getInstance(new JNLPFile(location, uniqueKey, version, false, policy), policy); + if (loader == null || !location.equals(loader.getJNLPFile().getFileLocation())) { + JNLPFile jnlpFile = new JNLPFile(location, uniqueKey, version, false, policy); + + loader = getInstance(jnlpFile, policy, mainName); + } return loader; } @@ -405,7 +435,20 @@ for (int i = 0; i < ext.length; i++) { try { String uniqueKey = this.getJNLPFile().getUniqueKey(); - JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), updatePolicy); + + 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(); + } + } + + JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), updatePolicy, mainClass); loaderList.add(loader); } catch (Exception ex) { ex.printStackTrace(); @@ -457,8 +500,25 @@ } JARDesc jars[] = resources.getJARs(); - if (jars == null || jars.length == 0) + + if (jars == null || jars.length == 0) { + + boolean allSigned = true; + for (int i = 1; i < loaders.length; i++) { + if (!loaders[i].getSigning()) { + allSigned = false; + break; + } + } + + if(allSigned) + signing = true; + + //Check if main jar is found within extensions + foundMainJar = foundMainJar || hasMainInExtensions(); + return; + } /* if (jars == null || jars.length == 0) { throw new LaunchException(null, null, R("LSFatal"), @@ -520,6 +580,10 @@ while (!foundMainJar && available != null && available.size() != 0) addNextResource(); + // If the jar with main class was not found, check extension + // jnlp's resources + foundMainJar = foundMainJar || hasMainInExtensions(); + // If jar with main class was not found and there are no more // available jars, throw a LaunchException if (file.getLaunchInfo() instanceof AppletDesc || @@ -606,17 +670,18 @@ */ private void checkForMain(List<JARDesc> jars) throws LaunchException { - Object obj = file.getLaunchInfo(); - String mainClass; + 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 - 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; + } // The main class may be specified in the manifest @@ -711,6 +776,26 @@ } /** + * Returns true if this loader has the main jar + */ + public boolean hasMainJar() { + return this.foundMainJar; + } + + /** + * Returns true if extension loaders have the main jar + */ + private boolean hasMainInExtensions() { + boolean foundMain = false; + + for (int i = 1; i < loaders.length && !foundMain; i++) { + foundMain = loaders[i].hasMainJar(); + } + + return foundMain; + } + + /** * Is called by checkForMain() to check if the jar file is signed and if it * contains a signed JNLP file. *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/resources/UsesSignedJar.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,63 @@ +<!-- + +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. + +*********************************************************************** +Uses only the main jar as its resources (SignedJarResource) ; used for testing to check if the jar +exists with main +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UsesSignedJar.jnlp" codebase="."> + <information> + <title>UsesSignedJar</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UsesSignedJar</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJarResource.jar" main="true"/> + </resources> + + <application-desc main-class="SignedJarResource"> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/resources/UsesSignedJarExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +Uses only SignedJarExtension as its resources +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UsesSignedJarExtension.jnlp" codebase="."> + <information> + <title>UseSignedJarExtension</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UseSignedJarExtension</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <extension name="SignedJarExtension" href="./SignedJarExtension.jnlp"/> + </resources> + + <application-desc main-class="SignedJarResource"> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/resources/UsesSignedJnlp.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +Uses only MatchingSignedJnlpExtension as its resources +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UsesSignedJnlp.jnlp" codebase="."> + <information> + <title>UsesSignedJnlp</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UsesSignedJnlp</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <extension name="MatchingSignedJnlpExtension" href="./MatchingSignedJnlpExtension.jnlp"/> + </resources> + + <application-desc main-class="SignedJnlpResource"> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/resources/UsesSignedJnlpExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +Uses only UnmatchingSignedJnlpExtension as its resources +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UsesSignedJnlpExtension.jnlp" codebase="."> + <information> + <title>UsesSignedJnlpExtension</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UsesSignedJnlpExtension</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <extension name="UnmatchingSignedJnlpExtension" href="./UnmatchingSignedJnlpExtension.jnlp"/> + </resources> + + <application-desc main-class="SignedJnlpResource"> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/resources/UsesSignedJnlpJarAndSignedJarExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,63 @@ +<!-- + +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. + +*********************************************************************** +File contains a jar and an extension jnlp (with the main jar) for its resources +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UsesSignedJnlpJarAndSignedJarExtension.jnlp" codebase="."> + <information> + <title>UsesSignedJnlpJarAndSignedJarExtension</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UsesSignedJnlpJarAndSignedJarExtension</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpResource.jar" main="false"/> + <extension name="SignedJarExtension" href="./SignedJarExtension.jnlp"/> + </resources> + + <application-desc main-class="SignedJarResource"> + </application-desc> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/ExtensionJnlp/testcases/ExtensionJnlpTest.java Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,86 @@ +/* ExtensionJnlpTest.java +Copyright (C) 2012 Red Hat, Inc. + +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, version 2. + +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. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; + +import org.junit.Assert; +import org.junit.Test; + +public class ExtensionJnlpTest { + + private static ServerAccess server = new ServerAccess(); + private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String jarOutput = "Running SignedJarResource.."; + private final String signedJnlpException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: " + + "The signed JNLP file did not match the launching JNLP file. Missing Resource: Signed Application " + + "did not match launching JNLP File"; + + @Test + public void checkingForRequiredResources() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJar.jnlp"); + Assert.assertTrue("Could not locate SignedJarResource class within SignedJarResource jar", pr.stdout.contains(jarOutput)); + + String s = "Running SignedJnlpResource.."; + pr = server.executeJavawsHeadless(l, "/UsesSignedJnlp.jnlp"); + Assert.assertTrue("Could not locate SignedJnlpResource class within SignedJnlpResource jar", pr.stdout.contains(s)); + } + + @Bug(id = "PR1040") + @Test + public void usingSignedExtension() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJarExtension.jnlp"); + Assert.assertTrue("Stdout should contain " + jarOutput + " but did not", pr.stdout.contains(jarOutput)); + } + + @Bug(id = "PR1041") + @Test + public void mainJarInExtension() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJnlpJarAndSignedJarExtension.jnlp"); + Assert.assertTrue("Stdout should contain " + jarOutput + " but did not", pr.stdout.contains(jarOutput)); + } + + @Bug(id = "PR1042") + @Test + public void checkingSignedJnlpInExtension() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJnlpExtension.jnlp"); + Assert.assertTrue("Stdout should contain " + signedJnlpException + " but did not", pr.stderr.contains(signedJnlpException)); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJarResource/resources/SignedJarExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +This file is used as an extension jnlp for the launching jnlp's resource - contains +SignedJarResource class within SignedJarResource.jar +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="SignedJarExtension.jnlp" codebase="."> + <information> + <title>SignedJarExtension</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>SignedJarExtension</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJarResource.jar" main="true"/> + </resources> + + <component-desc /> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJarResource/srcs/SignedJarResource.java Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,43 @@ +/* SignedJarResource.java +Copyright (C) 2012 Red Hat, Inc. + +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, version 2. + +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. + */ + +public class SignedJarResource { + + public static void main(String[] args){ + System.out.println("Running SignedJarResource.."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJnlpResource/resources/MatchingSignedJnlpExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +This file is used as an extension jnlp for the launching jnlp's resource - contains main within +SignedJnlpResource.jar which matches the signed jnlp +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="MatchingSignedJnlpExtension.jnlp" codebase="."> + <information> + <title>MATCHES SIGNED JNLP</title> + <vendor>IcedTea</vendor> + <homepage href="MATCHES_SIGNED_JNLP"/> + <description>MATCHES SIGNED JNLP</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpResource.jar" main="true"/> + </resources> + + <component-desc /> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJnlpResource/resources/UnmatchingSignedJnlpExtension.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,62 @@ +<!-- + +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. + +*********************************************************************** +This file is used as an extension jnlp for the launching jnlp's resource - contains main within +SignedJnlpResource.jar which does not match the signed jnlp +*********************************************************************** + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="UnmatchingSignedJnlpExtension.jnlp" codebase="."> + <information> + <title>UnmatchingSignedJnlpExtension</title> + <vendor>IcedTea</vendor> + <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/> + <description>UnmatchingSignedJnlpExtension</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="SignedJnlpResource.jar" main="true"/> + </resources> + + <component-desc /> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJnlpResource/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,58 @@ +<!-- + +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. + + --> +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0" href="*" codebase="*"> + <information> + <title>MATCHES SIGNED JNLP</title> + <vendor>*</vendor> + <homepage href="MATCHES_SIGNED_JNLP"/> + <description>MATCHES SIGNED JNLP</description> + <offline/> + </information> + + <security> + <all-permissions/> + </security> + + <resources> + <j2se version="1.6+"/> + <jar href="*" main="*"/> + </resources> + + <component-desc /> +</jnlp>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/reproducers/signed/SignedJnlpResource/srcs/SignedJnlpResource.java Tue Jul 03 17:00:49 2012 -0400 @@ -0,0 +1,43 @@ +/* SignedJnlpResource..java +Copyright (C) 2012 Red Hat, Inc. + +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, version 2. + +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. + */ + +public class SignedJnlpResource { + + public static void main(String[] args){ + System.out.println("Running SignedJnlpResource..."); + } +}