log("Matching catalog entry found for uri: '" + matchingEntry.getPublicId() + "' location: '" + matchingEntry.getLocation() + "'", Project.MSG_DEBUG); // // Use the passed in base in preference to the base // from matchingEntry, which is either null or the // directory in which the external catalog file from // which it was obtained is located. We make a copy // so matchingEntry's original base is untouched. Of // course, if there is no base, no need to make a // copy... // // This is the standard behavior as per my reading of // the JAXP and XML Catalog specs. CKS 11/7/2002 // ResourceLocation entryCopy = matchingEntry; if (base != null) { try { URL baseURL = new URL(base); entryCopy = new ResourceLocation(); entryCopy.setBase(baseURL); } catch (MalformedURLException ex) { // ignore } } entryCopy.setPublicId(matchingEntry.getPublicId()); entryCopy.setLocation(matchingEntry.getLocation()); source = filesystemLookup(entryCopy); if (source == null) { source = classpathLookup(entryCopy); }
log("Matching catalog entry found for uri: '" + matchingEntry.getPublicId() + "' location: '" + matchingEntry.getLocation() + "'", Project.MSG_DEBUG); // // Use the passed in base in preference to the base // from matchingEntry, which is either null or the // directory in which the external catalog file from // which it was obtained is located. We make a copy // so matchingEntry's original base is untouched. // // This is the standard behavior as per my reading of // the JAXP and XML Catalog specs. CKS 11/7/2002 // ResourceLocation entryCopy = matchingEntry; if (base != null) { try { URL baseURL = new URL(base); entryCopy = new ResourceLocation(); entryCopy.setBase(baseURL); } catch (MalformedURLException ex) { // ignore } } entryCopy.setPublicId(matchingEntry.getPublicId()); entryCopy.setLocation(matchingEntry.getLocation()); source = filesystemLookup(entryCopy); if (source == null) { source = classpathLookup(entryCopy); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/XMLCatalog.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/XMLCatalog.java
Method name: Source resolve(String, String) Method name: Source resolve(String, String)
Number of AST nodes: 12 Number of AST nodes: 12
1
log("Matching catalog entry found for uri: '"
1
log("Matching catalog entry found for uri: '"
2
                    + matchingEntry.getPublicId() + "' location: '"
2
                    + matchingEntry.getPublicId() + "' location: '"
3
                    + matchingEntry.getLocation() + "'",
3
                    + matchingEntry.getLocation() + "'",
4
                    Project.MSG_DEBUG);
4
                    Project.MSG_DEBUG);
5
                //
5
                //
6
                // Use the passed in base in preference to the base
6
                // Use the passed in base in preference to the base
7
                // from matchingEntry, which is either null or the
7
                // from matchingEntry, which is either null or the
8
                // directory in which the external catalog file from
8
                // directory in which the external catalog file from
9
                // which it was obtained is located.  We make a copy
9
                // which it was obtained is located.  We make a copy
10
                // so matchingEntry's original base is untouched.  Of
10
                // so matchingEntry's original base is untouched.
11
                // course, if there is no base, no need to make a
12
                // copy...
13
                //
11
                //
14
                // This is the standard behavior as per my reading of
12
                // This is the standard behavior as per my reading of
15
                // the JAXP and XML Catalog specs.  CKS 11/7/2002
13
                // the JAXP and XML Catalog specs.  CKS 11/7/2002
16
                //
14
                //
17
                ResourceLocation entryCopy = matchingEntry;
15
                ResourceLocation entryCopy = matchingEntry;
18
                if (base != null) {
16
                if (base != null) {
19
                    try {
17
                    try {
20
                        URL baseURL = new URL(base);
18
                        URL baseURL = new URL(base);
21
                        entryCopy = new ResourceLocation();
19
                        entryCopy = new ResourceLocation();
22
                        entryCopy.setBase(baseURL);
20
                        entryCopy.setBase(baseURL);
23
                    } catch (MalformedURLException ex) {
21
                    } catch (MalformedURLException ex) {
24
                        // ignore
22
                        // ignore
25
                    }
23
                    }
26
                }
24
                }
27
                entryCopy.setPublicId(matchingEntry.getPublicId());
25
                entryCopy.setPublicId(matchingEntry.getPublicId());
28
                entryCopy.setLocation(matchingEntry.getLocation());
26
                entryCopy.setLocation(matchingEntry.getLocation());
29
                source = filesystemLookup(entryCopy);
27
                source = filesystemLookup(entryCopy);
30
                if (source == null) {
28
                if (source == null) {
31
                    source = classpathLookup(entryCopy);
29
                    source = classpathLookup(entryCopy);
32
                }
30
                }
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.3
Clones locationClones are in the same java file
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    6
    log("Matching catalog entry found for uri: '" + matchingEntry.getPublicId() + "' location: '" + matchingEntry.getLocation() + "'", Project.MSG_DEBUG);
    5
    log("Matching catalog entry found for uri: '" + matchingEntry.getPublicId() + "' location: '" + matchingEntry.getLocation() + "'", Project.MSG_DEBUG);
    7
    ResourceLocation entryCopy = matchingEntry;
    6
    ResourceLocation entryCopy = matchingEntry;
    8
    if (base != null)
    7
    if (base != null)
    9
    try
    8
    try
    10
    URL baseURL = new URL(base);
    9
    URL baseURL = new URL(base);
    11
    entryCopy = new ResourceLocation();
    10
    entryCopy = new ResourceLocation();
    12
    entryCopy.setBase(baseURL);
    11
    entryCopy.setBase(baseURL);
    13
    entryCopy.setPublicId(matchingEntry.getPublicId());
    12
    entryCopy.setPublicId(matchingEntry.getPublicId());
    14
    entryCopy.setLocation(matchingEntry.getLocation());
    13
    entryCopy.setLocation(matchingEntry.getLocation());
    15
    source = filesystemLookup(entryCopy);
    14
    source = filesystemLookup(entryCopy);
    16
    if (source == null)
    15
    if (source == null)
    17
    source = classpathLookup(entryCopy);
    16
    source = classpathLookup(entryCopy);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables source , while Clone fragment #2 returns variables source, entryCopy