try { testAvailability("java.util.regex.Matcher"); return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); } catch (BuildException be) { cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14); } try { testAvailability("org.apache.oro.text.regex.Pattern"); return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); } catch (BuildException be) { cause = orCause(cause, be, true); } try { testAvailability("org.apache.regexp.RE"); return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); } catch (BuildException be) { cause = orCause(cause, be, true); } throw new BuildException( "No supported regular expression matcher found" + (cause != null ? ": " + cause : ""), cause);
try { testAvailability("java.util.regex.Matcher"); return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); } catch (BuildException be) { cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14); } try { testAvailability("org.apache.oro.text.regex.Pattern"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); } catch (BuildException be) { cause = orCause(cause, be, true); } try { testAvailability("org.apache.regexp.RE"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); } catch (BuildException be) { cause = orCause(cause, be, true); } throw new BuildException( "No supported regular expression matcher found" + (cause != null ? ": " + cause : ""), cause);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/RegexpFactory.java
Method name: RegexpMatcher newRegexpMatcher(Project) Method name: Regexp newRegexp(Project)
Number of AST nodes: 10 Number of AST nodes: 10
1
try {
1
try {
2
            testAvailability("java.util.regex.Matcher");
2
            testAvailability("java.util.regex.Matcher");
3
            return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
3
            return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
4
        } catch (BuildException be) {
4
        } catch (BuildException be) {
5
            cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14);
5
            cause = orCause(cause, be, JavaEnvUtils.getJavaVersionNumber() < 14);
6
        }
6
        }
7
        try {
7
        try {
8
            testAvailability("org.apache.oro.text.regex.Pattern");
8
            testAvailability("org.apache.oro.text.regex.Pattern");
9
            return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
9
            return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
10
        } catch (BuildException be) {
10
        } catch (BuildException be) {
11
            cause = orCause(cause, be, true);
11
            cause = orCause(cause, be, true);
12
        }
12
        }
13
        try {
13
        try {
14
            testAvailability("org.apache.regexp.RE");
14
            testAvailability("org.apache.regexp.RE");
15
            return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");
15
            return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
16
        } catch (BuildException be) {
16
        } catch (BuildException be) {
17
            cause = orCause(cause, be, true);
17
            cause = orCause(cause, be, true);
18
        }
18
        }
19
        throw new BuildException(
19
        throw new BuildException(
20
            "No supported regular expression matcher found"
20
            "No supported regular expression matcher found"
21
            + (cause != null ? ": " + cause : ""), cause);
21
            + (cause != null ? ": " + cause : ""), cause);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.8
Clones locationClones are in different classes having the same super class
Number of node comparisons58
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    try
    8
    try
    9
    testAvailability("java.util.regex.Matcher");
    9
    testAvailability("java.util.regex.Matcher");
                                                                                                                                                                                
    10
    return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
    Preondition Violations
    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
    Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
    10
    return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
    10
    return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
    10
    return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
    Preondition Violations
    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
    Unmatched return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
                                                                                                                                                                      
    11
    try
    11
    try
    12
    testAvailability("org.apache.oro.text.regex.Pattern");
    12
    testAvailability("org.apache.oro.text.regex.Pattern");
                                                                                                                                                                              
    13
    return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
    Preondition Violations
    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
    Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
    13
    return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
    13
    return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
    13
    return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
    Preondition Violations
    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
    Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
                                                                                                                                                                    
    14
    try
    14
    try
    15
    testAvailability("org.apache.regexp.RE");
    15
    testAvailability("org.apache.regexp.RE");
                                                                                                                                                                                    
    16
    return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
    Preondition Violations
    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
    Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
    16
    return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
    16
    return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");
    16
    return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");
    Preondition Violations
    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
    Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");
                                                                                                                                                                          
    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);
    Precondition Violations (12)
    Row Violation
    1Unmatched 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
    2Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
    3Unmatched 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
    4Unmatched return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
    5Unmatched 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
    6Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
    7Unmatched 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
    8Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
    9Unmatched 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
    10Unmatched return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
    11Unmatched 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
    12Unmatched return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");