File path: /jEdit-4.2/src/installer/OperatingSystem.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/io/FileVFS.java | |||
Method name: void exec(String[])
|
Method name: void setPermissions(String, int)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | String[] cmdarray = { "chmod", Integer.toString(permissions, 8), path };↵ | |||
2 | try↵ | |||
3 | {↵ | |||
1 | Process proc = Runtime.getRuntime().exec(args);↵ | 4 | Process process = Runtime.getRuntime().exec(cmdarray);↵ | |
2 | proc.getInputStream().close();↵ | 5 | process.getInputStream().close();↵ | |
3 | proc.getOutputStream().close();↵ | 6 | process.getOutputStream().close();↵ | |
4 | proc.getErrorStream().close();↵ | 7 | process.getErrorStream().close();↵ | |
5 | try↵ | 8 | ↵ | |
6 | {↵ | |||
7 | ↵ | 9 | // Jun 9 2004 12:40 PM↵ | |
10 | // waitFor() hangs on some Java↵ | |||
11 | // implementations.↵ | |||
8 | proc.waitFor();↵ | 12 | /* int exitCode = process.waitFor();↵ | |
9 | }↵ | 13 | ↵ | |
10 | catch(InterruptedException ie↵ | 14 | if(exitCode != 0)↵ | |
15 | Log.log(Log.NOTICE,FileVFS.class,"chmod exited with code " + exitCode); */↵ | |||
16 | }↵ | |||
17 | // Feb 4 2000 5:30 PM↵ | |||
18 | // Catch Throwable here rather than Exception.↵ | |||
19 | // Kaffe's implementation of Runtime.exec throws java.lang.InternalError.↵ | |||
11 | )↵ | 20 | catch (Throwable t)↵ | |
12 | {↵ | 21 | {↵ | |
13 | } | 22 | } | |
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 14 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Process proc = Runtime.getRuntime().exec(args); | | ||||||||||||||||||
2 | proc.getInputStream().close(); | | ||||||||||||||||||
3 | proc.getOutputStream().close(); | | ||||||||||||||||||
4 | proc.getErrorStream().close(); | | ||||||||||||||||||
| 5 | String[] cmdarray = {"chmod", Integer.toString(permissions, 8), path}; | ||||||||||||||||||
5 | try |
| 6 | try | ||||||||||||||||
6 | proc.waitFor(); |
| | |||||||||||||||||
| 7 | Process process = Runtime.getRuntime().exec(cmdarray); | ||||||||||||||||||
| 8 | process.getInputStream().close(); | ||||||||||||||||||
| 9 | process.getOutputStream().close(); | ||||||||||||||||||
| 10 | process.getErrorStream().close(); |
Row | Violation |
---|---|
1 | Unmatched statement proc.waitFor(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |