if (position < document.getLength())
{
try
{
char c = document.getText((int) position, 1).charAt(0);
position++;
return c;
}
catch (BadLocationException x)
{
return -1;
}
}
else
{
return -1;
}
if (position < document.getLength())
{
try
{
char c = document.getText((int) position, 1).charAt(0);
position++;
return c;
}
catch (BadLocationException x)
{
return -1;
}
}
else
{
return -1;
}
Clone fragments detected by clone detection tool
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/oster/DocReader.java
|
|
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/oster/OsterTextControl.java
|
Method name: int read()
|
|
Method name: int read()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (position < document.getLength())
↵ | | 1 | if (position < document.getLength())↵
|
2 | {
↵ | | 2 | {↵
|
3 | try
↵ | | 3 | try↵
|
4 | {
↵ | | 4 | {↵
|
5 | char c = document.getText((int) position, 1).charAt(0);
↵ | | 5 | char c = document.getText((int) position, 1).charAt(0);↵
|
6 | position++;
↵ | | 6 | position++;↵
|
7 | return c;
↵ | | 7 | return c;↵
|
8 | }
↵ | | 8 | }↵
|
9 | catch (BadLocationException x)
↵ | | 9 | catch (BadLocationException x)↵
|
10 | {
↵ | | 10 | {↵
|
11 | return -1;
↵ | | 11 | return -1;↵
|
12 | }
↵ | | 12 | }↵
|
13 | }
↵ | | 13 | }↵
|
14 | else
↵ | | 14 | else↵
|
15 | {
↵ | | 15 | {↵
|
16 | return -1;
↵ | | 16 | return -1;↵
|
17 | } | | 17 | }
|
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 20 |
-
{Non-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) | 1.4 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (position < document.getLength()) | | 1 | if (position < document.getLength()) |
2 | | | 2 | |
3 | char c = document.getText((int)position, 1).charAt(0); | | 3 | char c = document.getText((int)position, 1).charAt(0); |
4 | | | 4 | |
5 | | | 5 | |
| | | | |
6 | | | 6 | |
Precondition Violations (1)
Row |
Violation |
1 | Not all possible execution flows end in a return statement |