test/jdk/java/io/Serializable/oldTests/CheckForException.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 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.
   103         }
   103         }
   104     }
   104     }
   105 }
   105 }
   106 
   106 
   107 class PickleClass implements java.io.Serializable {
   107 class PickleClass implements java.io.Serializable {
       
   108     private static final long serialVersionUID = 1L;
       
   109 
   108     int ii = 17;
   110     int ii = 17;
   109     transient int tmp[];
   111     transient int tmp[];
   110 
   112 
   111     private void writeObject(ObjectOutputStream pw) throws IOException {
   113     private void writeObject(ObjectOutputStream pw) throws IOException {
   112         pw.writeUTF("PickleClass");
   114         pw.writeUTF("PickleClass");
   127     }
   129     }
   128 
   130 
   129 }
   131 }
   130 
   132 
   131 class NoPickleClass extends PickleClass {
   133 class NoPickleClass extends PickleClass {
       
   134     private static final long serialVersionUID = 1L;
       
   135 
   132     private void writeObject(ObjectOutputStream pw)
   136     private void writeObject(ObjectOutputStream pw)
   133         throws NotSerializableException
   137         throws NotSerializableException
   134     {
   138     {
   135         throw new NotSerializableException("NoPickleClass");
   139         throw new NotSerializableException("NoPickleClass");
   136     }
   140     }
   141             throw new NotSerializableException("NoPickleClass");
   145             throw new NotSerializableException("NoPickleClass");
   142     }
   146     }
   143 }
   147 }
   144 
   148 
   145 class TryPickleClass  extends NoPickleClass {
   149 class TryPickleClass  extends NoPickleClass {
       
   150     private static final long serialVersionUID = 1L;
       
   151 
   146     int i = 7;
   152     int i = 7;
   147     transient int tmp[];
   153     transient int tmp[];
   148 
   154 
   149     private void writeObject(ObjectOutputStream pw) throws IOException {
   155     private void writeObject(ObjectOutputStream pw) throws IOException {
   150             pw.writeInt(i);
   156             pw.writeInt(i);