|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
IssueCollector.java | 100% | 100% | 100% | 100% |
|
1 |
/*
|
|
2 |
* Copyright (C) The Spice Group. All rights reserved.
|
|
3 |
*
|
|
4 |
* This software is published under the terms of the Spice
|
|
5 |
* Software License version 1.1, a copy of which has been included
|
|
6 |
* with this distribution in the LICENSE.txt file.
|
|
7 |
*/
|
|
8 |
package org.codehaus.spice.configkit;
|
|
9 |
|
|
10 |
import java.util.List;
|
|
11 |
import org.xml.sax.ErrorHandler;
|
|
12 |
import org.xml.sax.SAXParseException;
|
|
13 |
|
|
14 |
/**
|
|
15 |
* A Error handler used to collect issues reported during validation.
|
|
16 |
*
|
|
17 |
* @author Peter Donald
|
|
18 |
* @version $Revision: 1.1 $ $Date: 2003/12/03 03:19:28 $
|
|
19 |
*/
|
|
20 |
class IssueCollector
|
|
21 |
implements ErrorHandler
|
|
22 |
{ |
|
23 |
/** the list of issues collected. */
|
|
24 |
private final List m_issues;
|
|
25 |
|
|
26 |
/**
|
|
27 |
* Create a collector that adds issues to specified list.
|
|
28 |
*
|
|
29 |
* @param issues the list to add issues to
|
|
30 |
*/
|
|
31 | 120 |
IssueCollector( final List issues ) |
32 |
{ |
|
33 | 120 |
if( null == issues ) |
34 |
{ |
|
35 | 1 |
throw new NullPointerException( "issues" ); |
36 |
} |
|
37 | 119 |
m_issues = issues; |
38 |
} |
|
39 |
|
|
40 |
/**
|
|
41 |
* Add a warning issue to issue list.
|
|
42 |
*
|
|
43 |
* @param exception the exception that caused issue
|
|
44 |
*/
|
|
45 | 1 |
public void warning( final SAXParseException exception ) |
46 |
{ |
|
47 | 1 |
m_issues.add( |
48 |
new ValidationIssue( ValidationIssue.TYPE_WARNING, exception ) );
|
|
49 |
} |
|
50 |
|
|
51 |
/**
|
|
52 |
* Add a error issue to issue list.
|
|
53 |
*
|
|
54 |
* @param exception the exception that caused issue
|
|
55 |
*/
|
|
56 | 46 |
public void error( final SAXParseException exception ) |
57 |
{ |
|
58 | 46 |
m_issues.add( |
59 |
new ValidationIssue( ValidationIssue.TYPE_ERROR, exception ) );
|
|
60 |
} |
|
61 |
|
|
62 |
/**
|
|
63 |
* Add a warning fatalError to issue list.
|
|
64 |
*
|
|
65 |
* @param exception the exception that caused issue
|
|
66 |
*/
|
|
67 | 37 |
public void fatalError( final SAXParseException exception ) |
68 |
{ |
|
69 | 37 |
m_issues.add( |
70 |
new ValidationIssue( ValidationIssue.TYPE_FATAL_ERROR, exception ) );
|
|
71 |
} |
|
72 |
} |
|
73 |
|
|