KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > config > LineConfigException


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.config;
30
31 import com.caucho.util.LineCompileException;
32
33 /**
34  * Thrown by the various Builders
35  */

36 public class LineConfigException extends ConfigException
37   implements LineCompileException, LineException
38 {
39   private String JavaDoc _filename;
40   private int _line = -1;
41
42   /**
43    * Create a null exception
44    */

45   public LineConfigException()
46   {
47   }
48
49   /**
50    * Creates an exception with a message
51    */

52   public LineConfigException(String JavaDoc msg)
53   {
54     super(msg);
55   }
56
57   /**
58    * Creates an exception with a message
59    */

60   public LineConfigException(String JavaDoc msg, Throwable JavaDoc cause)
61   {
62     super(msg, cause);
63   }
64
65   /**
66    * Creates an exception with a message
67    */

68   public LineConfigException(Throwable JavaDoc cause)
69   {
70     super(cause);
71   }
72
73   public LineConfigException(String JavaDoc filename, int line, String JavaDoc message)
74   {
75     super(filename + ":" + line + ": " + message);
76
77     _filename = filename;
78     _line = line;
79   }
80
81   public LineConfigException(String JavaDoc filename, int line, Throwable JavaDoc cause)
82   {
83     super(filename + ":" + line + ": " + cause.getMessage(), cause);
84
85     _filename = filename;
86     _line = line;
87   }
88
89   public LineConfigException(String JavaDoc filename, int line,
90                  String JavaDoc message, Throwable JavaDoc cause)
91   {
92     super(filename + ":" + line + ": " + message, cause);
93
94     _filename = filename;
95     _line = line;
96   }
97
98   public String JavaDoc getFilename()
99   {
100     return _filename;
101   }
102
103   public int getLineNumber()
104   {
105     return _line;
106   }
107
108   public String JavaDoc toString()
109   {
110     return getMessage();
111   }
112 }
113
Popular Tags