10771-1-2

char charValue = 0; try { Integer value = new Integer(initialValue); charValue = (char) value.intValue(); } catch (NumberFormatException e) { char[] carray = initialValue.toCharArray(); charValue = carray[0]; } return new Character(charValue);
char charValue = 0; try { Integer value = new Integer(initialValue); charValue = (char) value.intValue(); } catch (NumberFormatException e) { char[] carray = initialValue.toCharArray(); charValue = carray[0]; } return new Character(charValue);

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java
Method name: `Character createECharacterObjectFromString(EDataType, String)` |  | Method name: `Character createECharFromString(EDataType, String)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    char charValue = 0;↵

1

    char charValue = 0;↵

2

        try↵

2

        try↵

3

        {↵

3

        {↵

4

          Integer value = new Integer(initialValue);↵

4

          Integer value = new Integer(initialValue);↵

5

          charValue = (char) value.intValue();↵

5

          charValue = (char) value.intValue();↵

6

        }↵

6

        }↵

7

        catch (NumberFormatException e)↵

7

        catch (NumberFormatException e)↵

8

        {↵

8

        {↵

9

          char[] carray = initialValue.toCharArray();↵

9

          char[] carray = initialValue.toCharArray();↵

10

          charValue = carray[0];↵

10

          charValue = carray[0];↵

11

        }↵

11

        }↵

12

        return new Character(charValue);

12

        return new Character(charValue);

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 5
   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.5
   Clone type | Type 1

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

   3

       char charValue = 0;

   3

       char charValue = 0;

   4

       try

   4

       try

   5

       Integer value = new Integer(initialValue);

   5

       Integer value = new Integer(initialValue);

   6

       charValue = (char)value.intValue();

   6

       charValue = (char)value.intValue();

   7

       return new Character(charValue);

   7

       return new Character(charValue);

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