1326-1-3

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Minute m = new Minute(43, 15, 1, 4, 2006); assertEquals(1143902580000L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Second s = new Second(15, 43, 15, 1, 4, 2006); assertEquals(1143902595000L, s.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MinuteTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/SecondTests.java
Method name: `void testGetFirstMillisecond()` |  | Method name: `void testGetFirstMillisecond()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    Locale saved = Locale.getDefault();↵

1

    Locale saved = Locale.getDefault();↵

2

            Locale.setDefault(Locale.UK);↵

2

            Locale.setDefault(Locale.UK);↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

4

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

4

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

5

            Minute m = new Minute(43, 15, 1, 4, 2006);↵

5

            Second s = new Second(15, 43, 15, 1, 4, 2006);↵

6

            assertEquals(1143902580000L, m.getFirstMillisecond());↵

6

            assertEquals(1143902595000L, s.getFirstMillisecond());↵

7

            Locale.setDefault(saved);↵

7

            Locale.setDefault(saved);↵

8

            TimeZone.setDefault(savedZone);

8

            TimeZone.setDefault(savedZone);

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 in different classes having the same super class
Number of node comparisons | 50

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 8
   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

       Locale saved = Locale.getDefault();

   1

       Locale saved = Locale.getDefault();

   2

       Locale.setDefault(Locale.UK);

   2

       Locale.setDefault(Locale.UK);

   3

       TimeZone savedZone = TimeZone.getDefault();

   3

       TimeZone savedZone = TimeZone.getDefault();

   4

       TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));

   4

       TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));

   5

       Minute m = new Minute(43, 15, 1, 4, 2006);

   5 | Minute m = new Minute(43, 15, 1, 4, 2006);
   5 | Second s = new Second(15, 43, 15, 1, 4, 2006);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Minute | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   m | s | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   new Minute(43,15,1,4,2006) | new Second(15,43,15,1,4,2006) | ARGUMENT_NUMBER_MISMATCH

   5

       Second s = new Second(15, 43, 15, 1, 4, 2006);

   6

       assertEquals(1143902580000L, m.getFirstMillisecond());

   6 | assertEquals(1143902580000L, m.getFirstMillisecond());
   6 | assertEquals(1143902595000L, s.getFirstMillisecond());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1143902580000L | 1143902595000L | LITERAL_VALUE_MISMATCH
   m | s | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH

   6

       assertEquals(1143902595000L, s.getFirstMillisecond());

   7

       Locale.setDefault(saved);

   7

       Locale.setDefault(saved);

   8

       TimeZone.setDefault(savedZone);

   8

       TimeZone.setDefault(savedZone);

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