try { HTMLParser.getParser(TestClass.class.getName()); fail("Should not have been able to create the parser"); } catch (HTMLParseError e) { if (e.getCause() instanceof InstantiationException) { return; } throw e; }
try { HTMLParser.getParser("java.lang.String"); fail("Should not have been able to create the parser"); } catch (HTMLParseError e) { if (e.getCause() instanceof ClassCastException) { return; } throw e; }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
Method name: void testNotCreatable() Method name: void testNotParser()
Number of AST nodes: 3 Number of AST nodes: 3
1
try {
1
try {
2
                HTMLParser.getParser(TestClass.class.getName());
2
                HTMLParser.getParser("java.lang.String");
3
                fail("Should not have been able to create the parser");
3
                fail("Should not have been able to create the parser");
4
            } catch (HTMLParseError e) {
4
            } catch (HTMLParseError e) {
5
                if (e.getCause() instanceof InstantiationException) {
5
                if (e.getCause() instanceof ClassCastException) {
6
                    return;
6
                    return;
7
                }
7
                }
8
                throw e;
8
                throw e;
9
            }
9
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    java.lang.InstantiationExceptionjava.lang.ClassCastExceptionSUBCLASS_TYPE_MISMATCH
    1
    try
    2
    HTMLParser.getParser(TestClass.class.getName());
    2
    HTMLParser.getParser(TestClass.class.getName());
    2
    HTMLParser.getParser("java.lang.String");
    Differences
    Expression1Expression2Difference
    TestClass.class.getName()"java.lang.String"TYPE_COMPATIBLE_REPLACEMENT
    2
    HTMLParser.getParser("java.lang.String");
    3
    fail("Should not have been able to create the parser");
    3
    fail("Should not have been able to create the parser");
    Precondition Violations (0)
    Row Violation