InputStream childIn = unwrapBufferedStream(child.getErrorStream()); FileChannel childInChannel = null; if (childIn instanceof FileInputStream) { childInChannel = ((FileInputStream) childIn).getChannel(); } OutputStream parentOut = unwrapBufferedStream(runtime.getOut()); FileChannel parentOutChannel = null; if (parentOut instanceof FileOutputStream) { parentOutChannel = ((FileOutputStream) parentOut).getChannel(); } if (childInChannel != null && parentOutChannel != null) { inerrPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this); } else { inerrPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this); } inerrPumper.start(); inerr = null; inerrChannel = null;
InputStream childIn = unwrapBufferedStream(child.getInputStream()); FileChannel childInChannel = null; if (childIn instanceof FileInputStream) { childInChannel = ((FileInputStream) childIn).getChannel(); } OutputStream parentOut = unwrapBufferedStream(runtime.getOut()); FileChannel parentOutChannel = null; if (parentOut instanceof FileOutputStream) { parentOutChannel = ((FileOutputStream) parentOut).getChannel(); } if (childInChannel != null && parentOutChannel != null) { inputPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this); } else { inputPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this); } inputPumper.start(); input = null; inputChannel = null;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/ShellLauncher.java File path: /jruby-1.4.0/src/org/jruby/util/ShellLauncher.java
Method name: void pumpInerr(Process, Ruby) Method name: void pumpInput(Process, Ruby)
Number of AST nodes: 14 Number of AST nodes: 14
1
InputStream childIn = unwrapBufferedStream(child.getErrorStream());
1
InputStream childIn = unwrapBufferedStream(child.getInputStream());
2
            FileChannel childInChannel = null;
2
            FileChannel childInChannel = null;
3
            if (childIn instanceof FileInputStream) {
3
            if (childIn instanceof FileInputStream) {
4
                childInChannel = ((FileInputStream) childIn).getChannel();
4
                childInChannel = ((FileInputStream) childIn).getChannel();
5
            }
5
            }
6
            OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
6
            OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
7
            FileChannel parentOutChannel = null;
7
            FileChannel parentOutChannel = null;
8
            if (parentOut instanceof FileOutputStream) {
8
            if (parentOut instanceof FileOutputStream) {
9
                parentOutChannel = ((FileOutputStream) parentOut).getChannel();
9
                parentOutChannel = ((FileOutputStream) parentOut).getChannel();
10
            }
10
            }
11
            if (childInChannel != null && parentOutChannel != null) {
11
            if (childInChannel != null && parentOutChannel != null) {
12
                inerrPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
12
                inputPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
13
            } else {
13
            } else {
14
                inerrPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
14
                inputPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
15
            }
15
            }
16
            inerrPumper.start();
16
            inputPumper.start();
17
            inerr = null;
17
            input = null;
18
            inerrChannel = null;
18
            inputChannel = null;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.7
Clones locationClones are declared in the same class
Number of node comparisons64
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    InputStream childIn = unwrapBufferedStream(child.getErrorStream());
    1
    InputStream childIn = unwrapBufferedStream(child.getErrorStream());
    1
    InputStream childIn = unwrapBufferedStream(child.getInputStream());
    Differences
    Expression1Expression2Difference
    getErrorStreamgetInputStreamMETHOD_INVOCATION_NAME_MISMATCH
    1
    InputStream childIn = unwrapBufferedStream(child.getInputStream());
    2
    FileChannel childInChannel = null;
    2
    FileChannel childInChannel = null;
    3
    if (childIn instanceof FileInputStream)
    3
    if (childIn instanceof FileInputStream)
    4
    childInChannel = ((FileInputStream)childIn).getChannel();
    4
    childInChannel = ((FileInputStream)childIn).getChannel();
    5
    OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
    5
    OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
    6
    FileChannel parentOutChannel = null;
    6
    FileChannel parentOutChannel = null;
    7
    if (parentOut instanceof FileOutputStream)
    7
    if (parentOut instanceof FileOutputStream)
    8
    parentOutChannel = ((FileOutputStream)parentOut).getChannel();
    8
    parentOutChannel = ((FileOutputStream)parentOut).getChannel();
    9
    if (childInChannel != null && parentOutChannel != null)
    9
    if (childInChannel != null && parentOutChannel != null)
    10
    inerrPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
    10
    inerrPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
    10
    inputPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
    Differences
    Expression1Expression2Difference
    inerrPumperinputPumperVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inerrPumper is a field being modified, and thus it cannot be parameterized
    Expression inputPumper is a field being modified, and thus it cannot be parameterized
    10
    inputPumper = new ChannelPumper(childInChannel, parentOutChannel, Pumper.Slave.IN, this);
    else
    else
    11
    inerrPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
    11
    inerrPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
    11
    inputPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
    Differences
    Expression1Expression2Difference
    inerrPumperinputPumperVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inerrPumper is a field being modified, and thus it cannot be parameterized
    Expression inputPumper is a field being modified, and thus it cannot be parameterized
    11
    inputPumper = new StreamPumper(childIn, parentOut, false, Pumper.Slave.IN, this);
    12
    inerrPumper.start();
    12
    inerrPumper.start();
    12
    inputPumper.start();
    Differences
    Expression1Expression2Difference
    inerrPumperinputPumperVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inerrPumper cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression inputPumper cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    inputPumper.start();
    13
    inerr = null;
    13
    inerr = null;
    13
    input = null;
    Differences
    Expression1Expression2Difference
    inerrinputVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inerr is a field being modified, and thus it cannot be parameterized
    Expression input is a field being modified, and thus it cannot be parameterized
    13
    input = null;
    14
    inerrChannel = null;
    14
    inerrChannel = null;
    14
    inputChannel = null;
    Differences
    Expression1Expression2Difference
    inerrChannelinputChannelVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inerrChannel is a field being modified, and thus it cannot be parameterized
    Expression inputChannel is a field being modified, and thus it cannot be parameterized
    14
    inputChannel = null;
    Precondition Violations (10)
    Row Violation
    1Expression inerrPumper is a field being modified, and thus it cannot be parameterized
    2Expression inputPumper is a field being modified, and thus it cannot be parameterized
    3Expression inerrPumper is a field being modified, and thus it cannot be parameterized
    4Expression inputPumper is a field being modified, and thus it cannot be parameterized
    5Expression inerrPumper cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression inputPumper cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression inerr is a field being modified, and thus it cannot be parameterized
    8Expression input is a field being modified, and thus it cannot be parameterized
    9Expression inerrChannel is a field being modified, and thus it cannot be parameterized
    10Expression inputChannel is a field being modified, and thus it cannot be parameterized