< prev index next >
test/java/io/Serializable/class/TestEntry.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2001, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1998, 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 24,36 ****
/*
* @bug 4075221
* @summary Enable serialize of nonSerializable Class descriptor.
*/
! import java.io.*;
! class Test {
public static void main(String args[]) throws Exception {
File f = new File("tmp.ser");
if (args[0].compareTo("-s") == 0) {
FileOutputStream of = new FileOutputStream(f);
ObjectOutputStream oos = new ObjectOutputStream(of);
--- 24,43 ----
/*
* @bug 4075221
* @summary Enable serialize of nonSerializable Class descriptor.
*/
! import java.io.EOFException;
! import java.io.File;
! import java.io.FileOutputStream;
! import java.io.FileInputStream;
! import java.io.InvalidClassException;
! import java.io.ObjectInputStream;
! import java.io.ObjectOutputStream;
! import java.io.ObjectStreamClass;
! class TestEntry {
public static void main(String args[]) throws Exception {
File f = new File("tmp.ser");
if (args[0].compareTo("-s") == 0) {
FileOutputStream of = new FileOutputStream(f);
ObjectOutputStream oos = new ObjectOutputStream(of);
*** 71,78 ****
--- 78,87 ----
ois.readObject();
} catch (EOFException e) {
}
ois.close();
System.out.println("DeSerialized Class " + cl.getName());
+ } else {
+ throw new RuntimeException("Unrecognized argument");
}
}
}
< prev index next >