1
2
3 package org.opensync.tools.exception;
4 import javax.xml.parsers.*;
5 import java.io.*;
6 import java.sql.*;
7 import org.xml.sax.SAXException;
8
9 import org.opensync.tools.exception.OpenSyncException;
10
11 /*** Use this for catching all the exceptions which can occur during parsing
12 * of the configuration xml files or any other configuration related
13 * exceptions during initialization.
14 */
15
16 public class APConfigException extends OpenSyncException {
17
18 /***
19 * Error Codes --
20 * ConfError_default = "A CONFIGURATION ERROR OCCURED";
21 * ConfError_incorrect_parser_config = "INCORRECT XML PARSER CONIGURATION";
22 * ConfError_error_parsing_xml = "ERROR IN PARSING INPUT XML";
23 * ConfError_io_operation_failed = "IO OPERATION FAILED OR INTERRUPTED";
24 * ConfError_sql_error = "AN SQL EXCEPTION OCCURED ERROR DURING INITIALIZATION";
25 */
26
27 public APConfigException(Throwable e)
28 {
29 super(e);
30 if(e instanceof ParserConfigurationException)
31 {
32 errorCode = "ConfError_incorrect_parser_config";
33 }
34 else if (e instanceof SAXException )
35 {
36 errorCode = "ConfError_error_parsing_xml";
37 }
38 if(e instanceof FileNotFoundException)
39 {
40 errorCode = "ConfError_file_not_found";
41 }
42 else if(e instanceof IOException)
43 {
44 errorCode = "ConfError_io_operation_failed";
45 }
46 else if(e instanceof SQLException)
47 {
48 errorCode = "ConfError_sql_error";
49 }
50 else
51 {
52 errorCode = "ConfError_default";
53 }
54 }
55
56
57 public APConfigException(String errorCode, Throwable e)
58 {
59 super(errorCode, e);
60 }
61 }