InputStream is = url.openStream(); try { props.load(is); } finally { if (is != null) { is.close(); } } addProperties(props);
FileInputStream fis = new FileInputStream(file); try { props.load(fis); } finally { if (fis != null) { fis.close(); } } addProperties(props);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Property.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Property.java
Method name: void loadUrl(URL) Method name: void loadFile(File)
Number of AST nodes: 4 Number of AST nodes: 4
1
InputStream is = url.openStream();
1
FileInputStream fis = 
2
new FileInputStream(file);
2
            try {
3
                try {
3
                props.load(is);
4
                    props.load(fis);
4
            } finally {
5
                } finally {
5
                if (is != null) {
6
                    if (fis != null) {
6
                    is.close();
7
                        fis.close();
7
                }
8
                    }
8
            }
9
            
10
    }
9
            addProperties(props);
11
                addProperties(props);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    InputStream is = url.openStream();
    4
    InputStream is = url.openStream();
    5
    FileInputStream fis = new FileInputStream(file);
    Differences
    Expression1Expression2Difference
    java.io.InputStreamjava.io.FileInputStreamSUBCLASS_TYPE_MISMATCH
    isfisVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.FileInputStreamSUBCLASS_TYPE_MISMATCH
    url.openStream()new FileInputStream(file)TYPE_COMPATIBLE_REPLACEMENT
    5
    FileInputStream fis = new FileInputStream(file);
    5
    try
    5
    try
    6
    try
    Differences
    Expression1Expression2Difference
    isfisVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.FileInputStreamSUBCLASS_TYPE_MISMATCH
    isfisVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.FileInputStreamSUBCLASS_TYPE_MISMATCH
    6
    try
    6
    props.load(is);
    6
    props.load(is);
    7
    props.load(fis);
    Differences
    Expression1Expression2Difference
    isfisVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.FileInputStreamSUBCLASS_TYPE_MISMATCH
    7
    props.load(fis);
    7
    addProperties(props);
    8
    addProperties(props);
    Precondition Violations (0)
    Row Violation