try {
Constructor c = periodClass.getDeclaredConstructor(new Class[] {
Date.class, TimeZone.class});
result = (RegularTimePeriod) c.newInstance(new Object[] {
millisecond, zone});
}
catch (Exception e) {
// do nothing
}
try {
Constructor c = this.periodClass.getDeclaredConstructor(
new Class[] {Date.class, TimeZone.class}
);
result = (RegularTimePeriod) c.newInstance(
new Object[] {millisecond, zone}
);
}
catch (Exception e) {
// do nothing
}
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/PeriodAxis.java
|
|
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/PeriodAxisLabelInfo.java
|
Method name: RegularTimePeriod createInstance(Class, Date, TimeZone)
|
|
Method name: RegularTimePeriod createInstance(Date, TimeZone)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | 1 | try {↵
|
2 | Constructor c = periodClass.getDeclaredConstructor(new Class[] {↵ | | 2 | Constructor c = this.periodClass.getDeclaredConstructor(↵
|
3 | Date.class, TimeZone.class}↵ | | 3 | new Class[] {Date.class, TimeZone.class}↵
|
4 | );↵ | | 4 | );↵
|
5 | result = (RegularTimePeriod) c.newInstance(new Object[] {↵ | | 5 | result = (RegularTimePeriod) c.newInstance(↵
|
6 | millisecond, zone}↵ | | 6 | new Object[] {millisecond, zone}↵
|
7 | ); ↵ | | 7 | ); ↵
|
8 | }↵ | | 8 | }↵
|
9 | catch (Exception e) {↵ | | 9 | catch (Exception e) {↵
|
10 | // do nothing ↵ | | 10 | // do nothing ↵
|
11 | } | | 11 | }
|
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 9 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | try | | 2 | try |
3 | Constructor c = periodClass.getDeclaredConstructor(new Class[] {Date.class, TimeZone.class}); | | 3 | Constructor c = this.periodClass.getDeclaredConstructor(new Class[] {Date.class, TimeZone.class}); |
4 | result = (RegularTimePeriod)c.newInstance(new Object[] {millisecond, zone}); | | 4 | result = (RegularTimePeriod)c.newInstance(new Object[] {millisecond, zone}); |
Precondition Violations (0)
Row |
Violation |