Write.java revision 0
4127N/A/*
4127N/A * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
4127N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4127N/A *
4127N/A * This code is free software; you can redistribute it and/or modify it
4127N/A * under the terms of the GNU General Public License version 2 only, as
4127N/A * published by the Free Software Foundation.
4127N/A *
4127N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4127N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4127N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4127N/A * version 2 for more details (a copy is included in the LICENSE file that
4127N/A * accompanied this code).
4127N/A *
4127N/A * You should have received a copy of the GNU General Public License version
4127N/A * 2 along with this work; if not, write to the Free Software Foundation,
4127N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4127N/A *
4127N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
4127N/A * CA 95054 USA or visit www.sun.com if you need additional information or
4127N/A * have any questions.
4127N/A */
4127N/A
4127N/A/* @test
4127N/A * @bug 4312433
4127N/A *
4127N/A * @clean Write Read A B
4127N/A * @compile Write.java
4127N/A * @run main Write
4127N/A * @clean Write Read A B
4127N/A * @compile Read.java
4127N/A * @run main Read
4127N/A *
4127N/A * @summary Verify that reading a back reference to a previously skipped value
4127N/A * whose class is not available will throw a ClassNotFoundException
4127N/A */
4127N/A
4127N/Aimport java.io.*;
4127N/A
4127N/Aclass A implements Serializable {
4127N/A private static final long serialVersionUID = 0L;
4127N/A B b = new B();
4127N/A}
4127N/A
4127N/Aclass B implements Serializable { // class not present on reading side
4127N/A private static final long serialVersionUID = 0L;
4127N/A}
4127N/A
4127N/Apublic class Write {
4127N/A public static void main(String[] args) throws Exception {
4127N/A A a = new A();
4127N/A ObjectOutputStream oout =
4127N/A new ObjectOutputStream(new FileOutputStream("tmp.ser"));
4127N/A oout.writeObject(a);
4127N/A oout.writeObject(a.b);
4127N/A oout.close();
4127N/A }
4127N/A}
4127N/A