143-1-2

resourceStream = loadBaseResource(name); if (resourceStream != null) { log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG); } else { resourceStream = loadResource(name); if (resourceStream != null) { log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG); } }
resourceStream = loadResource(name); if (resourceStream != null) { log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG); } else { resourceStream = loadBaseResource(name); if (resourceStream != null) { log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG); } }

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/AntClassLoader.java |  | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/AntClassLoader.java
Method name: `InputStream getResourceAsStream(String)` |  | Method name: `InputStream getResourceAsStream(String)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    resourceStream = loadBaseResource(name);↵

1

    resourceStream = loadResource(name);↵

2

                if (resourceStream != null) {↵

2

                if (resourceStream != null) {↵

3

                    log("ResourceStream for " + name↵

3

                    log("ResourceStream for " + name↵

4

                        + " loaded from parent loader", Project.MSG_DEBUG);↵

4

                        + " loaded from ant loader", Project.MSG_DEBUG);↵

5

                } else {↵

5

                } else {↵

6

                    resourceStream = loadResource(name);↵

6

                    resourceStream = loadBaseResource(name);↵

7

                    if (resourceStream != null) {↵

7

                    if (resourceStream != null) {↵

8

                        log("ResourceStream for " + name↵

8

                        log("ResourceStream for " + name↵

9

                            + " loaded from ant loader", Project.MSG_DEBUG);↵

9

                            + " loaded from parent loader", Project.MSG_DEBUG);↵

10

                    }↵

10

                    }↵

11

                }

11

                }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3
Clones location | Clones are in the same method
Number of node comparisons | 14

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 2.2
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   3

       resourceStream = loadBaseResource(name);

   3 | resourceStream = loadBaseResource(name);
   9 | resourceStream = loadResource(name);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   loadBaseResource | loadResource | METHOD_INVOCATION_NAME_MISMATCH

   9

       resourceStream = loadResource(name);

   4

       if (resourceStream != null)

   10

       if (resourceStream != null)

   5

       log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG);

   5 | log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG);
   11 | log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   " loaded from parent loader" | " loaded from ant loader" | LITERAL_VALUE_MISMATCH

   11

       log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG);

       else

       else

   6

       resourceStream = loadResource(name);

   6 | resourceStream = loadResource(name);
   12 | resourceStream = loadBaseResource(name);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   loadResource | loadBaseResource | METHOD_INVOCATION_NAME_MISMATCH

   12

       resourceStream = loadBaseResource(name);

   7

       if (resourceStream != null)

   13

       if (resourceStream != null)

   8

       log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG);

   8 | log("ResourceStream for " + name + " loaded from ant loader", Project.MSG_DEBUG);
   14 | log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   " loaded from ant loader" | " loaded from parent loader" | LITERAL_VALUE_MISMATCH

   14

       log("ResourceStream for " + name + " loaded from parent loader", Project.MSG_DEBUG);

   Precondition Violations (0)
   Row | Violation
   --- | ---