Top Description Fields Constructors Methods
java.net

public Class URISyntaxException

extends Exception
Class Inheritance

Checked exception thrown to indicate that a string could not be parsed as a URI reference.
Author
Mark Reinhold
Since
1.4
See Also
URI

Field Summary

Modifier and TypeField and Description
private final int
index

The index at which the parse error occurred, or -1 if the index is not known.

private final String
input

The input string.

private static final long

Constructor Summary

AccessConstructor and Description
public
URISyntaxException(String
The input string
input
,
String
A string explaining why the input could not be parsed
reason
,
int
The index at which the parse error occurred, or -1 if the index is not known
index
)

Constructs an instance from the given input string, reason, and error index.

public
URISyntaxException(String
The input string
input
,
String
A string explaining why the input could not be parsed
reason
)

Constructs an instance from the given input string and reason.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The error index
getIndex
()

Returns an index into the input string of the position at which the parse error occurred, or -1 if this position is not known.

public String

Returns:

The input string
getInput
()

Returns the input string.

public String

Returns:

A string describing the parse error
getMessage
()

Overrides java.lang.Throwable.getMessage.

Returns a string describing the parse error.

public String

Returns:

The reason string
getReason
()

Returns a string explaining why the input string could not be parsed.

Field Detail

indexback to summary
private final int index

The index at which the parse error occurred, or -1 if the index is not known.

inputback to summary
private final String input

The input string.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Annotations
@Serial

Constructor Detail

URISyntaxExceptionback to summary
public URISyntaxException(String input, String reason, int index)

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 could not be parsed

index:int

The index at which the parse error occurred, or -1 if the index is not known

Exceptions
NullPointerException:
If either the input or reason strings are null
IllegalArgumentException:
If the error index is less than -1
URISyntaxExceptionback to summary
public URISyntaxException(String input, String reason)

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 could not be parsed

Exceptions
NullPointerException:
If either the input or reason strings are null

Method Detail

getIndexback to summary
public int getIndex()

Returns an index into the input string of the position at which the parse error occurred, or -1 if this position is not known.

Returns:int

The error index

getInputback to summary
public String getInput()

Returns the input string.

Returns:String

The input string

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Returns a string describing the parse 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.

Returns:String

A string describing the parse error

getReasonback to summary
public String getReason()

Returns a string explaining why the input string could not be parsed.

Returns:String

The reason string