File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java | |||
Method name: void addAnchorUrls(Document, HTTPSampleResult, HTTPSamplerBase, List)
|
Method name: void addFramesetUrls(Document, HTTPSampleResult, HTTPSamplerBase, List)
|
|||
Number of AST nodes: 16 | Number of AST nodes: 15 | |||
1 | for (int i = 0; i < nodeList.getLength(); i++) {↵ | |||
1 | Node tempNode = nodeList.item(i);↵ | 2 | Node tempNode = nodeList.item(i);↵ | |
2 | NamedNodeMap nnm = tempNode.getAttributes();↵ | 3 | NamedNodeMap nnm = tempNode.getAttributes();↵ | |
3 | Node namedItem = nnm.getNamedItem("href"); // $NON-NLS-1$↵ | 4 | Node namedItem = nnm.getNamedItem("src"); // $NON-NLS-1$↵ | |
4 | if (namedItem == null) {↵ | 5 | if (namedItem == null) {↵ | |
5 | continue;↵ | |||
6 | }↵ | |||
7 | String hrefStr = namedItem.getNodeValue();↵ | |||
8 | if (hrefStr.startsWith("javascript:")) { // $NON-NLS-1$↵ | |||
9 | continue; // No point trying these↵ | |||
10 | }↵ | |||
11 | try {↵ | |||
12 | ↵ | 6 | continue;↵ | |
7 | }↵ | |||
8 | String hrefStr = namedItem.getNodeValue();↵ | |||
9 | try {↵ | |||
13 | HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(↵ | 10 | HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(↵ | |
14 | hrefStr, new URL(result.getURL(), base));↵ | 11 | hrefStr, new URL(result.getURL(), base));↵ | |
15 | newUrl.setMethod(HTTPConstants.GET);↵ | 12 | newUrl.setMethod(HTTPConstants.GET);↵ | |
16 | if (log.isDebugEnabled()) {↵ | 13 | if (log.isDebugEnabled()) {↵ | |
17 | log.debug("Potential <a href> match: " + newUrl);↵ | 14 | log.debug("Potential <frame src> match: " + newUrl);↵ | |
18 | }↵ | |||
19 | ↵ | 15 | }↵ | |
20 | if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) {↵ | 16 | if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) {↵ | |
21 | log.debug("Matched!");↵ | 17 | log.debug("Matched!");↵ | |
22 | potentialLinks.add(newUrl);↵ | 18 | potentialLinks.add(newUrl);↵ | |
23 | }↵ | |||
24 | ↵ | 19 | }↵ | |
25 | } catch (MalformedURLException e) {↵ | 20 | } catch (MalformedURLException e) {↵ | |
26 | log.warn("Bad URL "+e);↵ | 21 | log.warn("Bad URL "+e);↵ | |
27 | ↵ | 22 | }↵ | |
28 | } | 23 | } | |
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) | 1.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 51 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 5.1 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | Node tempNode = nodeList.item(i); | 7 | Node tempNode = nodeList.item(i); | |||||||||||
8 | NamedNodeMap nnm = tempNode.getAttributes(); | 8 | NamedNodeMap nnm = tempNode.getAttributes(); | |||||||||||
9 | Node namedItem = nnm.getNamedItem("href"); |
| 9 | Node namedItem = nnm.getNamedItem("src"); | ||||||||||
10 | if (namedItem == null) | 10 | if (namedItem == null) | |||||||||||
11 | continue; |
| 11 | continue; | ||||||||||
12 | String hrefStr = namedItem.getNodeValue(); | 12 | String hrefStr = namedItem.getNodeValue(); | |||||||||||
13 | if (hrefStr.startsWith("javascript:")) |
| | |||||||||||
14 | continue; |
| | |||||||||||
15 | try | 13 | try | |||||||||||
16 | HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(hrefStr, new URL(result.getURL(), base)); | 14 | HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(hrefStr, new URL(result.getURL(), base)); | |||||||||||
17 | newUrl.setMethod(HTTPConstants.GET); | 15 | newUrl.setMethod(HTTPConstants.GET); | |||||||||||
18 | if (log.isDebugEnabled()) | 16 | if (log.isDebugEnabled()) | |||||||||||
19 | log.debug("Potential <a href> match: " + newUrl); |
| 17 | log.debug("Potential <frame src> match: " + newUrl); | ||||||||||
20 | if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) | 18 | if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) | |||||||||||
21 | log.debug("Matched!"); | 19 | log.debug("Matched!"); | |||||||||||
22 | potentialLinks.add(newUrl); | 20 | potentialLinks.add(newUrl); |
Row | Violation |
---|---|
1 | Statement continue; without innermost loop |
2 | Statement continue; without innermost loop |
3 | Unmatched statement if(hrefStr.startsWith("javascript:")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched continue; |
5 | Clone fragment #1 returns variables hrefStr , while Clone fragment #2 returns variables |