|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
jcmdline.CmdLineException
public class CmdLineException
An Exception that indicates a command line processing error.
Sample Usage:
To use this for an exception in package 'mypackage', a properties file called 'errors.properties' might be created in directory 'mypackage' with the following properties:
# Contents of errors.properties file
PercentTooLow: \
Percent must be greater than {0}, got {1}.
PercentTooHigh: \
Percent must be less than {0}, got {1}.
Throwing an exception would be done as in the following:
if (percent > 100) {
ResourceBundle rb = ResourceBundle.getBundle("mypackage.errors");
String msg = rb.getString("PercentTooHigh");
throw new CmdLineException(msg,
new Object[] { new Integer(100),
new Integer(percent) });
}
The package may now be modified to accomodate a French Locale by creating a file 'errors_fr.properties' in directory 'mypackage' that contains all messages in 'errors.properties', converted to French.
| Constructor Summary | |
|---|---|
CmdLineException(java.lang.String message)
constructor |
|
CmdLineException(java.lang.String message,
java.lang.Object[] params)
constructor |
|
| Method Summary |
|---|
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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 |
|---|
public CmdLineException(java.lang.String message)
message - message associated with the exception
public CmdLineException(java.lang.String message,
java.lang.Object[] params)
message - message associated with the exceptionparams - parameters to be plugged into message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||