test/jdk/java/io/Serializable/survivePrematureClose/SurvivePrematureClose.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2002, 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.
    30  */
    30  */
    31 
    31 
    32 import java.io.*;
    32 import java.io.*;
    33 
    33 
    34 class A implements Externalizable {
    34 class A implements Externalizable {
       
    35     private static final long serialVersionUID = 1L;
    35 
    36 
    36     public A() {}
    37     public A() {}
    37 
    38 
    38     public void writeExternal(ObjectOutput out) throws IOException {
    39     public void writeExternal(ObjectOutput out) throws IOException {
    39         out.writeInt(0);
    40         out.writeInt(0);
    47         in.close();
    48         in.close();
    48     }
    49     }
    49 }
    50 }
    50 
    51 
    51 class B implements Serializable {
    52 class B implements Serializable {
       
    53     private static final long serialVersionUID = 1L;
    52 
    54 
    53     private void writeObject(ObjectOutputStream out) throws IOException {
    55     private void writeObject(ObjectOutputStream out) throws IOException {
    54         out.defaultWriteObject();
    56         out.defaultWriteObject();
    55         out.close();
    57         out.close();
    56     }
    58     }