I am trying to throw new exception when args.length doesn't have any arguments supply but instead of printing out my message it prints out ArrayIndexOutOfBounce exception.
if (args.length == 0)
{
throw new DeleteFieldException("You must set at least three arguments");
}
my catch:
catch (DeleteFieldException exception)
{
System.err.println(exception);
} // catch
and my custom made exception class:
public class DeleteFieldException extends Exception
{
private String message = null;
public DeleteFieldException ()
{
super ();
}
public DeleteFieldException (String message)
{
super (message);
this.message = message;
}
public DeleteFieldException (Throwable cause)
{
super (cause);
}
public DeleteFieldException (String message, Throwable cause)
{
super (message, cause);
}
public String toString()
{
return message;
}
public String getMessage()
{
return message;
}
} // DeleteFieldException