KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > protocol > http > modifier > UserParameterXMLErrorHandler


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/UserParameterXMLErrorHandler.java,v 1.6 2004/02/12 00:29:49 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.protocol.http.modifier;
20
21 import org.apache.jorphan.logging.LoggingManager;
22 import org.apache.log.Logger;
23 import org.xml.sax.ErrorHandler JavaDoc;
24 import org.xml.sax.SAXException JavaDoc;
25 import org.xml.sax.SAXParseException JavaDoc;
26
27 /**
28  * XML Parseing errors for XML parameters file are handled here.
29  *
30  * @author Mark Walsh
31  * @version $Revision: 1.6 $
32  */

33 public class UserParameterXMLErrorHandler implements ErrorHandler JavaDoc
34 {
35     transient private static Logger log = LoggingManager.getLoggerForClass();
36
37     public void warning(SAXParseException JavaDoc exception) throws SAXException JavaDoc
38     {
39         log.warn(
40             "**Parsing Warning**\n"
41                 + " line: "
42                 + exception.getLineNumber()
43                 + "\n"
44                 + " URI: :"
45                 + exception.getSystemId()
46                 + "\n"
47                 + " Message: "
48                 + exception.getMessage());
49         throw new SAXException JavaDoc("Warning encountered");
50     }
51
52     public void error(SAXParseException JavaDoc exception) throws SAXException JavaDoc
53     {
54         log.error(
55             "**Parsing Warning**\n"
56                 + " line: "
57                 + exception.getLineNumber()
58                 + "\n"
59                 + " URI: :"
60                 + exception.getSystemId()
61                 + "\n"
62                 + " Message: "
63                 + exception.getMessage());
64         throw new SAXException JavaDoc("Error encountered");
65     }
66
67     public void fatalError(SAXParseException JavaDoc exception) throws SAXException JavaDoc
68     {
69         log.error(
70             "**Parsing Warning**\n"
71                 + " line: "
72                 + exception.getLineNumber()
73                 + "\n"
74                 + " URI: :"
75                 + exception.getSystemId()
76                 + "\n"
77                 + " Message: "
78                 + exception.getMessage());
79         throw new SAXException JavaDoc("Fatal Error encountered");
80     }
81 }
82
Popular Tags