if (log.isDebugEnabled()) { log.debug("Parsing html of: " + baseUrl); } Parser htmlParser = null; try { String contents = new String(html); htmlParser = new Parser(); htmlParser.setInputHTML(contents); } catch (Exception e) { throw new HTMLParseException(e); } // Now parse the DOM tree try { // we start to iterate through the elements parseNodes(htmlParser.elements(), new URLPointer(baseUrl), urls); log.debug("End : parseNodes"); } catch (ParserException e) { throw new HTMLParseException(e); } return urls.iterator();
if (log.isDebugEnabled()) { log.debug("Parsing html of: " + html); } Parser htmlParser = null; try { htmlParser = new Parser(); htmlParser.setInputHTML(html); } catch (Exception e) { throw new HTMLParseException(e); } // Now parse the DOM tree try { // we start to iterate through the elements parseNodes(htmlParser.elements(), formEncodings, pageEncoding); log.debug("End : parseNodes"); } catch (ParserException e) { throw new HTMLParseException(e); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
Method name: Iterator getEmbeddedResourceURLs(byte[], URL, URLCollection) Method name: void addFormActionsAndCharSet(String, Map, String)
Number of AST nodes: 11 Number of AST nodes: 9
1
if (log.isDebugEnabled()) {
1
if (log.isDebugEnabled()) {
2
            log.debug("Parsing html of: " + baseUrl);
2
            log.debug("Parsing html of: " + html);
3
        }
3
        }
4
        
4
        
5
        Parser htmlParser = null;
5
        Parser htmlParser = null;
6
		try {
6
		try {
7
			String contents = new String(html);
7
			
8
			htmlParser = new Parser();
8
htmlParser = new Parser();
9
            htmlParser.setInputHTML(contents);
9
            htmlParser.setInputHTML(html);
10
		} catch (Exception e) {
10
		} catch (Exception e) {
11
			throw new HTMLParseException(e);
11
			throw new HTMLParseException(e);
12
		}
12
		}
13
		// Now parse the DOM tree
13
		// Now parse the DOM tree
14
		try {
14
		try {
15
			// we start to iterate through the elements
15
			// we start to iterate through the elements
16
			parseNodes(htmlParser.elements(), new URLPointer(baseUrl), urls);
16
			parseNodes(htmlParser.elements(), formEncodings, pageEncoding);
17
			log.debug("End   : parseNodes");
17
			log.debug("End   : parseNodes");
18
		} catch (ParserException e) {
18
		} catch (ParserException e) {
19
			throw new HTMLParseException(e);
19
			throw new HTMLParseException(e);
20
		}
20
		}
21
		return urls.iterator();
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.7
Clones locationClones are in different classes
Number of node comparisons54
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (log.isDebugEnabled())
    1
    if (log.isDebugEnabled())
    2
    log.debug("Parsing html of: " + baseUrl);
    2
    log.debug("Parsing html of: " + baseUrl);
    2
    log.debug("Parsing html of: " + html);
    Differences
    Expression1Expression2Difference
    baseUrlhtmlVARIABLE_NAME_MISMATCH
    java.net.URLjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.URL of variable baseUrl does not match with type java.lang.String of variable html
    • Make classes java.net.URL and java.lang.String extend a common superclass
    2
    log.debug("Parsing html of: " + html);
    3
    Parser htmlParser = null;
    3
    Parser htmlParser = null;
    4
    try
    4
    try
    5
    String contents = new String(html);
                                                                            
    6
    htmlParser = new Parser();
    5
    htmlParser = new Parser();
    7
    htmlParser.setInputHTML(contents);
    7
    htmlParser.setInputHTML(contents);
    6
    htmlParser.setInputHTML(html);
    Differences
    Expression1Expression2Difference
    contentshtmlVARIABLE_NAME_MISMATCH
    6
    htmlParser.setInputHTML(html);
    8
    try
    7
    try
    9
    parseNodes(htmlParser.elements(), new URLPointer(baseUrl), urls);
    9
    parseNodes(htmlParser.elements(), new URLPointer(baseUrl), urls);
    9
    log.debug("End : parseNodes");
    Differences
    Expression1Expression2Difference
    parseNodesdebugMETHOD_INVOCATION_NAME_MISMATCH
    parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls)log.debug("End : parseNodes")ARGUMENT_NUMBER_MISMATCH
    logMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseNodes
    Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) is a void method call, and thus it cannot be parameterized
    Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseNodes
    Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) is a void method call, and thus it cannot be parameterized
    Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    9
    log.debug("End   : parseNodes");
    10
    log.debug("End   : parseNodes");
    10
    log.debug("End : parseNodes");
    8
    parseNodes(htmlParser.elements(), formEncodings, pageEncoding);
    Differences
    Expression1Expression2Difference
    debugparseNodesMETHOD_INVOCATION_NAME_MISMATCH
    log.debug("End : parseNodes")parseNodes(htmlParser.elements(),formEncodings,pageEncoding)ARGUMENT_NUMBER_MISMATCH
    logMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseNodes
    Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) is a void method call, and thus it cannot be parameterized
    Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseNodes
    Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) is a void method call, and thus it cannot be parameterized
    8
    parseNodes(htmlParser.elements(), formEncodings, pageEncoding);
    11
    return urls.iterator();
    11
    return urls.iterator();
    Preondition Violations
    Unmatched return urls.iterator();
                                                          
    Precondition Violations (14)
    Row Violation
    1Type java.net.URL of variable baseUrl does not match with type java.lang.String of variable html
    2Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) is a void method call, and thus it cannot be parameterized
    4Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    5Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression parseNodes(htmlParser.elements(),new URLPointer(baseUrl),urls) is a void method call, and thus it cannot be parameterized
    7Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    8Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    10Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) is a void method call, and thus it cannot be parameterized
    11Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression log.debug("End : parseNodes") is a void method call, and thus it cannot be parameterized
    13Expression parseNodes(htmlParser.elements(),formEncodings,pageEncoding) is a void method call, and thus it cannot be parameterized
    14Unmatched return urls.iterator();