/hg/release/icedtea-web-1.3: 3 new changesets

ddadacha at icedtea.classpath.org ddadacha at icedtea.classpath.org
Wed Aug 22 12:25:09 PDT 2012


changeset cfad6b012cbf in /hg/release/icedtea-web-1.3
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.3?cmd=changeset;node=cfad6b012cbf
author: Danesh Dadachanji <ddadacha at redhat.com>
date: Wed Aug 08 11:48:06 2012 -0400

	Fix PR955: regression: SweetHome3D fails to run


changeset 2359b7014c64 in /hg/release/icedtea-web-1.3
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.3?cmd=changeset;node=2359b7014c64
author: Jiri Vanek <jvanek at redhat.com>
date: Mon Aug 13 12:49:02 2012 +0200

	Reproducers of PR955


changeset a33517a5a85d in /hg/release/icedtea-web-1.3
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.3?cmd=changeset;node=a33517a5a85d
author: Jiri Vanek <jvanek at redhat.com>
date: Mon Aug 13 15:42:03 2012 +0200

	Fixed wrong call in previous commit which was causing null process name


diffstat:

 ChangeLog                                                                                             |    62 +
 NEWS                                                                                                  |     1 +
 netx/net/sourceforge/jnlp/JNLPFile.java                                                               |   146 +-
 netx/net/sourceforge/jnlp/MissingInformationException.java                                            |    44 +
 netx/net/sourceforge/jnlp/MissingTitleException.java                                                  |    45 +
 netx/net/sourceforge/jnlp/MissingVendorException.java                                                 |    44 +
 netx/net/sourceforge/jnlp/Parser.java                                                                 |    46 +-
 netx/net/sourceforge/jnlp/RequiredElementException.java                                               |    41 +
 netx/net/sourceforge/jnlp/resources/Messages.properties                                               |     7 +-
 tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java                                                |   106 +
 tests/netx/unit/net/sourceforge/jnlp/ParserTest.java                                                  |  1358 ++++++++++
 tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java                                    |     1 -
 tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java |    20 +-
 tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement1.jnlp      |    72 +
 tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement2.jnlp      |    70 +
 tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement3.jnlp      |    69 +
 tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement4.jnlp      |    70 +
 tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement_noLoc.jnlp |    53 +
 tests/reproducers/simple/LocalisedInformationElement/srcs/LocalisedInformationElement.java            |    52 +
 tests/reproducers/simple/LocalisedInformationElement/testcases/LocalisedInformationElementTest.java   |   356 ++
 tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java                                          |    31 +-
 tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java                                       |    32 +-
 tests/test-extensions/net/sourceforge/jnlp/mock/MockJNLPFile.java                                     |    55 +
 23 files changed, 2712 insertions(+), 69 deletions(-)

diffs (truncated from 3184 to 500 lines):

diff -r f9ce023d1bf2 -r a33517a5a85d ChangeLog
--- a/ChangeLog	Tue Aug 21 12:02:00 2012 +0200
+++ b/ChangeLog	Mon Aug 13 15:42:03 2012 +0200
@@ -1,3 +1,65 @@
+2012-08-13  Jiri Vanek  <jvanek at redhat.com>
+
+	* tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java:
+	(executeProcessUponURL)Fixed wrong call in previous commit which was
+	causing null process name.
+	* tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java:
+	Removed unused import.
+
+2012-08-13  Jiri Vanek  <jvanek at redhat.com>
+
+	Reproducers of PR955
+	* tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement1.jnlp:
+	* tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement2.jnlp:
+	* tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement3.jnlp:
+	* tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement4.jnlp:
+	Test jnlp files with various combinations of locales, reproducers of PR955.
+	* tests/reproducers/simple/LocalisedInformationElement/resources/LocalisedInformationElement_noLoc.jnlp
+	Jnlp file with which is not affected by PR955 and is helping to catch error in LOCALE changing hack
+	* tests/reproducers/simple/LocalisedInformationElement/srcs/LocalisedInformationElement.java:
+	Reproducer main class, after loading prints out default locale.
+	* tests/reproducers/simple/LocalisedInformationElement/testcases/LocalisedInformationElementTest.java:
+	Testcases launching above jnlps under various locales.
+	* tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java:
+	Added set of methods allowing passing of custom variables to ThreadedProcess.
+	* tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java:
+	Added processing of custom variables.
+
+2012-08-22  Danesh Dadachanji  <ddadacha at redhat.com>
+
+	Fix PR955: regression: SweetHome3D fails to run
+	* NEWS: Added entry for PR955
+	* netx/net/sourceforge/jnlp/JNLPFile.java: New enum Match that represents
+	the level of precision to use when matching locales.
+	(localMatches): Renamed to localeMatches, added matchLevel paramater
+	and updated conditionals to handle the level of precision specified by it.
+	(getVendor): New method that returns an information's vendor text.
+	(getInformation): Added override methods for getTitle and getVendor
+	that are used by the anonymous class to filter by locale. All three
+	methods now go through all levels of precision to search for the best
+	fitted locale.
+	(getResources), (getResourcesDescs): Updated to check if any level of
+	precision matches when searching for locales.
+	(parse): Added call to checkForTitleVendor.
+	* netx/net/sourceforge/jnlp/Parser.java
+	(checkForTitleVendor): New method to check for availability of localized
+	title and vendor from the information tags. Throws ParseException.
+	(getInfo): Replace loop with foreach loop.
+	(getInformationDesc): Remove check for present title and vendor.
+	(getLocale): Variant returned can now use everything after the eigth
+	element of the locale's string.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties:
+	Update missing title and vendor messages to mention localization.
+	* tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java:
+	Update output string as per new changes to Messages internationalizations.
+	* tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java:
+	New unit test that checks the localesMatches method in JNLPFile.
+	* tests/netx/unit/net/sourceforge/jnlp/MockJNLPFile.java:
+	New class used to create a mock JNLPFile object.
+	* tests/netx/unit/net/sourceforge/jnlp/ParserTest.java:
+	New unit test that checks that the return of getTitle and getVendor
+	have localized information.
+
 2012-08-21  Jiri Vanek  <jvanek at redhat.com>
 
 	* tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java:
