Stay organized with collections
Save and categorize content based on your preferences.
InvalidPathException
open class InvalidPathException : IllegalArgumentException
Unchecked exception thrown when path string cannot be converted into a Path
because the path string contains invalid characters, or the path string is invalid for other file system specific reasons.
Summary
Public constructors |
Constructs an instance from the given input string and reason.
|
Constructs an instance from the given input string, reason, and error index.
|
Public methods |
open Int |
Returns an index into the input string of the position at which the error occurred, or -1 if this position is not known.
|
open String! |
Returns the input string.
|
open String! |
Returns a string explaining why the input string was rejected.
|
Properties |
open String? |
Returns a string describing the error.
|
Public constructors
InvalidPathException
InvalidPathException(
input: String!,
reason: String!)
Constructs an instance from the given input string and reason. The resulting object will have an error index of -1
.
Parameters |
input |
String!: the input string |
reason |
String!: a string explaining why the input was rejected |
Exceptions |
java.lang.NullPointerException |
if either the input or reason strings are null |
InvalidPathException
InvalidPathException(
input: String!,
reason: String!,
index: Int)
Constructs an instance from the given input string, reason, and error index.
Parameters |
input |
String!: the input string |
reason |
String!: a string explaining why the input was rejected |
index |
Int: the index at which the error occurred, or -1 if the index is not known |
Exceptions |
java.lang.NullPointerException |
if either the input or reason strings are null |
java.lang.IllegalArgumentException |
if the error index is less than -1 |
Public methods
getIndex
open fun getIndex(): Int
Returns an index into the input string of the position at which the error occurred, or -1
if this position is not known.
Return |
Int |
the error index |
open fun getInput(): String!
Returns the input string.
Return |
String! |
the input string |
getReason
open fun getReason(): String!
Returns a string explaining why the input string was rejected.
Return |
String! |
the reason string |
Properties
message
open val message: String?
Returns a string describing the error. The resulting string consists of the reason string followed by a colon character (':'
), a space, and the input string. If the error index is defined then the string " at index "
followed by the index, in decimal, is inserted after the reason string and before the colon character.
Return |
String? |
a string describing the error |
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,["# InvalidPathException\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nInvalidPathException\n====================\n\n```\nopen class InvalidPathException : IllegalArgumentException\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.lang.RuntimeException](../../lang/RuntimeException.html#) |||\n| | | | ↳ | [java.lang.IllegalArgumentException](../../lang/IllegalArgumentException.html#) ||\n| | | | | ↳ | [java.nio.file.InvalidPathException](#) |\n\nUnchecked exception thrown when path string cannot be converted into a [Path](/reference/kotlin/java/nio/file/Path) because the path string contains invalid characters, or the path string is invalid for other file system specific reasons.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [InvalidPathException](#InvalidPathException(kotlin.String,%20kotlin.String))`(`input:` `[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 instance from the given input string and reason. |\n| [InvalidPathException](#InvalidPathException(kotlin.String,%20kotlin.String,%20kotlin.Int))`(`input:` `[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)!`, `index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Constructs an instance from the given input string, reason, and error index. |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getIndex](#getIndex())`()` Returns an index into the input string of the position at which the error occurred, or `-1` if this position is not known. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getInput](#getInput())`()` Returns the input string. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getReason](#getReason())`()` Returns a string explaining why the input string was rejected. |\n\n| Properties ||\n|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | [message](#message:kotlin.String) Returns a string describing the error. |\n\nPublic constructors\n-------------------\n\n### InvalidPathException\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nInvalidPathException(\n input: String!, \n reason: String!)\n```\n\nConstructs an instance from the given input string and reason. The resulting object will have an error index of `-1`.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------|\n| `input` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the input string |\n| `reason` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: a string explaining why the input was rejected |\n\n| Exceptions ||\n|----------------------------------|--------------------------------------------------|\n| `java.lang.NullPointerException` | if either the input or reason strings are `null` |\n\n### InvalidPathException\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nInvalidPathException(\n input: String!, \n reason: String!, \n index: Int)\n```\n\nConstructs an instance from the given input string, reason, and error index.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the input string |\n| `reason` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: a string explaining why the input was rejected |\n| `index` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the index at which the error occurred, or `-1` if the index is not known |\n\n| Exceptions ||\n|--------------------------------------|--------------------------------------------------|\n| `java.lang.NullPointerException` | if either the input or reason strings are `null` |\n| `java.lang.IllegalArgumentException` | if the error index is less than `-1` |\n\nPublic methods\n--------------\n\n### getIndex\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getIndex(): Int\n```\n\nReturns an index into the input string of the position at which the error occurred, or `-1` if this position is not known.\n\n| Return ||\n|----------------------------------------------------------------------------|-----------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the error index |\n\n### getInput\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getInput(): String!\n```\n\nReturns the input string.\n\n| Return ||\n|-----------------------------------------------------------------------------------|------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the input string |\n\n### getReason\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getReason(): String!\n```\n\nReturns a string explaining why the input string was rejected.\n\n| Return ||\n|-----------------------------------------------------------------------------------|-------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the reason string |\n\nProperties\n----------\n\n### message\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen val message: String?\n```\n\nReturns a string describing the error. The resulting string consists of the reason string followed by a colon character (`':'`), a space, and the input string. If the error index is defined then the string `\" at index \"` followed by the index, in decimal, is inserted after the reason string and before the colon character.\n\n| Return ||\n|-----------------------------------------------------------------------------------|-------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | a string describing the error |"]]