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 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | if (grp == null) | | 5 | if (pwd == null) |
6 | | | 6 | |
7 | | | 7 | |
8 | throw runtime.newArgumentError("can't find group for " + nam); | | 8 | throw runtime.newArgumentError("can't find user for " + nam); |
Precondition Violations (1)
Row |
Violation |
1 | Type org.jruby.ext.posix.Group of variable grp does not match with type org.jruby.ext.posix.Passwd of variable pwd |