Team LiB
Previous Section Next Section

URISyntaxExceptionjava.net

Java 1.4serializable checked

Signals that a string could not be parsed as a valid URI. getInput( ) returns the string that could not be parsed. getreason( ) returns an error message. getIndex( ) returns the character position at which the syntax error occurred, if that information is available. getMessage( ) returns a human-readable string that includes the information from each of the other three methods.

This is a checked exception thrown by all the URI( ) constructors. If you are parsing a hard-coded URI that you do not believe to contain any syntax errors, and wish to avoid the checked exception, you can use the URI.create( ) factory method instead of the one-argument version of the URI( ) constructor.

Figure 12-26. java.net.URISyntaxException


public class URISyntaxException extends Exception {
// Public Constructors
     public URISyntaxException(String input, String reason);  
     public URISyntaxException(String input, String reason, int index);  
// Public Instance Methods
     public int getIndex( );  
     public String getInput( );  
     public String getReason( );  
// Public Methods Overriding Throwable
     public String getMessage( );  
}

Thrown By

URI.{parseServerAuthority( ), URI( )}, URL.toURI( )

    Team LiB
    Previous Section Next Section