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]; newcmd[0] = antRun; newcmd[1] = commandDir.getAbsolutePath();
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]; newcmd[0] = "perl"; newcmd[1] = antRun;
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: 14 Number of AST nodes: 14
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];
23
            newcmd[0] = antRun;
23
            newcmd[0] = "perl";
24
            newcmd[1] = commandDir.getAbsolutePath();
24
            newcmd[1] = antRun;
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 java file
Number of node comparisons57
  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)3.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];
    13
    newcmd[0] = antRun;
    13
    newcmd[0] = antRun;
    14
    newcmd[1] = antRun;
    Differences
    Expression1Expression2Difference
    01LITERAL_VALUE_MISMATCH
    14
    newcmd[1] = antRun;
    14
    newcmd[1] = commandDir.getAbsolutePath();
    14
    newcmd[1] = commandDir.getAbsolutePath();
    13
    newcmd[0] = "perl";
    Differences
    Expression1Expression2Difference
    10LITERAL_VALUE_MISMATCH
    commandDir.getAbsolutePath()"perl"TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression commandDir.getAbsolutePath() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    newcmd[0] = "perl";
    Precondition Violations (2)
    Row Violation
    1Expression commandDir.getAbsolutePath() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Clone fragment #1 returns variable newcmd with type java.lang.String[] , while Clone fragment #2 returns variable commandDir with type java.io.File