mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8282696: Add constructors taking a cause to InvalidObjectException and InvalidClassException
Reviewed-by: lancea
This commit is contained in:
parent
6fc73f709b
commit
104e3cb24b
7 changed files with 198 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, 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
|
||||
|
@ -73,9 +73,34 @@ public class InvalidClassException extends ObjectStreamException {
|
|||
classname = cname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an InvalidClassException for the reason and cause specified.
|
||||
*
|
||||
* @param reason String describing the reason for the exception.
|
||||
* @param cause the cause
|
||||
* @since 19
|
||||
*/
|
||||
public InvalidClassException(String reason, Throwable cause) {
|
||||
super(reason, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an InvalidClassException for the reason and cause specified.
|
||||
*
|
||||
* @param cname a String naming the invalid class.
|
||||
* @param reason String describing the reason for the exception.
|
||||
* @param cause the cause
|
||||
* @since 19
|
||||
*/
|
||||
public InvalidClassException(String cname, String reason, Throwable cause) {
|
||||
super(reason, cause);
|
||||
classname = cname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce the message and include the classname, if present.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (classname == null)
|
||||
return super.getMessage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue