if(gr == null) {
if (Platform.IS_WINDOWS) { // MRI behavior
return runtime.getNil();
}
throw runtime.newArgumentError("can't find group for " + gid);
}
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 getgrgid(IRubyObject, IRubyObject[])
|
|
Method name: IRubyObject getpwnam(IRubyObject, IRubyObject)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if(gr == 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 " + gid);↵ | | 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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
6 | if (gr == null) | | 5 | if (pwd == null) |
7 | | | 6 | |
8 | | | 7 | |
| | | 8 | throw runtime.newArgumentError("can't find user for " + nam); |
9 | throw runtime.newArgumentError("can't find group for " + gid); | | | |
Precondition Violations (3)
Row |
Violation |
1 | Type org.jruby.ext.posix.Group of variable gr does not match with type org.jruby.ext.posix.Passwd of variable pwd |
2 | Unmatched throw runtime.newArgumentError("can't find user for " + nam); |
3 | Unmatched throw runtime.newArgumentError("can't find group for " + gid); |