RubyIO file = newFile(context, recv, path);
if (!offset.isNil()) file.seek(context, offset);
try {
return !length.isNil() ? file.read(context, length) : file.read(context);
} finally {
file.close();
}
RubyIO file = newFile(context, recv, path);
if (!offset.isNil()) file.seek(context, offset);
try {
return !length.isNil() ? file.read(context, length) : file.read(context);
} finally {
file.close();
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyIO.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyIO.java
|
Method name: IRubyObject read19(ThreadContext, IRubyObject, IRubyObject, IRubyObject, IRubyObject, RubyHash)
|
|
Method name: IRubyObject read(ThreadContext, IRubyObject, IRubyObject, IRubyObject, IRubyObject)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | RubyIO file = newFile(context, recv, path);↵ | | 1 | RubyIO file = newFile(context, recv, path);↵
|
|
2 | if (!offset.isNil()) file.seek(context, offset);↵ | | 2 | if (!offset.isNil()) file.seek(context, offset);↵
|
|
3 | try {↵ | | 3 | try {↵
|
4 | return !length.isNil() ? file.read(context, length) : file.read(context);↵ | | 4 | return !length.isNil() ? file.read(context, length) : file.read(context);↵
|
5 | } finally {↵ | | 5 | } finally {↵
|
6 | file.close();↵ | | 6 | file.close();↵
|
7 | } | | 7 | }
|
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) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 14 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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.2 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | RubyIO file = newFile(context, recv, path); | | 1 | RubyIO file = newFile(context, recv, path); |
2 | if (!offset.isNil()) | | 2 | if (!offset.isNil()) |
3 | file.seek(context, offset); | | 3 | file.seek(context, offset); |
4 | try | | 4 | try |
5 | return !length.isNil() ? file.read(context, length) : file.read(context); | | 5 | return !length.isNil() ? file.read(context, length) : file.read(context); |
Precondition Violations (0)
Row |
Violation |