java.net

Class URISyntaxException

public class URISyntaxException extends Exception

This exception is thrown when a String cannot be parsed as a URI.

Since: 1.4

See Also: URI

UNKNOWN: updated to 1.4

Constructor Summary
URISyntaxException(String input, String msg)
Create an exception from the invalid string, with the index set to -1.
URISyntaxException(String input, String msg, int index)
Create an exception from the invalid string, with the index of the point of failure.
Method Summary
intgetIndex()
Returns the index of the failure, or -1.
StringgetInput()
Returns the bad input string.
StringgetMessage()
Returns a message describing the parse error, as if by getReason() + (getIndex() >= 0 ?
StringgetReason()
Returns the reason for the failure.

Constructor Detail

URISyntaxException

public URISyntaxException(String input, String msg)
Create an exception from the invalid string, with the index set to -1.

Parameters: input the bad URI msg the descriptive error message

Throws: NullPointerException if input or msg are null

URISyntaxException

public URISyntaxException(String input, String msg, int index)
Create an exception from the invalid string, with the index of the point of failure.

Parameters: input the bad URI msg the descriptive error message index the index of the parse error, or -1

Throws: NullPointerException if input or msg are null IllegalArgumentException if index < -1

Method Detail

getIndex

public int getIndex()
Returns the index of the failure, or -1.

Returns: the index of failure

getInput

public String getInput()
Returns the bad input string.

Returns: the bad URI, guaranteed non-null

getMessage

public String getMessage()
Returns a message describing the parse error, as if by getReason() + (getIndex() >= 0 ? " at index " + getIndex() : "") + ": " + getInput().

Returns: the message string

getReason

public String getReason()
Returns the reason for the failure.

Returns: the message, guaranteed non-null