private Source getSource(InputStream is, File infile) throws ParserConfigurationException, SAXException { // todo: is this comment still relevant ?? // FIXME: need to use a SAXSource as the source for the transform // so we can plug in our own entity resolver Source src = null; 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); } src.setSystemId(JAXPUtils.getSystemId(infile)); return src;
private Source getSource(InputStream is, Resource resource) throws ParserConfigurationException, SAXException { // todo: is this comment still relevant ?? // FIXME: need to use a SAXSource as the source for the transform // so we can plug in our own entity resolver Source src = null; 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); } // The line below is a hack: the system id must an URI, but it is not // cleat to get the URI of an resource, so just set the name of the // resource as a system id src.setSystemId(resourceToURI(resource)); return src;
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
private Source getSource(InputStream is, File infile)
1
private Source getSource(InputStream is, Resource resource)
2
        throws ParserConfigurationException, SAXException {
2
        throws ParserConfigurationException, SAXException {
3
        // todo: is this comment still relevant ??
3
        // todo: is this comment still relevant ??
4
        // FIXME: need to use a SAXSource as the source for the transform
4
        // FIXME: need to use a SAXSource as the source for the transform
5
        // so we can plug in our own entity resolver
5
        // so we can plug in our own entity resolver
6
        Source src = null;
6
        Source src = null;
7
        if (entityResolver != null) {
7
        if (entityResolver != null) {
8
            if (getFactory().getFeature(SAXSource.FEATURE)) {
8
            if (getFactory().getFeature(SAXSource.FEATURE)) {
9
                SAXParserFactory spFactory = SAXParserFactory.newInstance();
9
                SAXParserFactory spFactory = SAXParserFactory.newInstance();
10
                spFactory.setNamespaceAware(true);
10
                spFactory.setNamespaceAware(true);
11
                XMLReader reader = spFactory.newSAXParser().getXMLReader();
11
                XMLReader reader = spFactory.newSAXParser().getXMLReader();
12
                reader.setEntityResolver(entityResolver);
12
                reader.setEntityResolver(entityResolver);
13
                src = new SAXSource(reader, new InputSource(is));
13
                src = new SAXSource(reader, new InputSource(is));
14
            } else {
14
            } else {
15
                throw new IllegalStateException("xcatalog specified, but "
15
                throw new IllegalStateException("xcatalog specified, but "
16
                    + "parser doesn't support SAX");
16
                    + "parser doesn't support SAX");
17
            }
17
            }
18
        } else {
18
        } else {
19
            // WARN: Don't use the StreamSource(File) ctor. It won't work with
19
            // WARN: Don't use the StreamSource(File) ctor. It won't work with
20
            // xalan prior to 2.2 because of systemid bugs.
20
            // xalan prior to 2.2 because of systemid bugs.
21
            src = new StreamSource(is);
21
            src = new StreamSource(is);
22
        }
22
        }
23
        src.setSystemId(JAXPUtils.getSystemId(infil
23
        // The line below is a hack: the system id must an URI, but it is not
24
        // cleat to get the URI of an resource, so just set the name of the
25
        // resource as a system id
24
e));
26
        src.setSystemId(resourceToURI(resource));
25
        return src;
27
        return src;
26
    
28
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0