Stay organized with collections
Save and categorize content based on your preferences.
InvalidClassException
open class InvalidClassException : ObjectStreamException
Thrown when the Serialization runtime detects one of the following problems with a Class.
- The serial version of the class does not match that of the class descriptor read from the stream
- The class contains unknown datatypes
- The class does not have an accessible no-arg constructor
- The ObjectStreamClass of an enum constant does not represent an enum type
- Other conditions given in the Java Object Serialization Specification
Summary
Public constructors |
Report an InvalidClassException for the reason specified.
|
Constructs an InvalidClassException object.
|
Properties |
String! |
Name of the invalid class.
|
open String? |
Produce the message and include the classname, if present.
|
Public constructors
InvalidClassException
InvalidClassException(reason: String!)
Report an InvalidClassException for the reason specified.
Parameters |
reason |
String!: String describing the reason for the exception. |
InvalidClassException
InvalidClassException(
cname: String!,
reason: String!)
Constructs an InvalidClassException object.
Parameters |
cname |
String!: a String naming the invalid class. |
reason |
String!: a String describing the reason for the exception. |
Properties
classname
var classname: String!
Name of the invalid class.
message
open val message: String?
Produce the message and include the classname, if present.
Return |
String? |
the detail message string of this Throwable instance (which may be null ). |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# InvalidClassException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nInvalidClassException\n=====================\n\n```\nopen class InvalidClassException : ObjectStreamException\n```\n\n|---|---|---|---|---|------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) |||||\n| | ↳ | [java.lang.Exception](../lang/Exception.html#) ||||\n| | | ↳ | [java.io.IOException](/reference/kotlin/java/io/IOException) |||\n| | | | ↳ | [java.io.ObjectStreamException](/reference/kotlin/java/io/ObjectStreamException) ||\n| | | | | ↳ | [java.io.InvalidClassException](#) |\n\nThrown when the Serialization runtime detects one of the following problems with a Class.\n\n- The serial version of the class does not match that of the class descriptor read from the stream\n- The class contains unknown datatypes\n- The class does not have an accessible no-arg constructor\n- The ObjectStreamClass of an enum constant does not represent an enum type\n- Other conditions given in the Java Object Serialization Specification\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [InvalidClassException](#InvalidClassException(kotlin.String))`(`reason:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Report an InvalidClassException for the reason specified. |\n| [InvalidClassException](#InvalidClassException(kotlin.String,%20kotlin.String))`(`cname:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `reason:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs an InvalidClassException object. |\n\n| Properties ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [classname](#classname:kotlin.String) Name of the invalid class. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | [message](#message:kotlin.String) Produce the message and include the classname, if present. |\n\nPublic constructors\n-------------------\n\n### InvalidClassException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nInvalidClassException(reason: String!)\n```\n\nReport an InvalidClassException for the reason specified.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------|\n| `reason` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: String describing the reason for the exception. |\n\n### InvalidClassException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nInvalidClassException(\n cname: String!, \n reason: String!)\n```\n\nConstructs an InvalidClassException object.\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `cname` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: a String naming the invalid class. |\n| `reason` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: a String describing the reason for the exception. |\n\nProperties\n----------\n\n### classname\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nvar classname: String!\n```\n\nName of the invalid class. \n\n### message\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen val message: String?\n```\n\nProduce the message and include the classname, if present.\n\n| Return ||\n|-----------------------------------------------------------------------------------|-------------------------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | the detail message string of this `Throwable` instance (which may be `null`). |"]]