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