if(fnmatch(magic,0,magic.length,bs,0, bs.length,flags) == 0) { buf.length(0); buf.append(base); buf.append( BASE(base) ? SLASH : EMPTY ); buf.append(getBytesInUTF8(dirp[i])); if(m == -1) { status = func.call(buf.bytes,0,buf.realSize,arg); if(status != 0) { break; } continue; } link.add(buf); buf = new ByteList(20); }
if(fnmatch(magic,0,magic.length,bs,0,len,flags) == 0) { buf.length(0); buf.append(base, 0, base.length - jar.length()); buf.append( BASE(base) ? SLASH : EMPTY ); buf.append(bs, 0, len); if(m == -1) { status = func.call(buf.bytes,0,buf.realSize,arg); if(status != 0) { break; } continue; } link.add(buf); buf = new ByteList(20); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/Dir.java File path: /jruby-1.4.0/src/org/jruby/util/Dir.java
Method name: int glob_helper(String, byte[], int, int, int, int, GlobFunc, GlobArgs) Method name: int glob_helper(String, byte[], int, int, int, int, GlobFunc, GlobArgs)
Number of AST nodes: 12 Number of AST nodes: 12
1
if(fnmatch(magic,0,magic.length,bs,0, bs.length,flags) == 0) {
1
if(fnmatch(magic,0,magic.length,bs,0,len,flags) == 0) {
2
                                buf.length(0);
2
                                    buf.length(0);
3
                                buf.append(base);
3
                                    buf.append(base
4
, 0, base.length - jar.length());
4
                                buf.append( BASE(base) ? SLASH : EMPTY );
5
                                    buf.append( BASE(base) ? SLASH : EMPTY );
5
                                buf.append(getBytesInUTF8(dirp[i]));
6
                                    buf.append(
7
bs, 0, len);
6
                                if(m == -1) {
8
                                    if(m == -1) {
7
                                    status = func.call(buf.bytes,0,buf.realSize,arg);
9
                                        status = func.call(buf.bytes,0,buf.realSize,arg);
8
                                    if(status != 0) {
10
                                        if(status != 0) {
9
                                        break;
11
                                            break;
10
                                    }
12
                                    
13
    }
11
                                    continue;
14
                                        continue;
12
                                }
15
                                 
16
   }
13
                                link.add(buf);
17
                                    link.add(buf);
14
                                buf = new ByteList(20);
18
                                    buf = new ByteList(20);
15
                            }
19
                                }
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.5
Clones locationClones are in the same method
Number of node comparisons71
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)24.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    104
    if (fnmatch(magic, 0, magic.length, bs, 0, bs.length, flags) == 0)
    104
    if (fnmatch(magic, 0, magic.length, bs, 0, bs.length, flags) == 0)
    146
    if (fnmatch(magic, 0, magic.length, bs, 0, len, flags) == 0)
    Differences
    Expression1Expression2Difference
    bs.lengthlenTYPE_COMPATIBLE_REPLACEMENT
    146
    if (fnmatch(magic, 0, magic.length, bs, 0, len, flags) == 0)
    105
    buf.length(0);
    147
    buf.length(0);
    106
    buf.append(base);
    106
    buf.append(base);
    150
    buf.append(bs, 0, len);
    Differences
    Expression1Expression2Difference
    buf.append(base)buf.append(bs,0,len)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression buf.append(base) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf.append(bs,0,len) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf.append(base) is a void method call, and thus it cannot be parameterized
    Expression buf.append(bs,0,len) is a void method call, and thus it cannot be parameterized
    150
    buf.append(bs, 0, len);
    107
    buf.append(BASE(base) ? SLASH : EMPTY);
    149
    buf.append(BASE(base) ? SLASH : EMPTY);
    108
    buf.append(getBytesInUTF8(dirp[i]));
    108
    buf.append(getBytesInUTF8(dirp[i]));
    148
    buf.append(base, 0, base.length - jar.length());
    Differences
    Expression1Expression2Difference
    buf.append(getBytesInUTF8(dirp[i]))buf.append(base,0,base.length - jar.length())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression buf.append(getBytesInUTF8(dirp[i])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf.append(base,0,base.length - jar.length()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf.append(getBytesInUTF8(dirp[i])) is a void method call, and thus it cannot be parameterized
    Expression buf.append(base,0,base.length - jar.length()) is a void method call, and thus it cannot be parameterized
    148
    buf.append(base, 0, base.length - jar.length());
    109
    if (m == -1)
    151
    if (m == -1)
    110
    status = func.call(buf.bytes, 0, buf.realSize, arg);
    152
    status = func.call(buf.bytes, 0, buf.realSize, arg);
    111
    if (status != 0)
    153
    if (status != 0)
    112
    break;
    112
    break;
    154
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    154
    break;
    113
    continue;
    113
    continue;
    155
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    155
    continue;
    114
    link.add(buf);
    156
    link.add(buf);
    115
    buf = new ByteList(20);
    157
    buf = new ByteList(20);
    Precondition Violations (13)
    Row Violation
    1Expression buf.append(base) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression buf.append(bs,0,len) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression buf.append(base) is a void method call, and thus it cannot be parameterized
    4Expression buf.append(bs,0,len) is a void method call, and thus it cannot be parameterized
    5Expression buf.append(getBytesInUTF8(dirp[i])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression buf.append(base,0,base.length - jar.length()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression buf.append(getBytesInUTF8(dirp[i])) is a void method call, and thus it cannot be parameterized
    8Expression buf.append(base,0,base.length - jar.length()) is a void method call, and thus it cannot be parameterized
    9Statement break; without innermost loop
    10Statement break; without innermost loop
    11Statement continue; without innermost loop
    12Statement continue; without innermost loop
    13Clone fragment #1 returns variables status, buf , while Clone fragment #2 returns variables status, buf