/hg/icedtea-web: Added tagsup (optional dependence) as sanitizer...

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Fri Jun 21 03:15:10 PDT 2013


changeset a236aa5f729b in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=a236aa5f729b
author: Jiri Vanek <jvanek at redhat.com>
date: Fri Jun 21 12:15:03 2013 +0200

	Added tagsup (optional dependence) as sanitizer for (possibly) invalid xml files


diffstat:

 ChangeLog                                                                           |   30 +
 Makefile.am                                                                         |   31 +-
 NEWS                                                                                |    3 +
 acinclude.m4                                                                        |   25 +
 configure.ac                                                                        |    2 +
 netx/net/sourceforge/jnlp/JNLPCreator.java                                          |    4 +-
 netx/net/sourceforge/jnlp/JNLPFile.java                                             |   72 +-
 netx/net/sourceforge/jnlp/Launcher.java                                             |   10 +-
 netx/net/sourceforge/jnlp/MalformedXMLParser.java                                   |  123 +++++
 netx/net/sourceforge/jnlp/Parser.java                                               |  157 +-----
 netx/net/sourceforge/jnlp/ParserSettings.java                                       |   27 +-
 netx/net/sourceforge/jnlp/PluginBridge.java                                         |    5 +-
 netx/net/sourceforge/jnlp/XmlParser.java                                            |  183 ++++++++
 netx/net/sourceforge/jnlp/resources/Messages.properties                             |    1 +
 netx/net/sourceforge/jnlp/runtime/Boot.java                                         |   14 +-
 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java                              |    7 +-
 tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java                              |    4 +-
 tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java                               |    5 +-
 tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java                         |   76 ++-
 tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java                        |   23 +-
 tests/netx/unit/net/sourceforge/jnlp/ParserTest.java                                |  213 +++++----
 tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java                          |    5 +-
 tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/InformationElementTest.java |   12 +-
 23 files changed, 699 insertions(+), 333 deletions(-)

diffs (truncated from 2122 to 500 lines):

diff -r e09b9813d6de -r a236aa5f729b ChangeLog
--- a/ChangeLog	Thu Jun 20 17:00:52 2013 +0200
+++ b/ChangeLog	Fri Jun 21 12:15:03 2013 +0200
@@ -1,3 +1,33 @@
+2013-06-21  Jiri Vanek <jvanek at redhat.com>
+        Adam Domurad  <adomurad at redhat.com>
+        Omair Majid  <omajid at redhat.com>
+
+	Added tagsup (optional dependence) as sanitizer for (possibly) invalid xml files
+	* Makefile.am: (LAUNCHER_BOOTCLASSPATH) (PLUGIN_BOOTCLASSPATH) (NETX_CLASSPATH_ARG)
+	(PLUGIN_COVERAGE_BOOTCLASSPATH)	enriched for TAGSOUP_JAR
+	* acinclude.m4: (IT_CHECK_FOR_TAGSOUP) new macro
+	* configure.ac: used  this new macro
+	* tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java:
+	* netx/net/sourceforge/jnlp/JNLPCreator.java: (create)
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
+	* /netx/net/sourceforge/jnlp/JNLPFile.java:  (JNLPFile) construcotrs
+	* netx/net/sourceforge/jnlp/PluginBridge.java
+	* netx/net/sourceforge/jnlp/Launcher.java: (main)
+	all adapted to take ParserSettings instead of individual parameters
+	* netx/net/sourceforge/jnlp/MalformedXMLParser.java: new file, bridge
+	between tagsoup and our parser
+	* netx/net/sourceforge/jnlp/XmlParser.java: new file, bridge to old parser
+	* netx/net/sourceforge/jnlp/Parser.java: refactored to be able both with
+	* netx/net/sourceforge/jnlp/ParserSettings.java: reworked to serve as 
+	gatherer for various individual parser flags
+	* netx/net/sourceforge/jnlp/resources/Messages.propertie: (BOXml)
+	new key describing -xml  switch
+	* tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java:
+	* tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java:
+	* tests/netx/unit/net/sourceforge/jnlp/ParserTest.java:
+	Tests adapted to newest state (both for included/excluded tagsoup) and
+	new (testTagNotClosedNoTagSoup) (testUnquotedAttributesNoTagSoup)
+
 2013-06-20  Jiri Vanek <jvanek at redhat.com>
 
 	Removed out-of date support for jdk 1.5  and older
