File f = new File(cP[i]); // not necessary as JDepend would fail, but why loose // some time? if (!f.exists()) { String msg = "\"" + f.getPath() + "\" does not represent a valid" + " file or directory. JDepend would fail."; log(msg); throw new BuildException(msg); } try { jdepend.addDirectory(f.getPath()); } catch (IOException e) { String msg = "JDepend Failed when adding a class directory: " + e.getMessage(); log(msg); throw new BuildException(msg); }
File f = new File(sP[i]); // not necessary as JDepend would fail, but why loose // some time? if (!f.exists() || !f.isDirectory()) { String msg = "\"" + f.getPath() + "\" does not represent a valid" + " directory. JDepend would fail."; log(msg); throw new BuildException(msg); } try { jdepend.addDirectory(f.getPath()); } catch (IOException e) { String msg = "JDepend Failed when adding a source directory: " + e.getMessage(); log(msg); throw new BuildException(msg); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
Method name: int executeInVM(CommandlineJava) Method name: int executeInVM(CommandlineJava)
Number of AST nodes: 7 Number of AST nodes: 7
1
File f = new File(cP[i]);
1
File f = new File(sP[i]);
2
                    // not necessary as JDepend would fail, but why loose
2
                    // not necessary as JDepend would fail, but why loose
3
                    // some time?
3
                    // some time?
4
                    if (!f.exists()) {
4
                    if (!f.exists() || !f.isDirectory()) {
5
                        String msg = "\""
5
                        String msg = "\""
6
                            + f.getPath()
6
                            + f.getPath()
7
                            + "\" does not represent a valid"
7
                            + "\" does not represent a valid"
8
                            + " file or directory. JDepend would fail.";
8
                            + " directory. JDepend would fail.";
9
                        log(msg);
9
                        log(msg);
10
                        throw new BuildException(msg);
10
                        throw new BuildException(msg);
11
                    }
11
                    }
12
                    try {
12
                    try {
13
                        jdepend.addDirectory(f.getPath());
13
                        jdepend.addDirectory(f.getPath());
14
                    } catch (IOException e) {
14
                    } catch (IOException e) {
15
                        String msg =
15
                        String msg =
16
                            "JDepend Failed when adding a class directory: "
16
                            "JDepend Failed when adding a source directory: "
17
                            + e.getMessage();
17
                            + e.getMessage();
18
                        log(msg);
18
                        log(msg);
19
                        throw new BuildException(msg);
19
                        throw new BuildException(msg);
20
                    }
20
                    }
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.8
Clones locationClones are in the same method
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    15
    File f = new File(cP[i]);
    15
    File f = new File(cP[i]);
    25
    File f = new File(sP[i]);
    Differences
    Expression1Expression2Difference
    cPsPVARIABLE_NAME_MISMATCH
    25
    File f = new File(sP[i]);
    16
    if (!f.exists())
    16
    if (!f.exists())
    Preondition Violations
    Unmatched statement if(!f.exists()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    17
    String msg = "\"" + f.getPath() + "\" does not represent a valid" + " file or directory. JDepend would fail.";
    17
    String msg = "\"" + f.getPath() + "\" does not represent a valid" + " file or directory. JDepend would fail.";
    Preondition Violations
    Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " file or directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                  
    18
    log(msg);
                              
    19
    throw new BuildException(msg);
    19
    throw new BuildException(msg);
    Preondition Violations
    Unmatched throw new BuildException(msg);
                                                                        
                                                                                  
    26
    if (!f.exists() || !f.isDirectory())
    Preondition Violations
    Unmatched statement if(!f.exists() || !f.isDirectory()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    26
    if (!f.exists() || !f.isDirectory())
                                                                                                                                                                                                                  
    27
    String msg = "\"" + f.getPath() + "\" does not represent a valid" + " directory. JDepend would fail.";
    Preondition Violations
    Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    27
    String msg = "\"" + f.getPath() + "\" does not represent a valid" + " directory. JDepend would fail.";
                              
    28
    log(msg);
                                                                        
    29
    throw new BuildException(msg);
    Preondition Violations
    Unmatched throw new BuildException(msg);
    29
    throw new BuildException(msg);
    20
    try
    20
    try
    30
    try
    Differences
    Expression1Expression2Difference
    "JDepend Failed when adding a class directory: ""JDepend Failed when adding a source directory: "LITERAL_VALUE_MISMATCH
    30
    try
    21
    jdepend.addDirectory(f.getPath());
    31
    jdepend.addDirectory(f.getPath());
    Precondition Violations (6)
    Row Violation
    1Unmatched statement if(!f.exists()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " file or directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched throw new BuildException(msg);
    4Unmatched statement if(!f.exists() || !f.isDirectory()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched throw new BuildException(msg);