if (project == null) { if (workingDir == null) { return exec(project, cmd, env); } throw new IOException("Cannot locate antRun script: " + "No project provided"); } // Locate the auxiliary script String antHome = project.getProperty(MagicNames.ANT_HOME); if (antHome == null) { throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); } String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); // Build the command File commandDir = workingDir; if (workingDir == null && project != null) { commandDir = project.getBaseDir(); } String[] newcmd = new String[cmd.length + 2];
if (project == null) { if (workingDir == null) { return exec(project, cmd, env); } throw new IOException("Cannot locate antRun script: " + "No project provided"); } // Locate the auxiliary script String antHome = project.getProperty(MagicNames.ANT_HOME); if (antHome == null) { throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); } String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); // Build the command File commandDir = workingDir; if (workingDir == null && project != null) { commandDir = project.getBaseDir(); } String[] newcmd = new String[cmd.length + 3];
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Execute.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Execute.java
Method name: Process exec(Project, String[], String[], File) Method name: Process exec(Project, String[], String[], File)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (project == null) {
1
if (project == null) {
2
                if (workingDir == null) {
2
                if (workingDir == null) {
3
                    return exec(project, cmd, env);
3
                    return exec(project, cmd, env);
4
                }
4
                }
5
                throw new IOException("Cannot locate antRun script: "
5
                throw new IOException("Cannot locate antRun script: "
6
                    + "No project provided");
6
                    + "No project provided");
7
            }
7
            }
8
            // Locate the auxiliary script
8
            // Locate the auxiliary script
9
            String antHome = project.getProperty(MagicNames.ANT_HOME);
9
            String antHome = project.getProperty(MagicNames.ANT_HOME);
10
            if (antHome == null) {
10
            if (antHome == null) {
11
                throw new IOException("Cannot locate antRun script: "
11
                throw new IOException("Cannot locate antRun script: "
12
                    + "Property '" + MagicNames.ANT_HOME + "' not found");
12
                    + "Property '" + MagicNames.ANT_HOME + "' not found");
13
            }
13
            }
14
            String antRun =
14
            String antRun =
15
                FILE_UTILS.resolveFile(project.getBaseDir(),
15
                FILE_UTILS.resolveFile(project.getBaseDir(),
16
                        antHome + File.separator + myScript).toString();
16
                        antHome + File.separator + myScript).toString();
17
            // Build the command
17
            // Build the command
18
            File commandDir = workingDir;
18
            File commandDir = workingDir;
19
            if (workingDir == null && project != null) {
19
            if (workingDir == null && project != null) {
20
                commandDir = project.getBaseDir();
20
                commandDir = project.getBaseDir();
21
            }
21
            }
22
            String[] newcmd = new String[cmd.length + 2];
22
            String[] newcmd = new String[cmd.length + 3];
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.4
Clones locationClones are in the same java file
Number of node comparisons34
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (project == null)
    1
    if (project == null)
    2
    if (workingDir == null)
    2
    if (workingDir == null)
    3
    return exec(project, cmd, env);
    3
    return exec(project, cmd, env);
    4
    throw new IOException("Cannot locate antRun script: " + "No project provided");
    4
    throw new IOException("Cannot locate antRun script: " + "No project provided");
    5
    String antHome = project.getProperty(MagicNames.ANT_HOME);
    5
    String antHome = project.getProperty(MagicNames.ANT_HOME);
    6
    if (antHome == null)
    6
    if (antHome == null)
    7
    throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found");
    7
    throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found");
    8
    String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString();
    8
    String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString();
    9
    File commandDir = workingDir;
    9
    File commandDir = workingDir;
    10
    if (workingDir == null && project != null)
    10
    if (workingDir == null && project != null)
    11
    commandDir = project.getBaseDir();
    11
    commandDir = project.getBaseDir();
    12
    String[] newcmd = new String[cmd.length + 2];
    12
    String[] newcmd = new String[cmd.length + 2];
    12
    String[] newcmd = new String[cmd.length + 3];
    Differences
    Expression1Expression2Difference
    23LITERAL_VALUE_MISMATCH
    12
    String[] newcmd = new String[cmd.length + 3];
    Precondition Violations (2)
    Row Violation
    1Clone fragment #1 returns variables antRun, newcmd, commandDir , while Clone fragment #2 returns variables newcmd, antRun, commandDir
    2Not all possible execution flows end in a return statement