diff -r f9ce023d1bf2 -r a33517a5a85d NEWS
--- a/NEWS	Tue Aug 21 12:02:00 2012 +0200
+++ b/NEWS	Mon Aug 13 15:42:03 2012 +0200
@@ -32,6 +32,7 @@
   - RH838417: Disambiguate signed applet security prompt from certificate warning
   - RH838559: Disambiguate signed applet security prompt from certificate warning
   - RH720836: project can be compiled against GTK+ 2 or 3 librarie
+  - PR955: regression: SweetHome3D fails to run
 
 New in release 1.2 (2011-XX-XX):
 * Security updates:
diff -r f9ce023d1bf2 -r a33517a5a85d netx/net/sourceforge/jnlp/JNLPFile.java
--- a/netx/net/sourceforge/jnlp/JNLPFile.java	Tue Aug 21 12:02:00 2012 +0200
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java	Mon Aug 13 15:42:03 2012 +0200
@@ -99,18 +99,18 @@
     /** the security descriptor */
     protected SecurityDesc security;
 
-    /** the default OS */
+    /** the default JVM locale */
     protected Locale defaultLocale = null;
 
-    /** the default arch */
+    /** the default OS */
     protected String defaultOS = null;
 
-    /** the default jvm */
+    /** the default arch */
     protected String defaultArch = null;
-    
+
     /** A signed JNLP file is missing from the main jar */
     private boolean missingSignedJNLP = false;
-    
+
     /** JNLP file contains special properties */
     private boolean containsSpecialProperties = false;
 
@@ -118,7 +118,7 @@
      * List of acceptable properties (not-special)
      */
     private String[] generalProperties = SecurityDesc.getJnlpRIAPermissions();
-    
+
     { // initialize defaults if security allows
         try {
             defaultLocale = Locale.getDefault();
@@ -129,6 +129,8 @@
         }
     }
 
+    static enum Match { LANG_COUNTRY_VARIANT, LANG_COUNTRY, LANG, GENERALIZED }
+
     /**
      * Empty stub, allowing child classes to override the constructor
      */
@@ -185,9 +187,9 @@
      * @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);
+        this(location, version, strict, policy, null);
     }
-    
+
     /**
      * Create a JNLPFile from a URL and a version, checking for updates
      * using the specified policy.
@@ -284,7 +286,7 @@
     }
 
     /**
-     * Returns the JNLP file's title.  This method returns the same
+     * Returns the JNLP file's best localized title. This method returns the same
      * value as InformationDesc.getTitle().
      */
     public String getTitle() {
@@ -292,6 +294,14 @@
     }
 
     /**
+     * Returns the JNLP file's best localized vendor. This method returns the same
+     * value as InformationDesc.getVendor().
+     */
+    public String getVendor() {
+        return getInformation().getVendor();
+    }
+
+    /**
      * Returns the JNLP file's network location as specified in the
      * JNLP file.
      */
