Buffer buffer = view.getBuffer();
try
{
buffer.beginCompoundEdit();
file_loop: for(int i = 0; i < paths.length; i++)
runScript(view,paths[i],false);
}
finally
{
buffer.endCompoundEdit();
}
try
{
buffer.beginCompoundEdit();
setSelectedText("\n");
buffer.indentLine(caretLine,true);
}
finally
{
buffer.endCompoundEdit();
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/Macros.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/JEditTextArea.java
|
Method name: void showRunScriptDialog(View)
|
|
Method name: void insertEnterAndIndent()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 4
|
|
1 | Buffer buffer = view.getBuffer();↵ | | |
|
2 | try↵ | | 1 | try↵
|
3 | {↵ | | 2 | {↵
|
4 | buffer.beginCompoundEdit();↵ | | 3 | buffer.beginCompoundEdit();↵
|
|
5 | file_loop: for(int i = 0; i < paths.length; i++)↵ | | |
|
6 | runScript(view,paths[i],fals↵ | | 4 | setSelectedText("\n");↵
|
7 | e);↵ | | 5 | buffer.indentLine(caretLine,true);↵
|
8 | }↵ | | 6 | }↵
|
9 | finally↵ | | 7 | finally↵
|
10 | {↵ | | 8 | {↵
|
11 | buffer.endCompoundEdit();↵ | | 9 | buffer.endCompoundEdit();↵
|
12 | } | | 10 | }
|
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.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | Buffer buffer = view.getBuffer(); | | | |
4 | try | | 3 | try |
5 | buffer.beginCompoundEdit(); | | 4 | buffer.beginCompoundEdit(); |
| | | 5 | |
| | | 6 | buffer.indentLine(caretLine, true); |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement setSelectedText("\n"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched statement buffer.indentLine(caretLine,true); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |