11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.ByteArrayInputStream;
25 import java.io.IOException;
26 import java.io.InputStream;
27 import java.io.ObjectInputFilter;
28 import java.io.ObjectInputStream;
29 import java.io.InvalidClassException;
30
31 import java.util.Hashtable;
32
33 import jdk.internal.misc.SharedSecrets;
34
35 import org.testng.annotations.BeforeClass;
36 import org.testng.annotations.DataProvider;
37 import org.testng.annotations.Test;
38 import org.testng.Assert;
39
40 /* @test
41 * @build CheckArrayTest SerialFilterTest
42 * @bug 8203368
43 * @modules java.base/jdk.internal.misc
44 * @run testng CheckArrayTest
45 *
46 * @summary Test the SharedSecret access to ObjectInputStream.checkArray works
47 * with overridden subclasses.
48 */
49
50 /**
51 * Verify that the SharedSecret access to the OIS checkAccess method
52 * does not fail with NPE in the case where ObjectInputStream is subclassed.
53 * The checkAccess method is called from various aggregate types in java.util
54 * to check array sizes during deserialization via the ObjectInputFilter attached the stream.
55 * The filterCheck must be resilent to an InputStream not being available (only the subclass knows).
56 */
57 public class CheckArrayTest {
58
59 @DataProvider(name = "Patterns")
60 Object[][] patterns() {
61 return new Object[][]{
62 new Object[]{"maxarray=10", 10, new String[10]}, // successful
63 new Object[]{"maxarray=10", 11, new String[11]}, // exception expected
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.ByteArrayInputStream;
25 import java.io.IOException;
26 import java.io.InputStream;
27 import java.io.ObjectInputFilter;
28 import java.io.ObjectInputStream;
29 import java.io.InvalidClassException;
30
31 import jdk.internal.access.SharedSecrets;
32
33 import org.testng.annotations.DataProvider;
34 import org.testng.annotations.Test;
35 import org.testng.Assert;
36
37 /* @test
38 * @build CheckArrayTest SerialFilterTest
39 * @bug 8203368
40 * @modules java.base/jdk.internal.access
41 * @run testng CheckArrayTest
42 *
43 * @summary Test the SharedSecret access to ObjectInputStream.checkArray works
44 * with overridden subclasses.
45 */
46
47 /**
48 * Verify that the SharedSecret access to the OIS checkAccess method
49 * does not fail with NPE in the case where ObjectInputStream is subclassed.
50 * The checkAccess method is called from various aggregate types in java.util
51 * to check array sizes during deserialization via the ObjectInputFilter attached the stream.
52 * The filterCheck must be resilent to an InputStream not being available (only the subclass knows).
53 */
54 public class CheckArrayTest {
55
56 @DataProvider(name = "Patterns")
57 Object[][] patterns() {
58 return new Object[][]{
59 new Object[]{"maxarray=10", 10, new String[10]}, // successful
60 new Object[]{"maxarray=10", 11, new String[11]}, // exception expected
|