if (server == null) { throw new BuildException("No Server Specified"); } /** A userid and password must appear together * if they appear. They are not required. */ if (userid == null && password != null) { throw new BuildException("No Userid Specified"); } if (password == null && userid != null) { throw new BuildException("No Password Specified"); } /** Create the telnet client object */ AntTelnetClient telnet = null;
if (server == null) { throw new BuildException("No Server Specified"); } /** A userid and password must appear together * if they appear. They are not required. */ if (userid == null && password != null) { throw new BuildException("No Userid Specified"); } if (password == null && userid != null) { throw new BuildException("No Password Specified"); } /** Create the telnet client object */ AntRExecClient rexec = null;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 7 Number of AST nodes: 7
1
if (server == null) {
1
if (server == null) {
2
           throw new BuildException("No Server Specified");
2
            throw new BuildException("No Server Specified");
3
       }
3
        }
4
       /**  A userid and password must appear together
4
        /**  A userid and password must appear together
5
        *   if they appear.  They are not required.
5
         *   if they appear.  They are not required.
6
        */
6
         */
7
       if (userid == null && password != null) {
7
        if (userid == null && password != null) {
8
           throw new BuildException("No Userid Specified");
8
            throw new BuildException("No Userid Specified");
9
       }
9
        }
10
       if (password == null && userid != null) {
10
        if (password == null && userid != null) {
11
           throw new BuildException("No Password Specified");
11
            throw new BuildException("No Password Specified");
12
       }
12
        }
13
       /**  Create the telnet client object */
13
        /**  Create the telnet client object */
14
       AntTelnetClient telnet = null;
14
        AntRExecClient rexec = null;
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (server == null)
    1
    if (server == null)
    2
    throw new BuildException("No Server Specified");
    2
    throw new BuildException("No Server Specified");
    3
    if (userid == null && password != null)
    3
    if (userid == null && password != null)
    4
    throw new BuildException("No Userid Specified");
    4
    throw new BuildException("No Userid Specified");
    5
    if (password == null && userid != null)
    5
    if (password == null && userid != null)
    6
    throw new BuildException("No Password Specified");
    6
    throw new BuildException("No Password Specified");
    7
    AntTelnetClient telnet = null;
    7
    AntTelnetClient telnet = null;
    7
    AntRExecClient rexec = null;
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.net.TelnetTask.AntTelnetClientorg.apache.tools.ant.taskdefs.optional.net.RExecTask.AntRExecClientSUBCLASS_TYPE_MISMATCH
    telnetrexecVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.net.TelnetTask.AntTelnetClientorg.apache.tools.ant.taskdefs.optional.net.RExecTask.AntRExecClientSUBCLASS_TYPE_MISMATCH
    7
    AntRExecClient rexec = null;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variable telnet with type org.apache.tools.ant.taskdefs.optional.net.TelnetTask.AntTelnetClient , while Clone fragment #2 returns variable rexec with type org.apache.tools.ant.taskdefs.optional.net.RExecTask.AntRExecClient