equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
40 import java.lang.reflect.Constructor; |
40 import java.lang.reflect.Constructor; |
41 |
41 |
42 import jdk.test.lib.util.JarUtils; |
42 import jdk.test.lib.util.JarUtils; |
43 |
43 |
44 public class ConsTest implements Serializable { |
44 public class ConsTest implements Serializable { |
|
45 private static final long serialVersionUID = 1L; |
|
46 |
45 public static void main(String[] args) throws Exception { |
47 public static void main(String[] args) throws Exception { |
46 Constructor cons = Boot.class.getConstructor( |
48 Constructor<?> cons = Boot.class.getConstructor(ObjectInputStream.class); |
47 new Class[] { ObjectInputStream.class }); |
|
48 ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
49 ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
49 ObjectOutputStream oout = new ObjectOutputStream(bout); |
50 ObjectOutputStream oout = new ObjectOutputStream(bout); |
50 oout.writeObject(new ConsTest()); |
51 oout.writeObject(new ConsTest()); |
51 oout.close(); |
52 oout.close(); |
52 |
53 |
53 for (int i = 0; i < 100; i++) { |
54 for (int i = 0; i < 100; i++) { |
54 ObjectInputStream oin = new ObjectInputStream( |
55 ObjectInputStream oin = new ObjectInputStream( |
55 new ByteArrayInputStream(bout.toByteArray())); |
56 new ByteArrayInputStream(bout.toByteArray())); |
56 cons.newInstance(new Object[]{ oin }); |
57 cons.newInstance(oin); |
57 } |
58 } |
58 } |
59 } |
59 } |
60 } |