1699-1-2

if (fmt instanceof NumberFormat) { e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue(); } else { e = timeline.getTime(((SimpleDateFormat) fmt) .parse(exceptionString[i])); }
if (fmt instanceof NumberFormat) { e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue(); } else { e = timeline.getTime(((SimpleDateFormat) fmt) .parse(exceptionString[i])); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests.java
Method name: `long[] verifyFillInExceptions(SegmentedTimeline, String[], Format)` |  | Method name: `void fillInBaseTimelineExceptions(SegmentedTimeline, String[], Format)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (fmt instanceof NumberFormat) {↵

1

    if (fmt instanceof NumberFormat) {↵

2

                    e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue();↵

2

                    e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue();↵

3

                }↵

3

                }↵

4

                else {↵

4

                else {↵

5

                    e = timeline.getTime(((SimpleDateFormat) fmt)↵

5

                    e = timeline.getTime(((SimpleDateFormat) fmt)↵

6

                            .parse(exceptionString[i]));↵

6

                            .parse(exceptionString[i]));↵

7

                }

7

                }

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 | 10

1. {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) | 2.1
   Clone type | Type 1

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   6

       if (fmt instanceof NumberFormat)

   4

       if (fmt instanceof NumberFormat)

   7

       e = ((NumberFormat)fmt).parse(exceptionString[i]).longValue();

   5

       e = ((NumberFormat)fmt).parse(exceptionString[i]).longValue();

       else

       else

   8

       e = timeline.getTime(((SimpleDateFormat)fmt).parse(exceptionString[i]));

   6

       e = timeline.getTime(((SimpleDateFormat)fmt).parse(exceptionString[i]));

   Precondition Violations (0)
   Row | Violation
   --- | ---