diff -r e09b9813d6de -r a236aa5f729b Makefile.am
--- a/Makefile.am	Thu Jun 20 17:00:52 2013 +0200
+++ b/Makefile.am	Fri Jun 21 12:15:03 2013 +0200
@@ -119,9 +119,9 @@
 #    IllegalAccessException
 #  - we want full privileges
 #
-export LAUNCHER_BOOTCLASSPATH="-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar$(RHINO_RUNTIME)"
-export PLUGIN_BOOTCLASSPATH='"-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar:$(datadir)/$(PACKAGE_NAME)/plugin.jar$(RHINO_RUNTIME)"'
-export PLUGIN_COVERAGE_BOOTCLASSPATH='"-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar:$(datadir)/$(PACKAGE_NAME)/plugin.jar$(RHINO_RUNTIME):$(JACOCO_CLASSPATH)"'
+export LAUNCHER_BOOTCLASSPATH="-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar$(RHINO_RUNTIME):$(TAGSOUP_JAR)"
+export PLUGIN_BOOTCLASSPATH='"-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar:$(datadir)/$(PACKAGE_NAME)/plugin.jar$(RHINO_RUNTIME):$(TAGSOUP_JAR)"'
+export PLUGIN_COVERAGE_BOOTCLASSPATH='"-Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar:$(datadir)/$(PACKAGE_NAME)/plugin.jar$(RHINO_RUNTIME):$(JACOCO_CLASSPATH):$(TAGSOUP_JAR)"'
 
 # Fake update version to work with the Deployment Toolkit script used by Oracle
 # http://download.oracle.com/javase/tutorial/deployment/deploymentInDepth/depltoolkit_index.html
@@ -138,7 +138,15 @@
 	net.sourceforge.jnlp.security.viewer net.sourceforge.jnlp.services \
 	net.sourceforge.jnlp.tools net.sourceforge.jnlp.util
 
+NETX_EXCLUDE_SRCS=
+
 # Conditional defintions
+if HAVE_TAGSOUP
+NETX_CLASSPATH_ARG=-classpath $(TAGSOUP_JAR)
+else
+NETX_EXCLUDE_SRCS+=net.sourceforge.jnlp.MalformedXMLParser.java
+endif
+
 if ENABLE_PLUGIN
 export ICEDTEAPLUGIN_CLEAN = clean-IcedTeaPlugin
 export LIVECONNECT_DIR = netscape sun/applet
