File path: /jruby-1.4.0/src/org/jruby/RubyFile.java | File path: /jruby-1.4.0/src/org/jruby/RubyFile.java | |||
Method name: IRubyObject lchmod(ThreadContext, IRubyObject, IRubyObject[])
|
Method name: IRubyObject chmod(ThreadContext, IRubyObject, IRubyObject[])
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | Ruby runtime = context.getRuntime();↵ | 1 | Ruby runtime = context.getRuntime();↵ | |
2 | ↵ | 2 | ↵ | |
3 | int count = 0;↵ | 3 | int count = 0;↵ | |
4 | RubyInteger mode = args[0].convertToInteger();↵ | 4 | RubyInteger mode = args[0].convertToInteger();↵ | |
5 | for (int i = 1; i < args.length; i++) {↵ | 5 | for (int i = 1; i < args.length; i++) {↵ | |
6 | RubyString filename = get_path(context, args[i]);↵ | 6 | RubyString filename = get_path(context, args[i]);↵ | |
7 | ↵ | 7 | ↵ | |
8 | if (!RubyFileTest.exist_p(filename, filename).isTrue()) {↵ | 8 | if (!RubyFileTest.exist_p(filename, filename).isTrue()) {↵ | |
9 | throw runtime.newErrnoENOENTError("No such file or directory - " + filename);↵ | 9 | throw runtime.newErrnoENOENTError("No such file or directory - " + filename);↵ | |
10 | }↵ | 10 | }↵ | |
11 | ↵ | 11 | ↵ | |
12 | boolean result = 0 == runtime.getPosix().lchmod(filename.getUnicodeValue(), (int)mode.getLongValue());↵ | 12 | boolean result = 0 == runtime.getPosix().chmod(filename.getUnicodeValue(), (int)mode.getLongValue());↵ | |
13 | if (result) {↵ | 13 | if (result) {↵ | |
14 | count++;↵ | 14 | count++;↵ | |
15 | }↵ | 15 | }↵ | |
16 | }↵ | 16 | }↵ | |
17 | ↵ | 17 | ↵ | |
18 | return runtime.newFixnum(count); | 18 |
| |
See real code fragment | See real code fragment |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 38 |
Number of mapped statements | 11 |
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) | 2.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Ruby runtime = context.getRuntime(); | 1 | Ruby runtime = context.getRuntime(); | |||||||||||||
2 | int count = 0; | 2 | int count = 0; | |||||||||||||
3 | RubyInteger mode = args[0].convertToInteger(); | 3 | RubyInteger mode = args[0].convertToInteger(); | |||||||||||||
4 | for (int i = 1; i < args.length; i++) | 4 | for (int i = 1; i < args.length; i++) | |||||||||||||
5 | RubyString filename = get_path(context, args[i]); | 5 | RubyString filename = get_path(context, args[i]); | |||||||||||||
6 | if (!RubyFileTest.exist_p(filename, filename).isTrue()) | 6 | if (!RubyFileTest.exist_p(filename, filename).isTrue()) | |||||||||||||
7 | throw runtime.newErrnoENOENTError("No such file or directory - " + filename); | 7 | throw runtime.newErrnoENOENTError("No such file or directory - " + filename); | |||||||||||||
8 | boolean result = 0 == runtime.getPosix().lchmod(filename.getUnicodeValue(), (int)mode.getLongValue()); |
| 8 | boolean result = 0 == runtime.getPosix().chmod(filename.getUnicodeValue(), (int)mode.getLongValue()); | ||||||||||||
9 | if (result) | 9 | if (result) | |||||||||||||
10 | count++; | 10 | count++; | |||||||||||||
11 | return runtime.newFixnum(count); | 11 | return runtime.newFixnum(count); |
Row | Violation |
---|---|
1 | Expression runtime.getPosix().lchmod(filename.getUnicodeValue(),(int)mode.getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.getPosix().chmod(filename.getUnicodeValue(),(int)mode.getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |