File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/JavaEnvUtils.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/JavaEnvUtils.java | |||
Method name: String getJdkExecutable(String)
|
Method name: String getJreExecutable(String)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if (IS_NETWARE) {↵ | 1 | if (IS_NETWARE) {↵ | |
2 | // Extrapolating from:↵ | 2 | // Extrapolating from:↵ | |
3 | // "NetWare may have a "java" in that directory, but 99% of↵ | 3 | // "NetWare may have a "java" in that directory, but 99% of↵ | |
4 | // the time, you don't want to execute it" -- Jeff Tulley↵ | 4 | // the time, you don't want to execute it" -- Jeff Tulley↵ | |
5 | // <JTULLEY@novell.com>↵ | 5 | // <JTULLEY@novell.com>↵ | |
6 | return command;↵ | 6 | return command;↵ | |
7 | }↵ | 7 | }↵ | |
8 | File jExecutable = null;↵ | 8 | File jExecutable = null;↵ | |
9 | if (IS_AIX) {↵ | 9 | if (IS_AIX) {↵ | |
10 | // On IBM's JDK 1.2 the directory layout is different, 1.3 follows↵ | 10 | // On IBM's JDK 1.2 the directory layout is different, 1.3 follows↵ | |
11 | // Sun's layout.↵ | 11 | // Sun's layout.↵ | |
12 | jExecutable = findInDir(JAVA_HOME + "/../sh", command);↵ | 12 | jExecutable = findInDir(JAVA_HOME + "/sh", command);↵ | |
13 | }↵ | 13 | }↵ | |
14 | if (jExecutable == null) {↵ | 14 | if (jExecutable == null) {↵ | |
15 | jExecutable = findInDir(JAVA_HOME + "/../bin", command);↵ | 15 | jExecutable = findInDir(JAVA_HOME + "/bin", command);↵ | |
16 | }↵ | 16 | }↵ | |
17 | if (jExecutable != null) {↵ | 17 | if (jExecutable != null) {↵ | |
18 | return jExecutable.getAbsolutePath();↵ | 18 | return jExecutable.getAbsolutePath();↵ | |
19 | } else {↵ | 19 | } else {↵ | |
20 | // fall back to JRE bin directory, also catches JDK 1.0 and 1.1↵ | 20 | // ↵ | |
21 | // where java.home points to the root of the JDK and Mac OS X where↵ | |||
22 | // the whole directory layout is different from Sun's↵ | 21 | Unfortunately on Windows java.home doesn't always refer↵ | |
22 | // to the correct location, so we need to fall back to↵ | |||
23 | // assuming java is somewhere on the PATH.↵ | |||
23 | return getJreExecutable(command);↵ | 24 | return addExtension(command);↵ | |
24 | } | 25 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 37 |
Number of mapped statements | 10 |
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) | 3.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (IS_NETWARE) | 1 | if (IS_NETWARE) | ||||||||||||
2 | return command; | 2 | return command; | ||||||||||||
3 | File jExecutable = null; | 3 | File jExecutable = null; | ||||||||||||
4 | if (IS_AIX) | 4 | if (IS_AIX) | ||||||||||||
5 | jExecutable = findInDir(JAVA_HOME + "/../sh", command); |
| 5 | jExecutable = findInDir(JAVA_HOME + "/sh", command); | |||||||||||
6 | if (jExecutable == null) | 6 | if (jExecutable == null) | ||||||||||||
7 | jExecutable = findInDir(JAVA_HOME + "/../bin", command); |
| 7 | jExecutable = findInDir(JAVA_HOME + "/bin", command); | |||||||||||
8 | if (jExecutable != null) | 8 | if (jExecutable != null) | ||||||||||||
9 | return jExecutable.getAbsolutePath(); | 9 | return jExecutable.getAbsolutePath(); | ||||||||||||
else | else | ||||||||||||||
10 | return getJreExecutable(command); |
| 10 | return addExtension(command); |
Row | Violation |
---|---|
1 | Expression getJreExecutable(command) is a method call throwing exception(s) that should be caught by a try block that will be extracted |