< prev index next >

src/java.base/share/classes/java/lang/ExceptionInInitializerError.java

Print this page

        

*** 48,57 **** --- 48,58 ---- */ public class ExceptionInInitializerError extends LinkageError { /** * Use serialVersionUID from JDK 1.1.X for interoperability */ + @java.io.Serial private static final long serialVersionUID = 1521711792217232256L; /** * Constructs an <code>ExceptionInInitializerError</code> with * <code>null</code> as its detail message string and with no saved
*** 107,116 **** --- 108,118 ---- /** * Serializable fields for ExceptionInInitializerError. * * @serialField exception Throwable */ + @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("exception", Throwable.class) }; /*
*** 120,129 **** --- 122,132 ---- * * The getException and getCause method returns the private "exception" * field in the older implementation and ExceptionInInitializerError::cause * was set to null. */ + @java.io.Serial private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = s.readFields(); Throwable exception = (Throwable) fields.get("exception", null); if (exception != null) { setCause(exception);
*** 132,141 **** --- 135,145 ---- /* * To maintain compatibility with older implementation, write a serial * "exception" field with the cause as the value. */ + @java.io.Serial private void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("exception", super.getCause()); out.writeFields(); }
< prev index next >