e = replyToList.elements(); while (e.hasMoreElements()) { msg.replyto(e.nextElement().toString()); } e = toList.elements(); while (e.hasMoreElements()) { msg.to(e.nextElement().toString()); } e = ccList.elements(); while (e.hasMoreElements()) { msg.cc(e.nextElement().toString()); }
e = toList.elements(); while (e.hasMoreElements()) { mailMessage.to(e.nextElement().toString()); } e = ccList.elements(); while (e.hasMoreElements()) { mailMessage.cc(e.nextElement().toString()); } e = bccList.elements(); while (e.hasMoreElements()) { mailMessage.bcc(e.nextElement().toString()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/mail/MailMessageTest.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/email/PlainMailer.java
Method name: void run() Method name: void send()
Number of AST nodes: 9 Number of AST nodes: 9
1
e = replyToList.elements();
1
e = toList.elements();
2
                while (e.hasMoreElements()) {
2
            while (e.hasMoreElements()) {
3
                    msg.replyto(e.nextElement().toString());
3
                mailMessage.to(e.nextElement().toString());
4
                }
4
            
5
  
5
}
6
              e = toList.elements();
6
            e = ccList.elements();
7
                while (e.hasMoreElements()) {
7
            while (e.hasMoreElements()) {
8
                    msg.to(e.nextElement().toString());
8
                mailMessage.cc(e.nextElement().toString());
9
                }
9
            
10
   
10
}
11
             e = ccList.elements();
11
            e = bccList.elements();
12
                while (e.hasMoreElements()) {
12
            while (e.hasMoreElements()) {
13
                    msg.cc(e.nextElement().toString());
13
                mailMessage.bcc(e.nextElement().toString());
14
                }
14
            }
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 different classes
Number of node comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)118.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    e = replyToList.elements();
    13
    e = replyToList.elements();
    8
    e = toList.elements();
    Differences
    Expression1Expression2Difference
    replyToListtoListVARIABLE_NAME_MISMATCH
    8
    e = toList.elements();
    14
    while (e.hasMoreElements())
    9
    while (e.hasMoreElements())
    15
    msg.replyto(e.nextElement().toString());
    15
    msg.replyto(e.nextElement().toString());
    10
    mailMessage.to(e.nextElement().toString());
    Differences
    Expression1Expression2Difference
    replytotoMETHOD_INVOCATION_NAME_MISMATCH
    msgmailMessageVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression msg.replyto(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mailMessage.to(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression msg.replyto(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    Expression mailMessage.to(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    10
    mailMessage.to(e.nextElement().toString());
    16
    e = toList.elements();
    16
    e = toList.elements();
    11
    e = ccList.elements();
    Differences
    Expression1Expression2Difference
    toListccListVARIABLE_NAME_MISMATCH
    11
    e = ccList.elements();
    17
    while (e.hasMoreElements())
    12
    while (e.hasMoreElements())
    18
    msg.to(e.nextElement().toString());
    18
    msg.to(e.nextElement().toString());
    13
    mailMessage.cc(e.nextElement().toString());
    Differences
    Expression1Expression2Difference
    toccMETHOD_INVOCATION_NAME_MISMATCH
    msgmailMessageVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression msg.to(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mailMessage.cc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression msg.to(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    Expression mailMessage.cc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    13
    mailMessage.cc(e.nextElement().toString());
    19
    e = ccList.elements();
    19
    e = ccList.elements();
    14
    e = bccList.elements();
    Differences
    Expression1Expression2Difference
    ccListbccListVARIABLE_NAME_MISMATCH
    14
    e = bccList.elements();
    20
    while (e.hasMoreElements())
    15
    while (e.hasMoreElements())
    21
    msg.cc(e.nextElement().toString());
    21
    msg.cc(e.nextElement().toString());
    16
    mailMessage.bcc(e.nextElement().toString());
    Differences
    Expression1Expression2Difference
    ccbccMETHOD_INVOCATION_NAME_MISMATCH
    msgmailMessageVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression msg.cc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mailMessage.bcc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression msg.cc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    Expression mailMessage.bcc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    16
    mailMessage.bcc(e.nextElement().toString());
    Precondition Violations (13)
    Row Violation
    1Expression msg.replyto(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression mailMessage.to(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression msg.replyto(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    4Expression mailMessage.to(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    5Expression msg.to(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression mailMessage.cc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression msg.to(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    8Expression mailMessage.cc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    9Expression msg.cc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression mailMessage.bcc(e.nextElement().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression msg.cc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    12Expression mailMessage.bcc(e.nextElement().toString()) is a void method call, and thus it cannot be parameterized
    13The refactoring of the clones is infeasible, because classes org.apache.tools.mail.MailMessageTest.ClientThread and org.apache.tools.ant.taskdefs.email.PlainMailer do not have a common superclass