if(grp == null) { if (Platform.IS_WINDOWS) { // MRI behavior return runtime.getNil(); } throw runtime.newArgumentError("can't find group for " + nam); }
if(pwd == null) { if (Platform.IS_WINDOWS) { // MRI behavior return runtime.getNil(); } throw runtime.newArgumentError("can't find user for " + nam); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyEtc.java File path: /jruby-1.4.0/src/org/jruby/RubyEtc.java
Method name: IRubyObject getgrnam(IRubyObject, IRubyObject) Method name: IRubyObject getpwnam(IRubyObject, IRubyObject)
Number of AST nodes: 4 Number of AST nodes: 4
1
if(grp == null) {
1
if(pwd == null) {
2
                if (Platform.IS_WINDOWS) {  // MRI behavior
2
                if (Platform.IS_WINDOWS) {  // MRI behavior
3
                    return runtime.getNil();
3
                    return runtime.getNil();
4
                }
4
                }
5
                throw runtime.newArgumentError("can't find group for " + nam);
5
                throw runtime.newArgumentError("can't find user for " + nam);
6
            }
6
            }
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 declared in the same class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    if (grp == null)
    5
    if (grp == null)
    5
    if (pwd == null)
    Differences
    Expression1Expression2Difference
    grppwdVARIABLE_NAME_MISMATCH
    org.jruby.ext.posix.Grouporg.jruby.ext.posix.PasswdVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.ext.posix.Group of variable grp does not match with type org.jruby.ext.posix.Passwd of variable pwd
    • Make classes org.jruby.ext.posix.Group and org.jruby.ext.posix.Passwd extend a common superclass
    5
    if (pwd == null)
    6
    if (Platform.IS_WINDOWS)
    6
    if (Platform.IS_WINDOWS)
    7
    return runtime.getNil();
    7
    return runtime.getNil();
    8
    throw runtime.newArgumentError("can't find group for " + nam);
    8
    throw runtime.newArgumentError("can't find group for " + nam);
    8
    throw runtime.newArgumentError("can't find user for " + nam);
    Differences
    Expression1Expression2Difference
    "can't find group for ""can't find user for "LITERAL_VALUE_MISMATCH
    8
    throw runtime.newArgumentError("can't find user for " + nam);
    Precondition Violations (1)
    Row Violation
    1Type org.jruby.ext.posix.Group of variable grp does not match with type org.jruby.ext.posix.Passwd of variable pwd