File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/RegexpFactory.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java | |||
Method name: Regexp newRegexp(Project)
|
Method name: RegexpMatcher newRegexpMatcher(Project)
|
|||
Number of AST nodes: 17 | Number of AST nodes: 17 | |||
1 | String systemDefault = null;↵ | 1 | String systemDefault = null;↵ | |
2 | if (p == null) {↵ | 2 | if (p == null) {↵ | |
3 | systemDefault = System.getProperty("ant.regexp.regexpimpl");↵ | 3 | systemDefault = System.getProperty(MagicNames.REGEXP_IMPL);↵ | |
4 | } else {↵ | 4 | } else {↵ | |
5 | systemDefault = p.getProperty("ant.regexp.regexpimpl");↵ | 5 | systemDefault = p.getProperty(MagicNames.REGEXP_IMPL);↵ | |
6 | }↵ | 6 | }↵ | |
7 | if (systemDefault != null) {↵ | 7 | if (systemDefault != null) {↵ | |
8 | return createRegexpInstance(systemDefault);↵ | 8 | return createInstance(systemDefault);↵ | |
9 | // XXX should we silently catch possible exceptions and try to↵ | 9 | // XXX should we silently catch possible exceptions and try to↵ | |
10 | // load a different implementation?↵ | 10 | // load a different implementation?↵ | |
11 | }↵ | 11 | }↵ | |
12 | Throwable cause = null;↵ | 12 | Throwable cause = null;↵ | |
13 | try {↵ | 13 | try {↵ | |
14 | testAvailability("java.util.regex.Matcher");↵ | 14 | testAvailability("java.util.regex.Matcher");↵ | |
15 | return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");↵ | 15 | return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");↵ | |
16 | } catch (BuildException be) {↵ | 16 | } catch (BuildException be) {↵ | |
17 | cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14);↵ | 17 | cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14);↵ | |
18 | }↵ | 18 | }↵ | |
19 | try {↵ | 19 | try {↵ | |
20 | testAvailability("org.apache.oro.text.regex.Pattern");↵ | 20 | testAvailability("org.apache.oro.text.regex.Pattern");↵ | |
21 | return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");↵ | 21 | return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");↵ | |
22 | } catch (BuildException be) {↵ | 22 | } catch (BuildException be) {↵ | |
23 | cause = orCause(cause, be, true);↵ | 23 | cause = orCause(cause, be, true);↵ | |
24 | }↵ | 24 | }↵ | |
25 | try {↵ | 25 | try {↵ | |
26 | testAvailability("org.apache.regexp.RE");↵ | 26 | testAvailability("org.apache.regexp.RE");↵ | |
27 | return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");↵ | 27 | return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");↵ | |
28 | } catch (BuildException be) {↵ | 28 | } catch (BuildException be) {↵ | |
29 | cause = orCause(cause, be, true);↵ | 29 | cause = orCause(cause, be, true);↵ | |
30 | }↵ | 30 | }↵ | |
31 | throw new BuildException(↵ | 31 | throw new BuildException(↵ | |
32 | "No supported regular expression matcher found"↵ | 32 | "No supported regular expression matcher found"↵ | |
33 | + (cause != null ? ": " + cause : ""), cause); | 33 |
| |
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) | 3.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 137 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 6.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String systemDefault = null; | 1 | String systemDefault = null; | |||||||||||
2 | if (p == null) | 2 | if (p == null) | |||||||||||
3 | systemDefault = System.getProperty("ant.regexp.regexpimpl"); |
| 3 | systemDefault = System.getProperty(MagicNames.REGEXP_IMPL); | ||||||||||
else | else | |||||||||||||
4 | systemDefault = p.getProperty("ant.regexp.regexpimpl"); |
| 4 | systemDefault = p.getProperty(MagicNames.REGEXP_IMPL); | ||||||||||
5 | if (systemDefault != null) | 5 | if (systemDefault != null) | |||||||||||
|
| 6 | return createInstance(systemDefault); | |||||||||||
6 | return createRegexpInstance(systemDefault); |
| | |||||||||||
7 | Throwable cause = null; | 7 | Throwable cause = null; | |||||||||||
8 | try | 8 | try | |||||||||||
9 | testAvailability("java.util.regex.Matcher"); | 9 | testAvailability("java.util.regex.Matcher"); | |||||||||||
|
| 10 | return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); | |||||||||||
10 | return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); |
| | |||||||||||
11 | try | 11 | try | |||||||||||
12 | testAvailability("org.apache.oro.text.regex.Pattern"); | 12 | testAvailability("org.apache.oro.text.regex.Pattern"); | |||||||||||
|
| 13 | return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); | |||||||||||
13 | return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); |
| | |||||||||||
14 | try | 14 | try | |||||||||||
15 | testAvailability("org.apache.regexp.RE"); | 15 | testAvailability("org.apache.regexp.RE"); | |||||||||||
|
| 16 | return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); | |||||||||||
16 | return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); |
| | |||||||||||
17 | throw new BuildException("No supported regular expression matcher found" + (cause != null ? ": " + cause : ""), cause); | 17 | throw new BuildException("No supported regular expression matcher found" + (cause != null ? ": " + cause : ""), cause); |
Row | Violation |
---|---|
1 | Unmatched statement return createInstance(systemDefault); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched return createInstance(systemDefault); |
3 | Unmatched statement return createRegexpInstance(systemDefault); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched return createRegexpInstance(systemDefault); |
5 | Unmatched statement return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); 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 |
6 | Unmatched return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); |
7 | Unmatched statement return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); 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 |
8 | Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); |
9 | Unmatched statement return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); 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 |
10 | Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); |
11 | Unmatched statement return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); 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 |
12 | Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); |
13 | Unmatched statement return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); 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 |
14 | Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); |
15 | Unmatched statement return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); 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 |
16 | Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); |