try {
// seek to force underlying buffer to flush
seek(0, Stream.SEEK_CUR);
} catch (IOException ioe) {
// MRI ignores seek errors, presumably for unseekable files like
// serial ports (JRUBY-2979), so we shall too.
}
if ((mode & RBUF) != 0 && !mainStream.feof() && pipeStream == null) {
try {
// seek to force read buffer to invalidate
seek(0, Stream.SEEK_CUR);
} catch (IOException ioe) {
// MRI ignores seek errors, presumably for unseekable files like
// serial ports (JRUBY-2979), so we shall too.
}
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/io/OpenFile.java
|
|
File path: /jruby-1.4.0/src/org/jruby/util/io/OpenFile.java
|
Method name: void checkReadable(Ruby)
|
|
Method name: void checkWritable(Ruby)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 3
|
|
| | | 1 | if ((mode & RBUF) != 0 && !mainStream.feof() && pipeStream == null) {↵
|
1 | try {↵ | | 2 | try {↵
|
2 | // seek to force underlying buffer to flush↵ | | 3 | // seek to force read buffer to invalidate↵
|
3 | seek(0, Stream.SEEK_CUR);↵ | | 4 | seek(0, Stream.SEEK_CUR);↵
|
4 | } catch (IOException ioe) {↵ | | 5 | } catch (IOException ioe) {↵
|
5 | // MRI ignores seek errors, presumably for unseekable files like↵ | | 6 | // MRI ignores seek errors, presumably for unseekable files like↵
|
6 | // serial ports (JRUBY-2979), so we shall too.↵ | | 7 | // serial ports (JRUBY-2979), so we shall too.↵
|
7 | } | | 8 | }↵
|
| | | 9 | }
|
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 | 5 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.5 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | try | | 5 | try |
6 | seek(0, Stream.SEEK_CUR); | | 6 | seek(0, Stream.SEEK_CUR); |
Precondition Violations (0)
Row |
Violation |