if(isDrive != null)
{
try
{
return Boolean.TRUE.equals(isDrive.
invoke(fsView, new Object[] { file }));
}
catch(Exception e)
{
Log.log(Log.ERROR,this,e);
return false;
}
}
else
return true;
if(isFloppyDrive != null)
{
try
{
return Boolean.TRUE.equals(isFloppyDrive.
invoke(fsView, new Object[] { file }));
}
catch(Exception e)
{
Log.log(Log.ERROR,this,e);
return false;
}
}
else
return path.startsWith("A:") || path.startsWith("B:");
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/io/FileRootsVFS.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/io/FileRootsVFS.java
|
Method name: boolean isDrive(File)
|
|
Method name: boolean isFloppy(File)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if(isDrive != null)↵ | | 1 | if(isFloppyDrive != null)↵
|
2 | {↵ | | 2 | {↵
|
3 | try↵ | | 3 | try↵
|
4 | {↵ | | 4 | {↵
|
5 | return Boolean.TRUE.equals(isDrive.↵ | | 5 | return Boolean.TRUE.equals(isFloppyDrive.↵
|
6 | invoke(fsView, new Object[] { file }));↵ | | 6 | invoke(fsView, new Object[] { file }));↵
|
7 | }↵ | | 7 | }↵
|
8 | catch(Exception e)↵ | | 8 | catch(Exception e)↵
|
9 | {↵ | | 9 | {↵
|
10 | Log.log(Log.ERROR,this,e);↵ | | 10 | Log.log(Log.ERROR,this,e);↵
|
11 | return false;↵ | | 11 | return false;↵
|
12 | }↵ | | 12 | }↵
|
13 | }↵ | | 13 | }↵
|
14 | else↵ | | 14 | else↵
|
15 | return true; | | 15 | return path.startsWith("A:") || path.startsWith("B:");
|
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) | 1.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 8 |
-
{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) | 2.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (isDrive != null) | | 1 | if (isFloppyDrive != null) |
2 | | | 2 | |
3 | return Boolean.TRUE.equals(isDrive.invoke(fsView, new Object[] {file})); | | 3 | return Boolean.TRUE.equals(isFloppyDrive.invoke(fsView, new Object[] {file})); |
| | | | |
4 | | | 4 | return path.startsWith("A:") || path.startsWith("B:"); |
Precondition Violations (0)
Row |
Violation |