File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java | |||
Method name: Source getSource(InputStream, File)
|
Method name: Source getSource(InputStream, Resource)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | Source src = null;↵ | 1 | Source src = null;↵ | |
2 | if (entityResolver != null) {↵ | 2 | if (entityResolver != null) {↵ | |
3 | if (getFactory().getFeature(SAXSource.FEATURE)) {↵ | 3 | if (getFactory().getFeature(SAXSource.FEATURE)) {↵ | |
4 | SAXParserFactory spFactory = SAXParserFactory.newInstance();↵ | 4 | SAXParserFactory spFactory = SAXParserFactory.newInstance();↵ | |
5 | spFactory.setNamespaceAware(true);↵ | 5 | spFactory.setNamespaceAware(true);↵ | |
6 | XMLReader reader = spFactory.newSAXParser().getXMLReader();↵ | 6 | XMLReader reader = spFactory.newSAXParser().getXMLReader();↵ | |
7 | reader.setEntityResolver(entityResolver);↵ | 7 | reader.setEntityResolver(entityResolver);↵ | |
8 | src = new SAXSource(reader, new InputSource(is));↵ | 8 | src = new SAXSource(reader, new InputSource(is));↵ | |
9 | } else {↵ | 9 | } else {↵ | |
10 | throw new IllegalStateException("xcatalog specified, but "↵ | 10 | throw new IllegalStateException("xcatalog specified, but "↵ | |
11 | + "parser doesn't support SAX");↵ | 11 | + "parser doesn't support SAX");↵ | |
12 | }↵ | 12 | }↵ | |
13 | } else {↵ | 13 | } else {↵ | |
14 | // WARN: Don't use the StreamSource(File) ctor. It won't work with↵ | 14 | // WARN: Don't use the StreamSource(File) ctor. It won't work with↵ | |
15 | // xalan prior to 2.2 because of systemid bugs.↵ | 15 | // xalan prior to 2.2 because of systemid bugs.↵ | |
16 | src = new StreamSource(is);↵ | 16 | src = new StreamSource(is);↵ | |
17 | }↵ | 17 | }↵ | |
18 | src.setSystemId(JAXPUtils.getSystemId(infil↵ | 18 | // The line below is a hack: the system id must an URI, but it is not↵ | |
19 | // cleat to get the URI of an resource, so just set the name of the↵ | |||
20 | // resource as a system id↵ | |||
19 | e));↵ | 21 | src.setSystemId(resourceToURI(resource));↵ | |
20 | return src; | 22 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 62 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 9.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Source src = null; | 1 | Source src = null; | |||||||||||
2 | if (entityResolver != null) | 2 | if (entityResolver != null) | |||||||||||
3 | if (getFactory().getFeature(SAXSource.FEATURE)) | 3 | if (getFactory().getFeature(SAXSource.FEATURE)) | |||||||||||
4 | SAXParserFactory spFactory = SAXParserFactory.newInstance(); | 4 | SAXParserFactory spFactory = SAXParserFactory.newInstance(); | |||||||||||
5 | spFactory.setNamespaceAware(true); | 5 | spFactory.setNamespaceAware(true); | |||||||||||
6 | XMLReader reader = spFactory.newSAXParser().getXMLReader(); | 6 | XMLReader reader = spFactory.newSAXParser().getXMLReader(); | |||||||||||
7 | reader.setEntityResolver(entityResolver); | 7 | reader.setEntityResolver(entityResolver); | |||||||||||
8 | src = new SAXSource(reader, new InputSource(is)); | 8 | src = new SAXSource(reader, new InputSource(is)); | |||||||||||
else | else | |||||||||||||
9 | throw new IllegalStateException("xcatalog specified, but " + "parser doesn't support SAX"); | 9 | throw new IllegalStateException("xcatalog specified, but " + "parser doesn't support SAX"); | |||||||||||
else | else | |||||||||||||
10 | src = new StreamSource(is); | 10 | src = new StreamSource(is); | |||||||||||
11 | src.setSystemId(JAXPUtils.getSystemId(infile)); |
| 11 | src.setSystemId(resourceToURI(resource)); | ||||||||||
12 | return src; | 12 | return src; |
Row | Violation |
---|