File path: /jruby-1.4.0/src/org/jruby/RubyIO.java | File path: /jruby-1.4.0/src/org/jruby/RubyIO.java | |||
Method name: void RubyIO(Ruby, InputStream)
|
Method name: void RubyIO(Ruby, OutputStream)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | super(runtime, runtime.getIO());↵ | 1 | super(runtime, runtime.getIO());↵ | |
2 | ↵ | 2 | ↵ | |
3 | if (in↵ | 3 | // We only want IO objects with valid streams (better to error now). ↵ | |
4 | putStream == null) {↵ | 4 | if (outputStream == null) {↵ | |
5 | throw runtime.newRuntimeError("Opening null stream");↵ | 5 | throw runtime.newRuntimeError("Opening null stream");↵ | |
6 | }↵ | 6 | }↵ | |
7 | ↵ | 7 | ↵ | |
8 | openFile = new OpenFile();↵ | 8 | openFile = new OpenFile();↵ | |
9 | ↵ | 9 | ↵ | |
10 | try {↵ | 10 | try {↵ | |
11 | openFile.setMainStream(new ChannelStream(runtime, new ChannelDescriptor(Channels.newChannel(inputStream), getNewFileno(), new FileDescriptor())));↵ | 11 | openFile.setMainStream(new ChannelStream(runtime, new ChannelDescriptor(Channels.newChannel(outputStream), getNewFileno(), new FileDescriptor())));↵ | |
12 | } catch (InvalidValueException e) {↵ | 12 | } catch (InvalidValueException e) {↵ | |
13 | throw getRuntime().newErrnoEINVALError();↵ | 13 | throw getRuntime().newErrnoEINVALError();↵ | |
14 | }↵ | 14 | }↵ | |
15 | ↵ | 15 | ↵ | |
16 | openFile.setMode(OpenFile.READABLE);↵ | 16 | openFile.setMode(OpenFile.WRITABLE | OpenFile.APPEND);↵ | |
17 | ↵ | 17 | ↵ | |
18 | registerDescriptor(openFile.getMainStream().getDescriptor()); | 18 |
| |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 23 |
Number of mapped statements | 8 |
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.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | super(runtime, runtime.getIO()); | 1 | super(runtime, runtime.getIO()); | |||||||||||||||||||
2 | if (inputStream == null) |
| 2 | if (outputStream == null) | ||||||||||||||||||
3 | throw runtime.newRuntimeError("Opening null stream"); | 3 | throw runtime.newRuntimeError("Opening null stream"); | |||||||||||||||||||
4 | openFile = new OpenFile(); | 4 | openFile = new OpenFile(); | |||||||||||||||||||
5 | try | 5 | try | |||||||||||||||||||
6 | openFile.setMainStream(new ChannelStream(runtime, new ChannelDescriptor(Channels.newChannel(inputStream), getNewFileno(), new FileDescriptor()))); |
| 6 | openFile.setMainStream(new ChannelStream(runtime, new ChannelDescriptor(Channels.newChannel(outputStream), getNewFileno(), new FileDescriptor()))); | ||||||||||||||||||
7 | openFile.setMode(OpenFile.READABLE); |
| 7 | openFile.setMode(OpenFile.WRITABLE | OpenFile.APPEND); | ||||||||||||||||||
8 | registerDescriptor(openFile.getMainStream().getDescriptor()); | 8 | registerDescriptor(openFile.getMainStream().getDescriptor()); |
Row | Violation |
---|---|
1 | Type java.io.InputStream of variable inputStream does not match with type java.io.OutputStream of variable outputStream |
2 | Type java.nio.channels.ReadableByteChannel of variable Channels.newChannel(inputStream) does not match with type java.nio.channels.WritableByteChannel of variable Channels.newChannel(outputStream) |
3 | Type java.io.InputStream of variable inputStream does not match with type java.io.OutputStream of variable outputStream |