int max = src.remaining(); int v = INSTANCE.send(fd, src, max, 0); if(v != -1) { src.position(src.position()+v); } return v;
int max = dst.remaining(); int v = INSTANCE.recv(fd, dst, max, 0); if(v != -1) { dst.position(dst.position()+v); } return v;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ext/socket/RubyUNIXSocket.java File path: /jruby-1.4.0/src/org/jruby/ext/socket/RubyUNIXSocket.java
Method name: int write(ByteBuffer) Method name: int read(ByteBuffer)
Number of AST nodes: 5 Number of AST nodes: 5
1
int max = src.remaining();
1
int max = dst.remaining();
2
            int v = INSTANCE.send(fd, src, max, 0);
2
            int v = INSTANCE.recv(fd, dst, max, 0);
3
            if(v != -1) {
3
            if(v != -1) {
4
                src.position(src.position()+v);
4
                dst.position(dst.position()+v);
5
            }
5
            }
6
            return v;
6
            return v;
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.1
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int max = src.remaining();
    1
    int max = src.remaining();
    1
    int max = dst.remaining();
    Differences
    Expression1Expression2Difference
    srcdstVARIABLE_NAME_MISMATCH
    1
    int max = dst.remaining();
    2
    int v = INSTANCE.send(fd, src, max, 0);
    2
    int v = INSTANCE.send(fd, src, max, 0);
    2
    int v = INSTANCE.recv(fd, dst, max, 0);
    Differences
    Expression1Expression2Difference
    sendrecvMETHOD_INVOCATION_NAME_MISMATCH
    srcdstVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression INSTANCE.send(fd,src,max,0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression INSTANCE.recv(fd,dst,max,0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    int v = INSTANCE.recv(fd, dst, max, 0);
    3
    if (v != -1)
    3
    if (v != -1)
    4
    src.position(src.position() + v);
    4
    src.position(src.position() + v);
    4
    dst.position(dst.position() + v);
    Differences
    Expression1Expression2Difference
    srcdstVARIABLE_NAME_MISMATCH
    srcdstVARIABLE_NAME_MISMATCH
    4
    dst.position(dst.position() + v);
    5
    return v;
    5
    return v;
    Precondition Violations (2)
    Row Violation
    1Expression INSTANCE.send(fd,src,max,0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression INSTANCE.recv(fd,dst,max,0) cannot be parameterized, because it has dependencies to/from statements that will be extracted