try {
processListeners(
new ListenerProcesser() {
public void processListener(Object listener) {
if ( listener instanceof Destructible ) {
( ( Destructible ) listener ).cleanup();
}
}
}
);
}
catch ( Exception e ) {
throw new HibernateException("could not destruct listeners", e);
}
try {
processListeners(
new ListenerProcesser() {
public void processListener(Object listener) {
if ( listener instanceof Initializable ) {
( ( Initializable ) listener ).initialize( cfg );
}
}
}
);
}
catch ( Exception e ) {
throw new HibernateException("could not init listeners", e);
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/EventListeners.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/EventListeners.java
|
Method name: void destroyListeners()
|
|
Method name: void initializeListeners(Configuration)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | try {↵ | | 1 | try {↵
|
2 | processListeners(↵ | | 2 | processListeners(↵
|
3 | new ListenerProcesser() {↵ | | 3 | new ListenerProcesser() {↵
|
4 | public void processListener(Object listener) {↵ | | 4 | public void processListener(Object listener) {↵
|
5 | if ( listener instanceof Destructible ) {↵ | | 5 | if ( listener instanceof Initializable ) {↵
|
6 | ( ( Destructible ) listener ).cleanup();↵ | | 6 | ( ( Initializable ) listener ).initialize( cfg );↵
|
7 | }↵ | | 7 | }↵
|
8 | }↵ | | 8 | }↵
|
9 | }↵ | | 9 | }↵
|
10 | );↵ | | 10 | );↵
|
11 | }↵ | | 11 | }↵
|
12 | catch ( Exception e ) {↵ | | 12 | catch ( Exception e ) {↵
|
13 | throw new HibernateException("could not destruct listeners", e);↵ | | 13 | throw new HibernateException("could not init listeners", e);↵
|
14 | } | | 14 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 4 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | try | | 1 | try |
| | | 2 | processListeners(new ListenerProcesser() {...}); |
2 | processListeners(new ListenerProcesser() {...}); | | | |
Precondition Violations (0)
Row |
Violation |