@@ -415,6 +423,7 @@
 	  $(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \
 	      -d $(abs_top_builddir)/liveconnect \
 	      -bootclasspath $(NETX_DIR):$(RUNTIME) \
+	      $(NETX_CLASSPATH_ARG) \
 	      -sourcepath $(LIVECONNECT_SRCS) \
 	      @liveconnect-source-files.txt ; \
 	fi
@@ -445,7 +454,11 @@
 # a patch applied to sun.plugin.AppletViewerPanel and generated sources
 
 netx-source-files.txt:
-	find $(NETX_SRCDIR) -name '*.java' | sort > $@
+	find $(NETX_SRCDIR) -name '*.java' | sort > $@ ; \
+	for src in $(NETX_EXCLUDE_SRCS) ; \
+	do \
+	  sed -i "/$${src}/ d" $@ ; \
+	done
 if !WITH_RHINO
 	sed -i '/RhinoBasedPacEvaluator/ d' $@
 endif
@@ -459,6 +472,7 @@
 	    -d $(NETX_DIR) \
 	    -sourcepath $(NETX_SRCDIR) \
 	    -bootclasspath $(RUNTIME) \
+	    $(NETX_CLASSPATH_ARG) \
 	    @netx-source-files.txt
 	(cd $(NETX_RESOURCE_DIR); \
 	 for files in $$(find . -type f); \
@@ -1006,7 +1020,7 @@
 	mkdir -p $(NETX_UNIT_TEST_DIR) && \
 	$(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \
 	 -d $(NETX_UNIT_TEST_DIR) \
-	 -classpath $(JUNIT_JAR):$(abs_top_builddir)/liveconnect/lib/classes.jar:$(NETX_DIR)/lib/classes.jar:$(TEST_EXTENSIONS_DIR) \
+	 -classpath $(JUNIT_JAR):$(abs_top_builddir)/liveconnect/lib/classes.jar:$(NETX_DIR)/lib/classes.jar:$(TEST_EXTENSIONS_DIR):$(TAGSOUP_JAR) \
 	 @netx-unit-tests-source-files.txt && \
 	mkdir -p stamps && \
 	touch $@
@@ -1036,7 +1050,7 @@
 	done ; \
 	cd $(NETX_UNIT_TEST_DIR) ; \
 	class_names=`cat $(UNIT_CLASS_NAMES)` ; \
-	CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(abs_top_builddir)/liveconnect/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):$(TEST_EXTENSIONS_DIR):.:$(TEST_EXTENSIONS_SRCDIR) \
+	CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(abs_top_builddir)/liveconnect/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):$(TEST_EXTENSIONS_DIR):.:$(TEST_EXTENSIONS_SRCDIR):$(TAGSOUP_JAR) \
 	  $(BOOT_DIR)/bin/java -Xbootclasspath:$(RUNTIME) CommandLine $$class_names 
 if WITH_XSLTPROC
 	-$(XSLTPROC) --stringparam logs logs_unit.html $(TESTS_SRCDIR)/$(REPORT_STYLES_DIRNAME)/jreport.xsl $(NETX_UNIT_TEST_DIR)/tests-output.xml > $(TESTS_DIR)/index_unit.html
@@ -1073,6 +1087,9 @@
 	 -cp $(RHINO_RUNTIME) \
 	 -cp $(TEST_EXTENSIONS_DIR) \
 	 -cp $(TEST_EXTENSIONS_SRCDIR) \
+if HAVE_TAGSOUP
+	 -cp $(TAGSOUP_JAR) \
+endif
 	 -cp . \
 	 -ix "-org.junit.*" \
 	 -ix "-junit.*" \
@@ -1117,7 +1134,7 @@
 	  mv $(NETX_UNIT_TEST_DIR)/$$file  $(NETX_UNIT_TEST_DIR)/"$$file""$(EMMA_BACKUP_SUFFIX)" ; \
 	done ;\
 	class_names=`cat $(UNIT_CLASS_NAMES)` ; \
-	CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(abs_top_builddir)/liveconnect/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):$(TEST_EXTENSIONS_DIR):$(JACOCO_CLASSPATH):.:$(TEST_EXTENSIONS_SRCDIR)  \
+	CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(abs_top_builddir)/liveconnect/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):$(TEST_EXTENSIONS_DIR):$(JACOCO_CLASSPATH):.:$(TEST_EXTENSIONS_SRCDIR):$(TAGSOUP_JAR)  \
 	  $(BOOT_DIR)/bin/java $(JACOCO_AGENT_SWITCH) -Xbootclasspath:$(RUNTIME)  CommandLine $$class_names ; \
 	for file in $(EMMA_MODIFIED_FILES) ; do \
 	  mv $(NETX_UNIT_TEST_DIR)/$$file  $(NETX_UNIT_TEST_DIR)/"$$file""$(EMMA_SUFFIX)" ; \
diff -r e09b9813d6de -r a236aa5f729b NEWS
--- a/NEWS	Thu Jun 20 17:00:52 2013 +0200
+++ b/NEWS	Fri Jun 21 12:15:03 2013 +0200
@@ -9,9 +9,12 @@
 CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY
 
 New in release 1.5 (2013-XX-XX):
+* IcedTea-Web now using tagsoup as default (tagsoup dependence) sanitizer for input
 * JDK older then 1.5 no longer supported
 * NetX
   - PR1465 - java.io.FileNotFoundException while trying to download a JAR file
