changeset 13180:b4c6d8f2cf1b

8189981: Improve queuing portability Reviewed-by: skoivu, rhalade, chegar, igerasim
author igerasim
date Mon, 05 Feb 2018 04:31:19 -0800
parents 6c56f3efe2d8
children b016b7d4e84e
files src/share/classes/java/util/concurrent/PriorityBlockingQueue.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Thu Feb 01 20:19:42 2018 -0800
+++ b/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Mon Feb 05 04:31:19 2018 -0800
@@ -48,6 +48,7 @@
 import java.util.SortedSet;
 import java.util.Spliterator;
 import java.util.function.Consumer;
+import sun.misc.SharedSecrets;
 
 /**
  * An unbounded {@linkplain BlockingQueue blocking queue} that uses
@@ -940,7 +941,9 @@
         throws java.io.IOException, ClassNotFoundException {
         try {
             s.defaultReadObject();
-            this.queue = new Object[q.size()];
+            int sz = q.size();
+            SharedSecrets.getJavaOISAccess().checkArray(s, Object[].class, sz);
+            this.queue = new Object[sz];
             comparator = q.comparator();
             addAll(q);
         } finally {