@@ -349,17 +359,52 @@
      */
     public InformationDesc getInformation(final Locale locale) {
         return new InformationDesc(this, new Locale[] { locale }) {
+            @Override
             protected List<Object> getItems(Object key) {
                 List<Object> result = new ArrayList<Object>();
 
-                for (int i = 0; i < info.size(); i++) {
-                    InformationDesc infoDesc = info.get(i);
+                for (Match precision : Match.values()) {
+                    for (InformationDesc infoDesc : JNLPFile.this.info) {
+                        if (localeMatches(locale, infoDesc.getLocales(), precision)) {
+                            result.addAll(infoDesc.getItems(key));
+                        }
+                    }
 
-                    if (localMatches(locale, infoDesc.getLocales()))
-                        result.addAll(infoDesc.getItems(key));
+                    if (result.size() > 0) {
+                        return result;
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public String getTitle() {
+                for (Match precision : Match.values()) {
+                    for (InformationDesc infoDesc : JNLPFile.this.info) {
+                        String title = infoDesc.getTitle();
+                        if (localeMatches(locale, infoDesc.getLocales(), precision)
+                                && title != null && !"".equals(title)) {
+                            return title;
+                        }
+                    }
                 }
 
-                return result;
+                return null;
+            }
+
+            @Override
+            public String getVendor() {
+                for (Match precision : Match.values()) {
+                    for (InformationDesc infoDesc : JNLPFile.this.info) {
+                        String vendor = infoDesc.getVendor();
+                        if (localeMatches(locale, infoDesc.getLocales(), precision)
+                                && vendor != null && !"".equals(vendor)) {
+                            return vendor;
+                        }
+                    }
+                }
+
+                return null;
             }
         };
     }
@@ -393,11 +438,17 @@
      */
     public ResourcesDesc getResources(final Locale locale, final String os, final String arch) {
         return new ResourcesDesc(this, new Locale[] { locale }, new String[] { os }, new String[] { arch }) {
+
+            @Override
             public <T> List<T> getResources(Class<T> launchType) {
                 List<T> result = new ArrayList<T>();
 
                 for (ResourcesDesc rescDesc : resources) {
-                    if (localMatches(locale, rescDesc.getLocales())
+                    boolean hasUsableLocale = false;
+                    for (Match match : Match.values()) {
+                        hasUsableLocale |= localeMatches(locale, rescDesc.getLocales(), match);
+                    }
+                    if (hasUsableLocale
                             && stringMatches(os, rescDesc.getOS())
                             && stringMatches(arch, rescDesc.getArch()))
                         result.addAll(rescDesc.getResources(launchType));
@@ -408,6 +459,7 @@
                 return result;
             }
 
+            @Override
             public void addResource(Object resource) {
                 // todo: honor the current locale, os, arch values
                 sharedResources.addResource(resource);
@@ -433,7 +485,11 @@
     public ResourcesDesc[] getResourcesDescs(final Locale locale, final String os, final String arch) {
         List<ResourcesDesc> matchingResources = new ArrayList<ResourcesDesc>();
         for (ResourcesDesc rescDesc: resources) {
-            if (localMatches(locale, rescDesc.getLocales())
+            boolean hasUsableLocale = false;
+            for (Match match : Match.values()) {
+                hasUsableLocale |= localeMatches(locale, rescDesc.getLocales(), match);
+            }
+            if (hasUsableLocale
                     && stringMatches(os, rescDesc.getOS())
                     && stringMatches(arch, rescDesc.getArch())) {
                 matchingResources.add(rescDesc);
@@ -546,28 +602,48 @@
      *
      * @param requested the local
      * @param available the available locales
+     * @param precision the depth with which to match locales. 1 checks only
+     * language, 2 checks language and country, 3 checks language, country and
+     * variant for matches. Passing 0 will always return true.
      * @return true if requested matches any of available, or if
      * available is empty or null.
      */
-    private boolean localMatches(Locale requested, Locale available[]) {
-        if (available == null || available.length == 0)
-            return true;
+    public boolean localeMatches(Locale requested, Locale available[], Match matchLevel) {
 
-        for (int i = 0; i < available.length; i++) {
-            String language = requested.getLanguage(); // "" but never null
-            String country = requested.getCountry();
-            String variant = requested.getVariant();
+        if (matchLevel == Match.GENERALIZED)
+            return available == null || available.length == 0;
 
-            if (!"".equals(language) && !language.equalsIgnoreCase(available[i].getLanguage()))
-                continue;
-            if (!"".equals(country) && !country.equalsIgnoreCase(available[i].getCountry()))
-                continue;
-            if (!"".equals(variant) && !variant.equalsIgnoreCase(available[i].getVariant()))
-                continue;
+        String language = requested.getLanguage(); // "" but never null
+        String country = requested.getCountry();
+        String variant = requested.getVariant();
 
-            return true;
+        for (Locale locale : available) {
+            switch (matchLevel) {
+                case LANG:
+                    if (!language.isEmpty()
+                            && language.equals(locale.getLanguage())
+                            && locale.getCountry().isEmpty()
+                            && locale.getVariant().isEmpty())
+                        return true;
+                    break;
+                case LANG_COUNTRY:
+                    if (!language.isEmpty()
+                            && language.equals(locale.getLanguage())
+                            && !country.isEmpty()
+                            && country.equals(locale.getCountry())
+                            && locale.getVariant().isEmpty())
+                        return true;
+                    break;
+                case LANG_COUNTRY_VARIANT:
+                    if (language.equals(locale.getLanguage())
+                            && country.equals(locale.getCountry())
+                            && variant.equals(locale.getVariant()))
+                        return true;
+                    break;
+                default:
+                    break;
+            }
         }
-
         return false;
     }
 
@@ -612,14 +688,15 @@
             codeBase = parser.getCodeBase();
             sourceLocation = parser.getFileLocation() != null ? parser.getFileLocation() : location;
             info = parser.getInfo(root);
+            parser.checkForInformation();
             update = parser.getUpdate(root);
             resources = parser.getResources(root, false); // false == not a j2se/java resources section
             launchType = parser.getLauncher(root);
             component = parser.getComponent(root);
             security = parser.getSecurity(root);
-            
+
             checkForSpecialProperties();
-            
+
         } catch (ParseException ex) {
             throw ex;
         } catch (Exception ex) {
@@ -729,7 +806,7 @@
     /**
      * Returns a boolean after determining if a signed JNLP warning should be
      * displayed in the 'More Information' panel.
-     * 
+     *
      * @return true if a warning should be displayed; otherwise false
      */
     public boolean requiresSignedJNLPWarning() {
@@ -742,5 +819,4 @@
     public void setSignedJNLPAsMissing() {
         missingSignedJNLP = true;
     }
-
 }
diff -r f9ce023d1bf2 -r a33517a5a85d netx/net/sourceforge/jnlp/MissingInformationException.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/MissingInformationException.java	Mon Aug 13 15:42:03 2012 +0200
@@ -0,0 +1,44 @@
+// Copyright (C) 2012 Red Hat, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+/**
+ * Thrown when the required information tag is not found
+ * under the current JVM's locale or as a generalized element.
+ */
+public class MissingInformationException extends RequiredElementException {
+
+    private static final long serialVersionUID = 1L;
+    private static final String message = R("PNoInfoElement");
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String)
+     */
+    public MissingInformationException() {
+        super(message);
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String, Throwable)
+     */
+    public MissingInformationException(Throwable cause) {
+        super(message, cause);
+    }
+}
diff -r f9ce023d1bf2 -r a33517a5a85d netx/net/sourceforge/jnlp/MissingTitleException.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/MissingTitleException.java	Mon Aug 13 15:42:03 2012 +0200
@@ -0,0 +1,45 @@
+// Copyright (C) 2012 Red Hat, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+/**
+ * Thrown when a title that is required from the information tag is not found
+ * under the current JVM's locale or as a generalized element.
+ */
+public class MissingTitleException extends RequiredElementException {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String message = R("PMissingElement", R("PMissingTitle"));
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String)
+     */
+    public MissingTitleException() {
+        super(message);
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String, Throwable)
+     */
+    public MissingTitleException(Throwable cause) {
+        super(message, cause);
+    }
+}
diff -r f9ce023d1bf2 -r a33517a5a85d netx/net/sourceforge/jnlp/MissingVendorException.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/MissingVendorException.java	Mon Aug 13 15:42:03 2012 +0200
@@ -0,0 +1,44 @@
+// Copyright (C) 2012 Red Hat, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+/**
+ * Thrown when a vendor that is required from the information tag is not found
+ * under the current JVM's locale or as a generalized element.
+ */
+public class MissingVendorException extends RequiredElementException {
+
+    private static final long serialVersionUID = 1L;
+    private static final String message = R("PMissingElement", R("PMissingVendor"));
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String)
+     */
+    public MissingVendorException() {
+        super(message);
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.ParseException(String, Throwable)
+     */
+    public MissingVendorException(Throwable cause) {
+        super(message, cause);
+    }



More information about the distro-pkg-dev mailing list