File path: /jruby-1.4.0/src/org/jruby/util/io/BlockingIO.java | File path: /jruby-1.4.0/src/org/jruby/util/io/BlockingIO.java | |||
Method name: int read(ReadableByteChannel, ByteBuffer, boolean)
|
Method name: int write(WritableByteChannel, ByteBuffer, boolean)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | do {↵ | 1 | do {↵ | |
2 | int n = channel.read(buf);↵ | 2 | int n = channel.write(buf);↵ | |
3 | if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) {↵ | 3 | if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) {↵ | |
4 | return n;↵ | 4 | return n;↵ | |
5 | }↵ | 5 | }↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | awaitReadable(channel);↵ | 7 | awaitWritable(channel);↵ | |
8 | } catch (InterruptedException ex) {↵ | 8 | } catch (InterruptedException ex) {↵ | |
9 | throw new InterruptedIOException(ex.getMessage());↵ | 9 | throw new InterruptedIOException(ex.getMessage());↵ | |
10 | }↵ | 10 | }↵ | |
11 | } while (true); | 11 |
| |
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
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.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | do while(true) | 6 | do while(true) | |||||||||||||||||||
1 | int n = channel.read(buf); |
| 1 | int n = channel.write(buf); | ||||||||||||||||||
2 | if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) |
| 2 | if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) | ||||||||||||||||||
3 | return n; | 3 | return n; | |||||||||||||||||||
4 | try | 4 | try | |||||||||||||||||||
5 | awaitReadable(channel); |
| 5 | awaitWritable(channel); |
Row | Violation |
---|---|
1 | Expression channel.read(buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression channel.write(buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Type java.nio.channels.ReadableByteChannel of variable channel does not match with type java.nio.channels.WritableByteChannel of variable channel |
4 | Type java.nio.channels.ReadableByteChannel of variable channel does not match with type java.nio.channels.WritableByteChannel of variable channel |
5 | Expression awaitReadable(channel) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
6 | Expression awaitWritable(channel) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
7 | Expression awaitReadable(channel) is a void method call, and thus it cannot be parameterized |
8 | Expression awaitWritable(channel) is a void method call, and thus it cannot be parameterized |
9 | Type java.nio.channels.ReadableByteChannel of variable channel does not match with type java.nio.channels.WritableByteChannel of variable channel |