java.net
Class URISyntaxException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.net.URISyntaxException
All Implemented Interfaces:
Serializable

public class URISyntaxException
extends Exception

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

Since:
1.4
See Also:
URI, Serialized Form

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
 int getIndex()
          Returns the index of the failure, or -1.
 String getInput()
          Returns the bad input string.
 String getMessage()
          Returns a message describing the parse error, as if by getReason() + (getIndex() >= 0 ?
 String getReason()
          Returns the reason for the failure.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

getInput

public String getInput()
Returns the bad input string.

Returns:
the bad URI, guaranteed non-null

getReason

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

Returns:
the message, guaranteed non-null

getIndex

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

Returns:
the index of failure

getMessage

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

Overrides:
getMessage in class Throwable
Returns:
the message string