File path: /jEdit-4.2/src/org/gjt/sp/jedit/Buffer.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/Buffer.java | |||
Method name: String getLineText(int)
|
Method name: void getLineText(int, Segment)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | if(line < 0 || line >= lineMgr.getLineCount())↵ | 1 | if(line < 0 || line >= lineMgr.getLineCount())↵ | |
2 | throw new ArrayIndexOutOfBoundsException(line);↵ | 2 | throw new ArrayIndexOutOfBoundsException(line);↵ | |
3 | try↵ | 3 | try↵ | |
4 | {↵ | 4 | {↵ | |
5 | readLock();↵ | 5 | readLock();↵ | |
6 | int start = (line == 0 ? 0↵ | 6 | int start = (line == 0 ? 0↵ | |
7 | : lineMgr.getLineEndOffset(line - 1));↵ | 7 | : lineMgr.getLineEndOffset(line - 1));↵ | |
8 | int end = lineMgr.getLineEndOffset(line);↵ | 8 | int end = lineMgr.getLineEndOffset(line);↵ | |
9 | return getText(start,end - start - 1);↵ | 9 | getText(start,end - start - 1,segment);↵ | |
10 | }↵ | 10 | }↵ | |
11 | finally↵ | 11 | finally↵ | |
12 | {↵ | 12 | {↵ | |
13 | readUnlock();↵ | 13 | readUnlock();↵ | |
14 | } | 14 |
| |
See real code fragment | See real code fragment |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 40 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | if (line < 0 || line >= lineMgr.getLineCount()) | 1 | if (line < 0 || line >= lineMgr.getLineCount()) | ||||
2 | throw new ArrayIndexOutOfBoundsException(line); | 2 | throw new ArrayIndexOutOfBoundsException(line); | ||||
3 | try | 3 | try | ||||
4 | readLock(); | 4 | readLock(); | ||||
5 | int start = (line == 0 ? 0 : lineMgr.getLineEndOffset(line - 1)); | 5 | int start = (line == 0 ? 0 : lineMgr.getLineEndOffset(line - 1)); | ||||
6 | int end = lineMgr.getLineEndOffset(line); | 6 | int end = lineMgr.getLineEndOffset(line); | ||||
|
| 7 | getText(start, end - start - 1, segment); | ||||
7 | return getText(start, end - start - 1); |
| |
Row | Violation |
---|---|
1 | Unmatched statement getText(start,end - start - 1,segment); 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 return getText(start,end - start - 1); 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 |
3 | Clone fragment #1 returns variables start, end , while Clone fragment #2 returns variables start, end |