+  - Netx can now parse malformed jnlp files using tagsoup
+  - PR1026 - Apps fail to run because of the nanoxml parser's strict XML validation
 * Plugin
   - PR854: Resizing an applet several times causes 100% CPU load
 
diff -r e09b9813d6de -r a236aa5f729b acinclude.m4
--- a/acinclude.m4	Thu Jun 20 17:00:52 2013 +0200
+++ b/acinclude.m4	Fri Jun 21 12:15:03 2013 +0200
@@ -403,6 +403,31 @@
 fi
 ])
 
+AC_DEFUN_ONCE([IT_CHECK_FOR_TAGSOUP],
+[
+  AC_MSG_CHECKING([for tagsoup])
+  AC_ARG_WITH([tagsoup],
+             [AS_HELP_STRING([--with-tagsoup],
+                             [tagsoup.jar])],
+             [
+                TAGSOUP_JAR=${withval}
+             ],
+             [
+                TAGSOUP_JAR=
+             ])
+  if test -z "${TAGSOUP_JAR}"; then
+    for dir in /usr/share/java /usr/local/share/java ; do
+      if test -f $dir/tagsoup.jar; then
+        TAGSOUP_JAR=$dir/tagsoup.jar
+	    break
+      fi
+    done
+  fi
+  AC_MSG_RESULT(${TAGSOUP_JAR})
+  AC_SUBST(TAGSOUP_JAR)
+  AM_CONDITIONAL([HAVE_TAGSOUP], [test x$TAGSOUP_JAR != xno])
+])
+
 dnl Generic macro to check for a Java class
 dnl Takes the name of the class as an argument.  The macro name
 dnl is usually the name of the class with '.'
diff -r e09b9813d6de -r a236aa5f729b configure.ac
--- a/configure.ac	Thu Jun 20 17:00:52 2013 +0200
+++ b/configure.ac	Fri Jun 21 12:15:03 2013 +0200
@@ -111,6 +111,8 @@
 IT_FIND_OPTIONAL_JAR([asm], ASM,
     [/usr/share/java/objectweb-asm4/asm-all.jar /usr/share/java/objectweb-asm4/asm-all-4.0.jar /usr/share/java/objectweb-asm/asm-all.jar])
 
+IT_CHECK_FOR_TAGSOUP
+
 AC_CONFIG_FILES([jrunscript], [chmod u+x jrunscript])
 AC_CONFIG_FILES([build.properties])
 
