1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.io; 19 20 /** 21 * Signals that a serialization-related method has been invoked in the wrong 22 * place. Some methods in {@code ObjectInputStream} and {@code 23 * ObjectOutputStream} can only be called from a nested call to readObject() or 24 * writeObject(). Any attempt to call them from another context will cause a 25 * {@code NotActiveException} to be thrown. The list of methods that are 26 * protected this way is: 27 * <ul> 28 * <li>{@link ObjectInputStream#defaultReadObject()}</li> 29 * <li>{@link ObjectInputStream#registerValidation(ObjectInputValidation, int)}</li> 30 * <li>{@link ObjectOutputStream#defaultWriteObject()}</li> 31 * </ul> 32 */ 33 public class NotActiveException extends ObjectStreamException { 34 35 private static final long serialVersionUID = -3893467273049808895L; 36 37 /** 38 * Constructs a new {@code NotActiveException} with its stack trace filled 39 * in. 40 */ 41 public NotActiveException() { 42 } 43 44 /** 45 * Constructs a new {@code NotActiveException} with its stack trace and 46 * detail message filled in. 47 * 48 * @param detailMessage 49 * the detail message for this exception. 50 */ 51 public NotActiveException(String detailMessage) { 52 super(detailMessage); 53 } 54 } 55