if (entityResolver != null) { if (getFactory().getFeature(SAXSource.FEATURE)) { SAXParserFactory spFactory = SAXParserFactory.newInstance(); spFactory.setNamespaceAware(true); XMLReader reader = spFactory.newSAXParser().getXMLReader(); reader.setEntityResolver(entityResolver); src = new SAXSource(reader, new InputSource(is)); } else { throw new IllegalStateException("xcatalog specified, but " + "parser doesn't support SAX"); } } else { // WARN: Don't use the StreamSource(File) ctor. It won't work with // xalan prior to 2.2 because of systemid bugs. src = new StreamSource(is); }
if (entityResolver != null) { if (getFactory().getFeature(SAXSource.FEATURE)) { SAXParserFactory spFactory = SAXParserFactory.newInstance(); spFactory.setNamespaceAware(true); XMLReader reader = spFactory.newSAXParser().getXMLReader(); reader.setEntityResolver(entityResolver); src = new SAXSource(reader, new InputSource(is)); } else { throw new IllegalStateException("xcatalog specified, but " + "parser doesn't support SAX"); } } else { // WARN: Don't use the StreamSource(File) ctor. It won't work with // xalan prior to 2.2 because of systemid bugs. src = new StreamSource(is); }
Clone fragments detected by clone detection tool
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: 9 Number of AST nodes: 9
1
if (entityResolver != null) {
1
if (entityResolver != null) {
2
            if (getFactory().getFeature(SAXSource.FEATURE)) {
2
            if (getFactory().getFeature(SAXSource.FEATURE)) {
3
                SAXParserFactory spFactory = SAXParserFactory.newInstance();
3
                SAXParserFactory spFactory = SAXParserFactory.newInstance();
4
                spFactory.setNamespaceAware(true);
4
                spFactory.setNamespaceAware(true);
5
                XMLReader reader = spFactory.newSAXParser().getXMLReader();
5
                XMLReader reader = spFactory.newSAXParser().getXMLReader();
6
                reader.setEntityResolver(entityResolver);
6
                reader.setEntityResolver(entityResolver);
7
                src = new SAXSource(reader, new InputSource(is));
7
                src = new SAXSource(reader, new InputSource(is));
8
            } else {
8
            } else {
9
                throw new IllegalStateException("xcatalog specified, but "
9
                throw new IllegalStateException("xcatalog specified, but "
10
                    + "parser doesn't support SAX");
10
                    + "parser doesn't support SAX");
11
            }
11
            }
12
        } else {
12
        } else {
13
            // WARN: Don't use the StreamSource(File) ctor. It won't work with
13
            // WARN: Don't use the StreamSource(File) ctor. It won't work with
14
            // xalan prior to 2.2 because of systemid bugs.
14
            // xalan prior to 2.2 because of systemid bugs.
15
            src = new StreamSource(is);
15
            src = new StreamSource(is);
16
        }
16
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons53
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    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);
    Precondition Violations (0)
    Row Violation