aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog25
-rw-r--r--Makefile.am4
-rw-r--r--NEWS1
-rw-r--r--netx/net/sourceforge/jnlp/PluginBridge.java72
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java13
-rw-r--r--tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html42
-rw-r--r--tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java58
-rw-r--r--tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile18
-rw-r--r--tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java61
9 files changed, 269 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index d7f5428..058aeae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2012-05-29 Adam Domurad <[email protected]>
+
+ Allow for folders in archive tag.
+ * netx/net/sourceforge/jnlp/PluginBridge.java:
+ (PluginBridge) Changes jar -> archive, parse contents with
+ addArchiveEntries.
+ (addArchiveEntries) New method. Adds entries ending with / to the list
+ of folders.
+ (getCodeBaseFolders) Returns the folders collected by addArchiveEntries
+ * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
+ (initializeResources) If ran as plugin, add archive tag folders to the
+ code base loader.
+
+2012-06-27 Adam Domurad <[email protected]>
+
+ Tests folders in archive tag
+ * tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java:
+ Runs html file in browser
+ * tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile:
+ packages compiled source files in folder
+ * tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java:
+ Simple output to confirm it is running
+ * tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html:
+ Has folder in its archive tag that contains a class file
+
2012-06-26 Jiri Vanek <[email protected]>
Added slipped midori and epiphany to recognized browsers.
diff --git a/Makefile.am b/Makefile.am
index 90af9bd..89131ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -155,6 +155,10 @@ export DBROWSERS=-Dused.browsers=$(FIREFOX):$(CHROMIUM):$(CHROME):$(OPERA):$(MID
export REPRODUCERS_DPARAMETERS= $(DTEST_SERVER) $(DJAVAWS_BUILD) $(DBROWSERS) $(BROWSER_TESTS_MODIFICATION)
# end of `D`shortcuts
+#exported autoconf copies
+export EXPORTED_JAVAC=$(BOOT_DIR)/bin/javac
+#end of exported autoconf copies
+
# binary names
javaws:= $(shell echo javaws | sed '@program_transform_name@')
itweb_settings:= $(shell echo itweb-settings | sed '@program_transform_name@')
diff --git a/NEWS b/NEWS
index ab5bc8e..c85aea5 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ New in release 1.3 (2012-XX-XX):
- PR518: NPString.utf8characters not guaranteed to be nul-terminated
- PR722: META-INF/ unsigned entries should be ignored in signing
- PR855: AppletStub getDocumentBase() doesn't return full URL
+ - PR1011: Folders treated as jar files in archive tag
* Common
- PR918: java applet windows uses a low resulution black/white icon
diff --git a/netx/net/sourceforge/jnlp/PluginBridge.java b/netx/net/sourceforge/jnlp/PluginBridge.java
index 87f9f06..188a70d 100644
--- a/netx/net/sourceforge/jnlp/PluginBridge.java
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java
@@ -22,15 +22,15 @@
package net.sourceforge.jnlp;
+import java.io.File;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Locale;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
+import java.util.Set;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
@@ -40,11 +40,13 @@ import net.sourceforge.jnlp.runtime.JNLPRuntime;
*/
public class PluginBridge extends JNLPFile {
- String name;
- HashSet<String> jars = new HashSet<String>();
- String[] cacheJars = new String[0];
- String[] cacheExJars = new String[0];
- Hashtable<String, String> atts;
+ private String name;
+ private Set<String> jars = new HashSet<String>();
+ //Folders can be added to the code-base through the archive tag
+ private List<String> codeBaseFolders = new ArrayList<String>();
+ private String[] cacheJars = new String[0];
+ private String[] cacheExJars = new String[0];
+ private Map<String, String> atts;
private boolean usePack;
private boolean useVersion;
private boolean codeBaseLookup;
@@ -54,14 +56,32 @@ public class PluginBridge extends JNLPFile {
* Creates a new PluginBridge using a default JNLPCreator.
*/
public PluginBridge(URL codebase, URL documentBase, String jar, String main,
- int width, int height, Hashtable<String, String> atts,
+ int width, int height, Map<String, String> atts,
String uKey)
throws Exception {
this(codebase, documentBase, jar, main, width, height, atts, uKey, new JNLPCreator());
}
- public PluginBridge(URL codebase, URL documentBase, String jar, String main,
- int width, int height, Hashtable<String, String> atts,
+ /**
+ * Handles archive tag entries, which may be folders or jar files
+ * @param archives the components of the archive tag
+ */
+ private void addArchiveEntries(String[] archives) {
+ for (String archiveEntry : archives){
+ // trim white spaces
+ archiveEntry = archiveEntry.trim();
+
+ /*Only '/' on linux, '/' or '\\' on windows*/
+ if (archiveEntry.endsWith("/") || archiveEntry.endsWith(File.pathSeparator)) {
+ this.codeBaseFolders.add(archiveEntry);
+ } else {
+ this.jars.add(archiveEntry);
+ }
+ }
+ }
+
+ public PluginBridge(URL codebase, URL documentBase, String archive, String main,
+ int width, int height, Map<String, String> atts,
String uKey, JNLPCreator jnlpCreator)
throws Exception {
specVersion = new Version("1.0");
@@ -131,19 +151,14 @@ public class PluginBridge extends JNLPFile {
cacheExJars = cacheArchiveEx.split(",");
}
- if (jar != null && jar.length() > 0) {
- String[] jars = jar.split(",");
+ if (archive != null && archive.length() > 0) {
+ String[] archives = archive.split(",");
- // trim white spaces
- for (int i = 0; i < jars.length; i++) {
- String jarName = jars[i].trim();
- if (jarName.length() > 0)
- this.jars.add(jarName);
- }
+ addArchiveEntries(archives);
if (JNLPRuntime.isDebug()) {
- System.err.println("Jar string: " + jar);
- System.err.println("jars length: " + jars.length);
+ System.err.println("Jar string: " + archive);
+ System.err.println("jars length: " + archives.length);
}
}
@@ -232,9 +247,9 @@ public class PluginBridge extends JNLPFile {
if (cacheOption != null && cacheOption.equalsIgnoreCase("no"))
cacheable = false;
- for (int i = 0; i < cacheJars.length; i++) {
+ for (String cacheJar : cacheJars) {
- String[] jarAndVer = cacheJars[i].split(";");
+ String[] jarAndVer = cacheJar.split(";");
String jar = jarAndVer[0];
Version version = null;
@@ -250,12 +265,12 @@ public class PluginBridge extends JNLPFile {
version, null, false, true, false, cacheable));
}
- for (int i = 0; i < cacheExJars.length; i++) {
+ for (String cacheExJar : cacheExJars) {
- if (cacheExJars[i].length() == 0)
+ if (cacheExJar.length() == 0)
continue;
- String[] jarInfo = cacheExJars[i].split(";");
+ String[] jarInfo = cacheExJar.split(";");
String jar = jarInfo[0].trim();
Version version = null;
@@ -305,6 +320,13 @@ public class PluginBridge extends JNLPFile {
}
/**
+ * Returns the list of folders to be added to the codebase
+ */
+ public List<String> getCodeBaseFolders() {
+ return new ArrayList<String>(codeBaseFolders);
+ }
+
+ /**
* Returns the resources section of the JNLP file for the
* specified locale, os, and arch.
*/
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index 78dc30d..e487cb6 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -443,6 +443,19 @@ public class JNLPClassLoader extends URLClassLoader {
* ResourceTracker for downloading.
*/
void initializeResources() throws LaunchException {
+ if (file instanceof PluginBridge){
+ PluginBridge bridge = (PluginBridge)file;
+
+ for (String codeBaseFolder : bridge.getCodeBaseFolders()){
+ try {
+ addToCodeBaseLoader(new URL(file.getCodeBase(), codeBaseFolder));
+ } catch (MalformedURLException mfe) {
+ System.err.println("Problem trying to add folder to code base:");
+ System.err.println(mfe.getMessage());
+ }
+ }
+ }
+
JARDesc jars[] = resources.getJARs();
if (jars == null || jars.length == 0)
return;
diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html
new file mode 100644
index 0000000..88b8d99
--- /dev/null
+++ b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html
@@ -0,0 +1,42 @@
+<!--
+
+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.
+
+ -->
+<html><head></head><body bgcolor="blue">
+<p><applet code="AppletFolderInArchiveTag.class" archive="archive_tag_folder_test/">
+</applet></p>
+</body>
+</html>
diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java
new file mode 100644
index 0000000..0440500
--- /dev/null
+++ b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java
@@ -0,0 +1,58 @@
+import java.applet.Applet;
+
+/*
+Copyright (C) 2011 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 AppletFolderInArchiveTag extends Applet {
+
+ private static class Killer extends Thread {
+ @Override
+ public void run() {
+ try {
+ int n = 2000;
+ Thread.sleep(n);
+ System.exit(0);
+ } catch (Exception ex) {
+ }
+ }
+ }
+
+ @Override
+ public void init() {
+ new Killer().start();
+ System.out.println("This was ran from a folder specified in the archive tag.");
+ }
+}
diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile
new file mode 100644
index 0000000..aa7f7fe
--- /dev/null
+++ b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile
@@ -0,0 +1,18 @@
+TESTNAME=AppletFolderInArchiveTag
+ARCHIVE_TEST_FOLDER=archive_tag_folder_test
+JAVAC_CLASSPATH=$(JNLP_TESTS_ENGINE_DIR):$(NETX_DIR)/lib/classes.jar
+DEPLOY_SUBDIR=$(JNLP_TESTS_SERVER_DEPLOYDIR)/$(ARCHIVE_TEST_FOLDER)
+INDEX_HTML_BODY="<html><body><h1>Required to recognize folder structure</h1></body></html>"
+
+prepare-reproducer:
+ echo PREPARING REPRODUCER $(TESTNAME)
+ mkdir -p $(DEPLOY_SUBDIR)
+ echo INDEX_HTML_BODY > $(DEPLOY_SUBDIR)/index.html
+ $(EXPORTED_JAVAC) -classpath $(JAVAC_CLASSPATH) -d $(DEPLOY_SUBDIR) $(TESTNAME).java
+ echo PREPARED REPRODUCER $(TESTNAME)
+
+clean-reproducer:
+ echo CLEANING REPRODUCER $(TESTNAME)
+ rm -rf $(DEPLOY_SUBDIR)
+ echo CLEANED REPRODUCER $(TESTNAME)
+
diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java
new file mode 100644
index 0000000..63e8d7c
--- /dev/null
+++ b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java
@@ -0,0 +1,61 @@
+/* AppletFolderInArchiveTagTests.java
+Copyright (C) 2011 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 net.sourceforge.jnlp.ServerAccess.ProcessResult;
+import net.sourceforge.jnlp.annotations.Bug;
+import net.sourceforge.jnlp.annotations.NeedsDisplay;
+import net.sourceforge.jnlp.annotations.TestInBrowsers;
+import net.sourceforge.jnlp.browsertesting.BrowserTest;
+import net.sourceforge.jnlp.browsertesting.Browsers;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AppletFolderInArchiveTagTests extends BrowserTest{
+
+
+ @NeedsDisplay
+ @Test
+ @TestInBrowsers(testIn={Browsers.all})
+ @Bug(id="PR1011")
+ public void testClassInAppletFolder() throws Exception {
+ ProcessResult pr = server.executeBrowser("/AppletFolderInArchiveTag.html");
+
+ String s0 = "This was ran from a folder specified in the archive tag.";
+ Assert.assertTrue("Expected '"+s0+"', stdout was: " + pr.stdout, pr.stdout.contains(s0));
+ }
+} \ No newline at end of file