AccumulatingExceptionSink.java
biz/hammurapi/util/AccumulatingExceptionSink.java
Violations
Inspector |
Message |
Severity |
Location |
Java Inspector 048 |
Copyrights information should be present in each file. |
1 |
|
Java Inspector 058 |
Make inner classes "private" |
1 |
37:9
|
Java Inspector 068 |
Do not use System.out and System.err to output logging messages. Use loggers instead. |
2 |
73:43
|
Java Inspector 089 |
Type is not documented |
2 |
34:1
|
Java Inspector 089 |
Non-private, non-local types shall be documented |
2 |
37:9
|
Java Inspector 089 |
Undocumented method |
2 |
46:17
|
Java Inspector 089 |
Undocumented method |
2 |
49:17
|
Java Inspector 089 |
Undocumented method |
2 |
54:9
|
Java Inspector 089 |
Undocumented method |
2 |
58:9
|
Java Inspector 089 |
Undocumented method |
2 |
62:9
|
Java Inspector 026 |
Avoid hardwired string literals. Allowed literals: [] |
3 |
73:44
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23package biz.hammurapi.util;
24
25import java.util.Collections;
26import java.util.Iterator;
27import java.util.LinkedList;
28import java.util.List;
29
30
31
32
33
34public class AccumulatingExceptionSink implements ExceptionSink {
35 private List exceptions=new LinkedList();
36
37 public class Entry {
38 Entry(Object source, Exception exception) {
39 super();
40 this.source = source;
41 this.exception = exception;
42 }
43 Object source;
44 Exception exception;
45
46 public Exception getException() {
47 return exception;
48 }
49 public Object getSource() {
50 return source;
51 }
52 }
53
54 public synchronized void consume(Object source, Exception e) {
55 exceptions.add(new Entry(source, e));
56 }
57
58 public synchronized List getExceptions() {
59 return Collections.unmodifiableList(exceptions);
60 }
61
62 public synchronized void reset() {
63 exceptions.clear();
64 }
65
66
67
68
69 public synchronized void dump() {
70 Iterator it=exceptions.iterator();
71 while (it.hasNext()) {
72 Entry entry=(Entry) it.next();
73 System.err.println("Source: "+entry.getSource());
74 entry.getException().printStackTrace();
75 }
76 }
77}
78