8189985: Improve tabular data portability
authorasapre
Wed, 14 Feb 2018 15:36:59 +0530
changeset 49794 274be83ad4b7
parent 49793 a73fcbe66a57
child 49795 4c77b1453427
8189985: Improve tabular data portability Reviewed-by: dfuchs, mchung, skoivu
src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java
--- a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java	Mon Feb 12 11:38:35 2018 -0500
+++ b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java	Wed Feb 14 15:36:59 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import jdk.internal.misc.SharedSecrets;
 
 // jmx import
 //
@@ -922,6 +923,8 @@
             throws IOException, ClassNotFoundException {
       in.defaultReadObject();
       List<String> tmpNames = tabularType.getIndexNames();
-      indexNamesArray = tmpNames.toArray(new String[tmpNames.size()]);
+      int size = tmpNames.size();
+      SharedSecrets.getJavaObjectInputStreamAccess().checkArray(in, String[].class, size);
+      indexNamesArray = tmpNames.toArray(new String[size]);
     }
 }