[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    /hg/icedtea-web: 2 new changesets
From:       omajid () icedtea ! classpath ! org
Date:       2013-08-30 15:04:35
Message-ID: hg.5e59e92d16ed.1377875075.8643924302249223276 () icedtea ! classpath ! org
[Download RAW message or body]

changeset 5e59e92d16ed in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=5e59e92d16ed
author: Omair Majid <omajid@redhat.com>
date: Fri Aug 30 10:56:59 2013 -0400

	PR1058: XFileOpenService openMultiFileDialog ClassCastException

	Instead of trying to create a privileged proxy for the FileContents[]
	array, simply create a privileged proxy for each FileContents instance
	and return an array of them.

	2013-08-29  Omair Majid  <omajid@redhat.com>

	        PR1058
	        * netx/net/sourceforge/jnlp/services/XFileOpenService.java
	        (openMultiFileDialog): Create a privileged proxy for each FileContents
	        instance and return an array of them.


changeset 79bdc074df81 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=79bdc074df81
author: Omair Majid <omajid@redhat.com>
date: Fri Aug 30 11:02:08 2013 -0400

	Test case for PR1533

	Add a unit test that checks the behaviour of JNLPFile when combining
	and filtering properties.

	2013-08-29  Omair Majid  <omajid@redhat.com>

	        * tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java
	        (testPropertyRestrictions): New method. Check that properties in
	        resources are are combined and filtered as approp


diffstat:

 ChangeLog                                                |  13 +++
 netx/net/sourceforge/jnlp/services/XFileOpenService.java |  11 +-
 tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java   |  60 ++++++++++++++++
 3 files changed, 79 insertions(+), 5 deletions(-)

diffs (116 lines):

diff -r 420d72e5cee7 -r 79bdc074df81 ChangeLog
--- a/ChangeLog	Tue Aug 27 16:53:30 2013 -0400
+++ b/ChangeLog	Fri Aug 30 11:02:08 2013 -0400
@@ -1,3 +1,16 @@
+2013-08-29  Omair Majid  <omajid@redhat.com>
+
+	* tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java
+	(testPropertyRestrictions): New method. Check that properties in
+	resources are are combined and filtered as appropriate.
+
+2013-08-29  Omair Majid  <omajid@redhat.com>
+
+	PR1058
+	* netx/net/sourceforge/jnlp/services/XFileOpenService.java
+	(openMultiFileDialog): Create a privileged proxy for each FileContents
+	instance and return an array of them.
+
 2013-08-27  Adam Domurad  <adomurad@redhat.com>
 
 	Do not wait for applet initialization when binding Java applets for NPAPI.
diff -r 420d72e5cee7 -r 79bdc074df81 \
                netx/net/sourceforge/jnlp/services/XFileOpenService.java
--- a/netx/net/sourceforge/jnlp/services/XFileOpenService.java	Tue Aug 27 16:53:30 \
                2013 -0400
+++ b/netx/net/sourceforge/jnlp/services/XFileOpenService.java	Fri Aug 30 11:02:08 \
2013 -0400 @@ -91,11 +91,12 @@
             if (chosen == JFileChooser.APPROVE_OPTION) {
                 File[] files = chooser.getSelectedFiles();
                 int length = files.length;
-                XFileContents[] xfiles = new XFileContents[length];
-                for (int i = 0; i < length; i++)
-                    xfiles[i] = new XFileContents(files[i]);
-                return (FileContents[]) ServiceUtil.createPrivilegedProxy(
-                           FileContents.class, xfiles);
+                FileContents[] result = new FileContents[length];
+                for (int i = 0; i < length; i++) {
+                    XFileContents xfile = new XFileContents(files[i]);
+                    result[i] = (FileContents) \
ServiceUtil.createPrivilegedProxy(FileContents.class, xfile); +                }
+                return result;
             } else {
                 return null;
             }
diff -r 420d72e5cee7 -r 79bdc074df81 \
                tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java	Tue Aug 27 16:53:30 2013 \
                -0400
+++ b/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java	Fri Aug 30 11:02:08 2013 \
-0400 @@ -42,6 +42,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Locale;
+import java.util.Map;
 
 import net.sourceforge.jnlp.JNLPFile.Match;
 import net.sourceforge.jnlp.mock.MockJNLPFile;
@@ -148,4 +149,63 @@
         Assert.assertEquals("Sample Test", jnlpFile.getTitle());
         Assert.assertEquals(2, jnlpFile.getResources().getJARs().length);
     }
+
+    @Test
+    public void testPropertyRestrictions() throws MalformedURLException, \
ParseException { +        String jnlpContents = "<?xml version='1.0'?>\n" +
+                "<jnlp spec='1.5' href='foo' codebase='bar'>\n" +
+                "  <information>\n" +
+                "    <title>Parsing Test</title>\n" +
+                "    <vendor>IcedTea</vendor>\n" +
+                "    <offline-allowed/>\n" +
+                "  </information>\n" +
+                "  <resources>\n" +
+                "    <property name='general' value='general'/>\n" +
+                "    <property name='os' value='general'/>\n" +
+                "    <property name='arch' value='general'/>\n" +
+                "  </resources>\n" +
+                "  <resources os='os1'>" +
+                "    <property name='os' value='os1'/>\n" +
+                "  </resources>\n" +
+                "  <resources os='os1' arch='arch1'>" +
+                "    <property name='arch' value='arch1'/>\n" +
+                "  </resources>\n" +
+                "  <resources os='os2' arch='arch2'>\n" +
+                "    <property name='os' value='os2'/>\n" +
+                "    <property name='arch' value='arch2'/>\n" +
+                "  </resources>\n" +
+                "  <installer-desc/>\n" +
+                "</jnlp>";
+
+        URL codeBase = new URL("http://www.redhat.com/");
+        InputStream is = new ByteArrayInputStream(jnlpContents.getBytes());
+        JNLPFile jnlpFile = new JNLPFile(is, codeBase, new \
ParserSettings(false,false,false)); +
+        ResourcesDesc resources;
+        Map<String,String> properties;
+
+        resources = jnlpFile.getResources(Locale.getDefault(), "os0", "arch0");
+        properties = resources.getPropertiesMap();
+        Assert.assertEquals("general", properties.get("general"));
+        Assert.assertEquals("general", properties.get("os"));
+        Assert.assertEquals("general", properties.get("arch"));
+
+        resources = jnlpFile.getResources(Locale.getDefault(), "os1", "arch0");
+        properties = resources.getPropertiesMap();
+        Assert.assertEquals("general", properties.get("general"));
+        Assert.assertEquals("os1", properties.get("os"));
+        Assert.assertEquals("general", properties.get("arch"));
+
+        resources = jnlpFile.getResources(Locale.getDefault(), "os1", "arch1");
+        properties = resources.getPropertiesMap();
+        Assert.assertEquals("general", properties.get("general"));
+        Assert.assertEquals("os1", properties.get("os"));
+        Assert.assertEquals("arch1", properties.get("arch"));
+
+        resources = jnlpFile.getResources(Locale.getDefault(), "os2", "arch2");
+        properties = resources.getPropertiesMap();
+        Assert.assertEquals("general", properties.get("general"));
+        Assert.assertEquals("os2", properties.get("os"));
+        Assert.assertEquals("arch2", properties.get("arch"));
+    }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic