Date | 2007/07/27 |
---|---|
Codebase | 1010 |
Reviews | 1681 |
DPMO | 577 |
Sigma | 4.75 |
Name | Number | Min | Avg | Max | Total |
---|---|---|---|---|---|
Class complexity | 1 | 14.00 | 14.00 | 14.00 | 14.00 |
Code length | 5 | 1.00 | 7.00 | 20.00 | 35.00 |
File length | 1 | 106.00 | 106.00 | 106.00 | 106.00 |
Operation complexity | 5 | 1.00 | 2.80 | 6.00 | 14.00 |
Work order | 1 | 50.76 | 50.76 | 50.76 | 50.76 |
# | Line | Column | Name | Severity | Description |
---|---|---|---|---|---|
1 | 24 | 1 | ER-023 | 3 | Packages should begin with [] |
2 | 65 | 84 | ER-036 | 3 | Line is too long |
3 | 71 | 98 | ER-036 | 3 | Line is too long |
4 | 82 | 86 | ER-036 | 3 | Line is too long |
5 | 96 | 86 | ER-036 | 3 | Line is too long |
6 | 50 | 1 | ER-049 | 2 | Unify logging strategy - define individual logger for class |
7 | 53 | 5 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
8 | 53 | 5 | ER-109 | 3 | It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule ) |
9 | 57 | 5 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
10 | 57 | 5 | ER-109 | 3 | It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule ) |
11 | 61 | 5 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
12 | 61 | 5 | ER-109 | 3 | It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule ) |
13 | 64 | 11 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
14 | 65 | 42 | ER-030 | 3 | Avoid hardwired string literals |
15 | 73 | 11 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
16 | 75 | 11 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
17 | 77 | 11 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
18 | 82 | 5 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
19 | 83 | 33 | ER-030 | 3 | Avoid hardwired string literals |
20 | 85 | 57 | ER-030 | 3 | Avoid hardwired string literals |
21 | 88 | 15 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
22 | 89 | 46 | ER-030 | 3 | Avoid hardwired string literals |
23 | 90 | 15 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
24 | 96 | 77 | ER-030 | 3 | Avoid hardwired string literals |
25 | 101 | 11 | ER-103 | 2 | Catch-blocks should log the exeption with Log4J.error("Context String" , exception ) |
1/*
2 * Hammurapi
3 * Automated Java code review system.
4 * Copyright (C) 2004 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.org
21 * e-Mail: support@hammurapi.biz
22 */
23
24package org.hammurapi;
25
26import java.io.File;
27import java.io.FileInputStream;
28import java.io.FileNotFoundException;
29import java.io.IOException;
30import java.io.InputStream;
31import java.net.MalformedURLException;
32import java.net.URL;
33import java.util.Date;
34
35import javax.xml.parsers.DocumentBuilderFactory;
36import javax.xml.parsers.ParserConfigurationException;
37import javax.xml.transform.TransformerException;
38
39import org.apache.xpath.XPathAPI;
40import org.w3c.dom.Document;
41import org.w3c.dom.Element;
42import org.w3c.dom.traversal.NodeIterator;
43import org.xml.sax.SAXException;
44
45/**
46 *
47 * @author Pavel Vlasov
48 * @version $Revision: 1.3 $
49 */
50public class DomWaiverSource implements WaiverSource {
51 private Element holder;
52
53 public DomWaiverSource(Element holder) {
54 this.holder=holder;
55 }
56
57 public DomWaiverSource(InputStream in) throws HammurapiException {
58 load(in);
59 }
60
61 public DomWaiverSource(File f) throws HammurapiException {
62 try {
63 load(new FileInputStream(f));
64 } catch (FileNotFoundException e) {
65 throw new HammurapiException("File not found: "+f.getAbsolutePath(), e);
66 }
67 }
68
69 private void load(InputStream in) throws HammurapiException {
70 try {
71 Document document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
72 holder=document.getDocumentElement();
73 } catch (ParserConfigurationException e) {
74 throw new HammurapiException(e.toString(), e);
75 } catch (SAXException e) {
76 throw new HammurapiException(e.toString(), e);
77 } catch (IOException e) {
78 throw new HammurapiException(e.toString(), e);
79 }
80 }
81
82 public void loadWaivers(WaiverSet waiverSet, Date now) throws HammurapiException {
83 if (holder.hasAttribute("base")) {
84 try {
85 URL baseURL=new URL(holder.getAttribute("base"));
86 DomWaiverSource base=new DomWaiverSource(baseURL.openStream());
87 base.loadWaivers(waiverSet, now);
88 } catch (MalformedURLException e) {
89 throw new HammurapiException("Malformed base URL: "+e, e);
90 } catch (IOException e) {
91 throw new HammurapiException(e.toString(), e);
92 }
93 }
94
95 try {
96 NodeIterator waiverIterator=XPathAPI.selectNodeIterator(holder, "waiver");
97 Element waiverElement;
98 while ((waiverElement=(Element) waiverIterator.nextNode())!=null) {
99 waiverSet.addWaiver(new DomWaiver(waiverElement), now);
100 }
101 } catch (TransformerException e) {
102 new HammurapiException(e);
103 }
104 }
105}
106
107