1635-1-2

calendar.set(this.year, Calendar.JANUARY, 1, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); // in the following line, we'd rather call calendar.getTimeInMillis() // to avoid object creation, but that isn't supported in Java 1.3.1 return calendar.getTime().getTime();
calendar.set(this.year, Calendar.DECEMBER, 31, 23, 59, 59); calendar.set(Calendar.MILLISECOND, 999); // in the following line, we'd rather call calendar.getTimeInMillis() // to avoid object creation, but that isn't supported in Java 1.3.1 return calendar.getTime().getTime();

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Year.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/time/Year.java
Method name: `long getFirstMillisecond(Calendar)` |  | Method name: `long getLastMillisecond(Calendar)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    calendar.set(this.year, Calendar.JANUARY, 1, 0, 0, 0);↵

1

    calendar.set(this.year, Calendar.DECEMBER, 31, 23, 59, 59);↵

2

            calendar.set(Calendar.MILLISECOND, 0);↵

2

            calendar.set(Calendar.MILLISECOND, 999);↵

3

            // in the following line, we'd rather call calendar.getTimeInMillis()↵

3

            // in the following line, we'd rather call calendar.getTimeInMillis()↵

4

            // to avoid object creation, but that isn't supported in Java 1.3.1↵

4

            // to avoid object creation, but that isn't supported in Java 1.3.1↵

5

            return calendar.getTime().getTime();

5

            return calendar.getTime().getTime();

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.0
Clones location | Clones are declared in the same class
Number of node comparisons | 9

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) | 0.0
   Clone type | Type 2

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

   1

       calendar.set(this.year, Calendar.JANUARY, 1, 0, 0, 0);

   1 | calendar.set(this.year, Calendar.JANUARY, 1, 0, 0, 0);
   1 | calendar.set(this.year, Calendar.DECEMBER, 31, 23, 59, 59);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   JANUARY | DECEMBER | VARIABLE_NAME_MISMATCH
   1 | 31 | LITERAL_VALUE_MISMATCH
   0 | 23 | LITERAL_VALUE_MISMATCH
   0 | 59 | LITERAL_VALUE_MISMATCH
   0 | 59 | LITERAL_VALUE_MISMATCH

   1

       calendar.set(this.year, Calendar.DECEMBER, 31, 23, 59, 59);

   2

       calendar.set(Calendar.MILLISECOND, 0);

   2 | calendar.set(Calendar.MILLISECOND, 0);
   2 | calendar.set(Calendar.MILLISECOND, 999);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0 | 999 | LITERAL_VALUE_MISMATCH

   2

       calendar.set(Calendar.MILLISECOND, 999);

   3

       return calendar.getTime().getTime();

   3

       return calendar.getTime().getTime();

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