String postalCode = ""; Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE); if (e4 != null) postalCode = e4.getText(); String region = ""; Element e5 = typeElement.getChild(VCARD.ADR_REGION); if (e5 != null) region = e5.getText(); String country = ""; Element e6 = typeElement.getChild(VCARD.ADR_COUNTRY); if (e6 != null) country = e6.getText(); String label = ""; Element e7 = typeElement.getChild(VCARD.LABEL);
String poBox = ""; Element e1 = typeElement.getChild(VCARD.ADR_POSTOFFICEBOX); if (e1 != null) poBox = e1.getText(); String street = ""; Element e2 = typeElement.getChild(VCARD.ADR_STREETADDRESS); if (e2 != null) street = e2.getText(); String locality = ""; Element e3 = typeElement.getChild(VCARD.ADR_LOCALITY); if (e3 != null) locality = e3.getText(); String postalCode = ""; Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/parser/XMLContactDocumentParser.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/parser/XMLContactDocumentParser.java
Method name: Iterator getAddressIterator() Method name: Iterator getAddressIterator()
Number of AST nodes: 14 Number of AST nodes: 14
1
String postalCode = "";
1
String poBox = "";
2
			Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE);
2
			Element e1 = typeElement.getChild(VCARD.ADR_POSTOFFICEBOX);
3
			if (e4 != null)
3
			if (e1 != null)
4
				postalCode = e4.getText();
4
				poBox = e1.getText();
5
			String region = "";
5
			String street = "";
6
			Element e5 = typeElement.getChild(VCARD.ADR_REGION);
6
			Element e2 = typeElement.getChild(VCARD.ADR_STREETADDRESS);
7
			if (e5 != null)
7
			if (e2 != null)
8
				region = e5.getText();
8
				street = e2.getText();
9
			String country = "";
9
			String locality = "";
10
			Element e6 = typeElement.getChild(VCARD.ADR_COUNTRY);
10
			Element e3 = typeElement.getChild(VCARD.ADR_LOCALITY);
11
			if (e6 != null)
11
			if (e3 != null)
12
				country = e6.getText();
12
				locality = e3.getText();
13
			String label = "";
13
			String postalCode = "";
14
			Element e7 = typeElement.getChild(VCARD.LABEL);
14
			Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are in the same method
Number of node comparisons92
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    20
    String postalCode = "";
    20
    String postalCode = "";
    21
    Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE);
    21
    Element e4 = typeElement.getChild(VCARD.ADR_POSTALCODE);
    22
    if (e4 != null)
    22
    if (e4 != null)
    18
    if (e3 != null)
    Differences
    Expression1Expression2Difference
    e4e3VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression e4 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    if (e3 != null)
    23
    postalCode = e4.getText();
    23
    postalCode = e4.getText();
    19
    locality = e3.getText();
    Differences
    Expression1Expression2Difference
    postalCodelocalityVARIABLE_NAME_MISMATCH
    e4e3VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression postalCode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression locality cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e4 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19
    locality = e3.getText();
    24
    String region = "";
    24
    String region = "";
    12
    String street = "";
    Differences
    Expression1Expression2Difference
    regionstreetVARIABLE_NAME_MISMATCH
    12
    String street = "";
    25
    Element e5 = typeElement.getChild(VCARD.ADR_REGION);
    25
    Element e5 = typeElement.getChild(VCARD.ADR_REGION);
    13
    Element e2 = typeElement.getChild(VCARD.ADR_STREETADDRESS);
    Differences
    Expression1Expression2Difference
    e5e2VARIABLE_NAME_MISMATCH
    ADR_REGIONADR_STREETADDRESSVARIABLE_NAME_MISMATCH
    13
    Element e2 = typeElement.getChild(VCARD.ADR_STREETADDRESS);
    26
    if (e5 != null)
    26
    if (e5 != null)
    14
    if (e2 != null)
    Differences
    Expression1Expression2Difference
    e5e2VARIABLE_NAME_MISMATCH
    14
    if (e2 != null)
    27
    region = e5.getText();
    27
    region = e5.getText();
    15
    street = e2.getText();
    Differences
    Expression1Expression2Difference
    regionstreetVARIABLE_NAME_MISMATCH
    e5e2VARIABLE_NAME_MISMATCH
    15
    street = e2.getText();
    28
    String country = "";
    28
    String country = "";
    8
    String poBox = "";
    Differences
    Expression1Expression2Difference
    countrypoBoxVARIABLE_NAME_MISMATCH
    8
    String poBox = "";
    29
    Element e6 = typeElement.getChild(VCARD.ADR_COUNTRY);
    29
    Element e6 = typeElement.getChild(VCARD.ADR_COUNTRY);
    9
    Element e1 = typeElement.getChild(VCARD.ADR_POSTOFFICEBOX);
    Differences
    Expression1Expression2Difference
    e6e1VARIABLE_NAME_MISMATCH
    ADR_COUNTRYADR_POSTOFFICEBOXVARIABLE_NAME_MISMATCH
    9
    Element e1 = typeElement.getChild(VCARD.ADR_POSTOFFICEBOX);
    30
    if (e6 != null)
    30
    if (e6 != null)
    10
    if (e1 != null)
    Differences
    Expression1Expression2Difference
    e6e1VARIABLE_NAME_MISMATCH
    10
    if (e1 != null)
    31
    country = e6.getText();
    31
    country = e6.getText();
    11
    poBox = e1.getText();
    Differences
    Expression1Expression2Difference
    countrypoBoxVARIABLE_NAME_MISMATCH
    e6e1VARIABLE_NAME_MISMATCH
    11
    poBox = e1.getText();
    32
    String label = "";
    32
    String label = "";
    16
    String locality = "";
    Differences
    Expression1Expression2Difference
    labellocalityVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression locality cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    String locality = "";
    33
    Element e7 = typeElement.getChild(VCARD.LABEL);
    33
    Element e7 = typeElement.getChild(VCARD.LABEL);
    17
    Element e3 = typeElement.getChild(VCARD.ADR_LOCALITY);
    Differences
    Expression1Expression2Difference
    e7e3VARIABLE_NAME_MISMATCH
    LABELADR_LOCALITYVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    Element e3 = typeElement.getChild(VCARD.ADR_LOCALITY);
    Precondition Violations (9)
    Row Violation
    1Expression e4 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression postalCode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression locality cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression e4 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression locality cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression e3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Clone fragment #1 returns variables e7, label, postalCode, region, country , while Clone fragment #2 returns variables e4, postalCode, poBox, street, locality