jcmdline
Class CmdLineException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by jcmdline.CmdLineException
All Implemented Interfaces:
java.io.Serializable

public class CmdLineException
extends java.lang.Exception

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.

Version:
jcmdline Rel. 2.0.0 $Id: CmdLineException.java,v 1.2 2002/12/07 14:22:06 lglawrence Exp $
Author:
Lynne Lawrence
See Also:
Serialized Form

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

CmdLineException

public CmdLineException(java.lang.String message)
constructor

Parameters:
message - message associated with the exception

CmdLineException

public CmdLineException(java.lang.String message,
                        java.lang.Object[] params)
constructor

Parameters:
message - message associated with the exception
params - parameters to be plugged into message