Buffer buffer = jEdit.openTemporary(
view,null,path,false);
/* this is stupid and misleading.
* but 'path' is not used anywhere except
* the above line, and if this is done
* after the 'continue', then we will
* either hang, or be forced to duplicate
* it inside the buffer == null, or add
* a 'finally' clause. you decide which one's
* worse. */
path = fileset.getNextFile(view,path);
if(buffer == null)
continue loop;
Buffer buffer = jEdit.openTemporary(
view,null,path,false);
/* this is stupid and misleading.
* but 'path' is not used anywhere except
* the above line, and if this is done
* after the 'continue', then we will
* either hang, or be forced to duplicate
* it inside the buffer == null, or add
* a 'finally' clause. you decide which one's
* worse. */
path = fileset.getNextFile(view,path);
if(buffer == null)
continue loop;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/search/SearchAndReplace.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/search/SearchAndReplace.java
|
Method name: boolean find(View)
|
|
Method name: boolean replaceAll(View)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | Buffer buffer = jEdit.openTemporary(↵ | | 1 | Buffer buffer = jEdit.openTemporary(↵
|
2 | view,null,path,false);↵ | | 2 | view,null,path,false);↵
|
|
3 | /* this is stupid and misleading.↵ | | 3 | /* this is stupid and misleading.↵
|
4 | * but 'path' is not used anywhere except↵ | | 4 | * but 'path' is not used anywhere except↵
|
5 | * the above line, and if this is done↵ | | 5 | * the above line, and if this is done↵
|
6 | * after the 'continue', then we will↵ | | 6 | * after the 'continue', then we will↵
|
7 | * either hang, or be forced to duplicate↵ | | 7 | * either hang, or be forced to duplicate↵
|
8 | * it inside the buffer == null, or add↵ | | 8 | * it inside the buffer == null, or add↵
|
9 | * a 'finally' clause. you decide which one's↵ | | 9 | * a 'finally' clause. you decide which one's↵
|
10 | * worse. */↵ | | 10 | * worse. */↵
|
11 | path = fileset.getNextFile(view,path);↵ | | 11 | path = fileset.getNextFile(view,path);↵
|
|
12 | if(buffer == null)↵ | | 12 | if(buffer == null)↵
|
13 | continue loop; | | 13 | continue loop;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 10 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 1.0 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
22 | Buffer buffer = jEdit.openTemporary(view, null, path, false); | | 19 | Buffer buffer = jEdit.openTemporary(view, null, path, false); |
23 | path = fileset.getNextFile(view, path); | | 20 | path = fileset.getNextFile(view, path); |
24 | if (buffer == null) | | 21 | if (buffer == null) |
25 | | | 22 | |
Precondition Violations (3)
Row |
Violation |
1 | Statement continue loop; without innermost loop |
2 | Statement continue loop; without innermost loop |
3 | Clone fragment #1 returns variables path, buffer , while Clone fragment #2 returns variables path, buffer |