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 constructor = c.getDeclaredConstructor(
new Class[] {Date.class, TimeZone.class});
result = (RegularTimePeriod) constructor.newInstance(
new Object[] {millisecond, zone});
}
catch (Exception e) {
// do nothing, so null is returned
}
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/data/time/RegularTimePeriod.java
|
Method name: RegularTimePeriod createInstance(Class, Date, TimeZone)
|
|
Method name: RegularTimePeriod createInstance(Class, 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 constructor = c.getDeclaredConstructor(↵
|
3 | Date.class, TimeZone.class});↵ | | 3 | new Class[] {Date.class, TimeZone.class});↵
|
4 | result = (RegularTimePeriod) c.newInstance(new Object[] {↵ | | 4 | result = (RegularTimePeriod) constructor.newInstance(↵
|
5 | millisecond, zone}); ↵ | | 5 | new Object[] {millisecond, zone});↵
|
6 | }↵ | | 6 | }↵
|
7 | catch (Exception e) {↵ | | 7 | catch (Exception e) {↵
|
8 | // do nothing ↵ | | 8 | // do nothing, so null is returned ↵
|
9 | } | | 9 | }
|
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) | 0.8 |
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 constructor = c.getDeclaredConstructor(new Class[] {Date.class, TimeZone.class}); |
4 | result = (RegularTimePeriod)c.newInstance(new Object[] {millisecond, zone}); | | 4 | result = (RegularTimePeriod)constructor.newInstance(new Object[] {millisecond, zone}); |
Precondition Violations (0)
Row |
Violation |