01: // ***************************************************************
02: // * *
03: // * File:CLIPException.java *
04: // * *
05: // * Copyright (c) 2001 Sun Microsystems, Inc. *
06: // * All rights reserved. *
07: // * *
08: // * *
09: // * Date - Dec/12/2001 *
10: // * Author - alejandro.abdelnur@sun.com *
11: // * *
12: // ***************************************************************
13:
14: //package com.iplanet.common.util;
15: package com.sun.portal.desktop.dp.cli;
16:
17: /**
18: * Exception thrown by the CLIPParser if it fails to parse the
19: * argument array.
20: * <P>
21: * CLIPExceptions have a message and the argument number where
22: * the exception happened.
23: * <P>
24: *
25: *
26: * @author <A HREF="mailto:alejandro.abdelnur@sun.com">Alejandro Abdelnur</A>
27: *
28: */
29: public class CLIPException extends Exception {
30: private int _argumentNumber;
31:
32: /**
33: * Creates a CLIPException.
34: * <P>
35: *
36: * @param msg message for the exception.
37: *
38: * @param argumentNumber argument number where the exception
39: * happened or -1 if not directly related to an argument
40: * number.
41: *
42: */
43: public CLIPException(String msg, int argumentNumber) {
44: super (msg);
45: _argumentNumber = argumentNumber;
46: }
47:
48: /**
49: * Returns the argument number where the exception happened.
50: * <P>
51: *
52: * @return the argument number.
53: *
54: */
55: public int getArgumentNumber() {
56: return _argumentNumber;
57: }
58:
59: /**
60: * String representation for the exception.
61: * <P>
62: *
63: * @return String representation.
64: *
65: */
66: public String toString() {
67: return "CLIP exception - " + getMessage()
68: + ", argument index: " + _argumentNumber;
69: }
70:
71: }
|