changeset 1239:eff1700654a4

Fixed download service * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (fillInPartJars) for-each loop replaced by indexed loop to prevent ConcurrentModificationException * tests/reproducers/signed/DownloadService/testcases/DownloadServiceTest.java: small refactoring in favour of diamond operator
author Jiri Vanek <jvanek@redhat.com>
date Mon, 20 Jul 2015 13:00:19 +0200
parents aeeea7de3494
children f5b19b402bf6
files ChangeLog NEWS netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java tests/reproducers/signed/DownloadService/testcases/DownloadServiceTest.java
diffstat 4 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jun 25 12:11:56 2015 +0200
+++ b/ChangeLog	Mon Jul 20 13:00:19 2015 +0200
@@ -1,3 +1,11 @@
+2015-07-20  Jiri Vanek  <jvanek@redhat.com>
+
+	Fixed download service
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (fillInPartJars)
+	for-each loop replaced by indexed loop to prevent ConcurrentModificationException
+	* tests/reproducers/signed/DownloadService/testcases/DownloadServiceTest.java:
+	small refactoring in favour of diamond operator
+
 2015-06-25  Jiri Vanek  <jvanek@redhat.com>
 
 	Fixed to short buttons for localized text - RH1231441
--- a/NEWS	Thu Jun 25 12:11:56 2015 +0200
+++ b/NEWS	Mon Jul 20 13:00:19 2015 +0200
@@ -9,6 +9,7 @@
 CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY
 
 New in release 1.6.1 (2015-MM-DD):
+* fixed DownloadService
 * fixed bug in caching of files with query
 * fixed issues with recreating of existing shortcut
 * trustAll/trustNone now processed correctly
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu Jun 25 12:11:56 2015 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Mon Jul 20 13:00:19 2015 +0200
@@ -1209,8 +1209,9 @@
      * @param jars jar archives to be added
      */
     protected void fillInPartJars(List<JARDesc> jars) {
-        for (JARDesc desc : jars) {
-            String part = desc.getPart();
+        //can not use iterator, will rise ConcurrentModificationException on jars.add(jar);
+        for (int x = 0 ; x< jars.size() ; x++) {
+            String part = jars.get(x).getPart();
 
             // "available" field can be affected by two different threads
             // working in loadClass(String)
--- a/tests/reproducers/signed/DownloadService/testcases/DownloadServiceTest.java	Thu Jun 25 12:11:56 2015 +0200
+++ b/tests/reproducers/signed/DownloadService/testcases/DownloadServiceTest.java	Mon Jul 20 13:00:19 2015 +0200
@@ -48,11 +48,11 @@
 import org.junit.Test;
 
 public class DownloadServiceTest {
-    private static ServerAccess server = new ServerAccess();
+    private static final ServerAccess server = new ServerAccess();
     private final String exitString = "Exiting DownloadService..";
-    private static List<String> checkCache = new ArrayList<String>();
-    private static List<String> manageJnlpResources = new ArrayList<String>();
-    private static List<String> manageExternalResources = new ArrayList<String>();
+    private static final List<String> checkCache = new ArrayList<>();
+    private static final List<String> manageJnlpResources = new ArrayList<>();
+    private static final List<String> manageExternalResources = new ArrayList<>();
 
     @BeforeClass
     public static void initalizeClass() throws MalformedURLException {