diff -r e09b9813d6de -r a236aa5f729b netx/net/sourceforge/jnlp/JNLPCreator.java
--- a/netx/net/sourceforge/jnlp/JNLPCreator.java	Thu Jun 20 17:00:52 2013 +0200
+++ b/netx/net/sourceforge/jnlp/JNLPCreator.java	Fri Jun 21 12:15:03 2013 +0200
@@ -28,8 +28,8 @@
 import net.sourceforge.jnlp.cache.UpdatePolicy;
 
 public class JNLPCreator {
-    public JNLPFile create(URL location, Version version, boolean strict,
+    public JNLPFile create(URL location, Version version, ParserSettings settings,
             UpdatePolicy policy, URL forceCodebase) throws IOException, ParseException {
-        return new JNLPFile(location, version, strict, policy, forceCodebase);
+        return new JNLPFile(location, version, settings, policy, forceCodebase);
     }
 }
diff -r e09b9813d6de -r a236aa5f729b netx/net/sourceforge/jnlp/JNLPFile.java
--- a/netx/net/sourceforge/jnlp/JNLPFile.java	Thu Jun 20 17:00:52 2013 +0200
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java	Fri Jun 21 12:15:03 2013 +0200
@@ -67,6 +67,9 @@
     /** the network location of this JNLP file */
     protected URL fileLocation;
 
+    /** the ParserSettings which were used to parse this file */
+    protected ParserSettings parserSettings = null;
+
     /** A key that uniquely identifies connected instances (main jnlp+ext) */
     protected String uniqueKey = null;
 
@@ -145,7 +148,7 @@
      * @throws ParseException if the JNLP file was invalid
      */
     public JNLPFile(URL location) throws IOException, ParseException {
-        this(location, false); // not strict
+        this(location, new ParserSettings());
     }
 
     /**
@@ -153,12 +156,12 @@
      * default policy.
      *
      * @param location the location of the JNLP file
-     * @param strict whether to enforce the spec when
+     * @param settings the parser settings to use while parsing the file
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, boolean strict) throws IOException, ParseException {
-        this(location, (Version) null, strict);
+    public JNLPFile(URL location, ParserSettings settings) throws IOException, ParseException {
+        this(location, (Version) null, settings);
     }
 
     /**
@@ -167,12 +170,12 @@
      *
      * @param location the location of the JNLP file
      * @param version the version of the JNLP file
-     * @param strict whether to enforce the spec when
+     * @param settings the parser settings to use while parsing the file
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, Version version, boolean strict) throws IOException, ParseException {
-        this(location, version, strict, JNLPRuntime.getDefaultUpdatePolicy());
+    public JNLPFile(URL location, Version version, ParserSettings settings) throws IOException, ParseException {
+        this(location, version, settings, JNLPRuntime.getDefaultUpdatePolicy());
     }
 
     /**
@@ -186,8 +189,8 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        this(location, version, strict, policy, null);
+    public JNLPFile(URL location, Version version, ParserSettings settings, UpdatePolicy policy) throws IOException, ParseException {
+	this(location, version, settings, policy, null);
     }
 
     /**
@@ -196,15 +199,16 @@
      *
      * @param location the location of the JNLP file
      * @param version the version of the JNLP file
-     * @param strict whether to enforce the spec when
+     * @param settings the parser settings to use while parsing the file
      * @param policy the update policy
      * @param forceCodebase codebase to use if not specified in JNLP file.
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    protected JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy, URL forceCodebase) throws IOException, ParseException {
-        Node root = Parser.getRootNode(openURL(location, version, policy));
-        parse(root, strict, location, forceCodebase);
+    protected JNLPFile(URL location, Version version, ParserSettings settings, UpdatePolicy policy, URL forceCodebase) throws IOException, ParseException {
+        InputStream input = openURL(location, version, policy);
+        this.parserSettings = settings;
+        parse(input, location, forceCodebase);
 
         //Downloads the original jnlp file into the cache if possible
         //(i.e. If the jnlp file being launched exist locally, but it
@@ -231,13 +235,13 @@
      * @param location the location of the JNLP file
      * @param uniqueKey A string that uniquely identifies connected instances
      * @param version the version of the JNLP file
-     * @param strict whether to enforce the spec when
+     * @param settings the parser settings to use while parsing the file
      * @param policy the update policy
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, String uniqueKey, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        this(location, version, strict, policy);
+    public JNLPFile(URL location, String uniqueKey, Version version, ParserSettings settings, UpdatePolicy policy) throws IOException, ParseException {
+        this(location, version, settings, policy);
         this.uniqueKey = uniqueKey;
 
         if (JNLPRuntime.isDebug())
@@ -250,8 +254,9 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(InputStream input, boolean strict) throws ParseException {
-        this(input, null, strict);
+    public JNLPFile(InputStream input, ParserSettings settings) throws ParseException {
+        this.parserSettings = settings;
+        parse(input, null, null);
     }
 
     /**
@@ -263,22 +268,11 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(InputStream input, URL codebase, boolean strict) throws ParseException {
-        parse(Parser.getRootNode(input), strict, null, codebase);
+    public JNLPFile(InputStream input, URL codebase, ParserSettings settings) throws ParseException {
+        this.parserSettings = settings;
+        parse(input, null, codebase);
     }
 
-    /**
-     * Create a JNLPFile from a character stream.
-     *
-     * @param input the stream
-     * @param strict whether to enforce the spec when
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    private JNLPFile(Reader input, boolean strict) throws ParseException {
-        // todo: now that we are using NanoXML we can use a Reader
-        //parse(Parser.getRootNode(input), strict, null);
-    }
 
     /**
      * Open the jnlp file URL from the cache if there, otherwise
@@ -338,6 +332,13 @@
     }
 
     /**
+     * Returns the ParserSettings that was used to parse this file
+     */
+    public ParserSettings getParserSettings() {
+        return parserSettings;
+    }
+
+    /**
      * Returns the JNLP file's version.
      */
     public Version getFileVersion() {
@@ -685,15 +686,16 @@
      * from the constructor.
      *
      * @param root the root node
-     * @param strict whether to enforce the spec when
+     * @param settings the parser settings to use while parsing the file
      * @param location the file location or null
      */
-    private void parse(Node root, boolean strict, URL location, URL forceCodebase) throws ParseException {
+    private void parse(InputStream input, URL location, URL forceCodebase) throws ParseException {
         try {
             //if (location != null)
             //  location = new URL(location, "."); // remove filename
 
-            Parser parser = new Parser(this, location, root, strict, true, forceCodebase); // true == allow extensions
+            Node root = Parser.getRootNode(input, parserSettings);
+            Parser parser = new Parser(this, location, root, parserSettings, forceCodebase); // true == allow extensions
 
             // JNLP tag information
             specVersion = parser.getSpecVersion();
diff -r e09b9813d6de -r a236aa5f729b netx/net/sourceforge/jnlp/Launcher.java
--- a/netx/net/sourceforge/jnlp/Launcher.java	Thu Jun 20 17:00:52 2013 +0200
+++ b/netx/net/sourceforge/jnlp/Launcher.java	Fri Jun 21 12:15:03 2013 +0200
@@ -477,12 +477,12 @@
         try {
             JNLPFile file = null;
 
-            file = new JNLPFile(location, parserSettings.isStrict());
+            file = new JNLPFile(location, parserSettings);
 
             if (fromSource) {
                 // Launches the jnlp file where this file originated.
                 if (file.getSourceLocation() != null) {
-                    file = new JNLPFile(file.getSourceLocation(), parserSettings.isStrict());
+                    file = new JNLPFile(file.getSourceLocation(), parserSettings);
                 }
             }
             return file;
@@ -504,9 +504,11 @@
             JNLPFile file = null;
 
             try {
-                file = new JNLPFile(location, (Version) null, true, updatePolicy); // strict
+                ParserSettings settings = new ParserSettings(true, true, false);
+                file = new JNLPFile(location, (Version) null, settings, updatePolicy); // strict
             } catch (ParseException ex) {
-                file = new JNLPFile(location, (Version) null, false, updatePolicy);
+                ParserSettings settings = new ParserSettings(false, true, true);
+                file = new JNLPFile(location, (Version) null, settings, updatePolicy);
 
                 // only here if strict failed but lax did not fail
                 LaunchException lex =
diff -r e09b9813d6de -r a236aa5f729b netx/net/sourceforge/jnlp/MalformedXMLParser.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/MalformedXMLParser.java	Fri Jun 21 12:15:03 2013 +0200
@@ -0,0 +1,123 @@
+/*
+   Copyright (C) 2013 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.
+ */
+package net.sourceforge.jnlp;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+import org.ccil.cowan.tagsoup.HTMLSchema;
+import org.ccil.cowan.tagsoup.Parser;
+import org.ccil.cowan.tagsoup.XMLWriter;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * An specialized {@link XMLParser} that uses TagSoup[1] to parse
+ * malformed XML
+ *
+ * Used by net.sourceforge.jnlp.Parser
+ *
+ * [1] http://home.ccil.org/~cowan/XML/tagsoup/
+ */
+public class MalformedXMLParser extends XMLParser {
+
+    /**
+     * Parses the data from an {@link InputStream} to create a XML tree.
+     * Returns a {@link Node} representing the root of the tree.
+     *
+     * @param input the {@link InputStream} to read data from
+     * @throws ParseException if an exception occurs while parsing the input
+     */
+    @Override
+    public Node getRootNode(InputStream input) throws ParseException {
+        if (JNLPRuntime.isDebug()) {
+            System.out.println("Using MalformedXMLParser");



More information about the distro-pkg-dev mailing list