try { Manifest finalManifest = Manifest.getDefaultManifest(); if (manifest == null) { if (manifestFile != null) { // if we haven't got the manifest yet, attempt to // get it now and have manifest be the final merge manifest = getManifest(manifestFile); } } /* * Precedence: manifestFile wins over inline manifest, * over manifests read from the filesets over the original * manifest. * * merge with null argument is a no-op */ if (isInUpdateMode()) { finalManifest.merge(originalManifest); } finalManifest.merge(filesetManifest); finalManifest.merge(configuredManifest); finalManifest.merge(manifest, !mergeManifestsMain); return finalManifest; } catch (ManifestException e) { log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR); throw new BuildException("Invalid Manifest", e, getLocation()); }
if (namespacePolicy.qualifyElements) { String uri = getNamespaceURI(element); String prefix = (String) nsPrefixMap.get(uri); if (prefix == null) { if (nsPrefixMap.isEmpty()) { // steal default namespace prefix = ""; } else { prefix = NS + (nextPrefix++); } nsPrefixMap.put(uri, prefix); addNSDefinition(element, uri); } if (!"".equals(prefix)) { out.write(prefix); out.write(":"); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Jar.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/DOMElementWriter.java
Method name: Manifest createManifest() Method name: void openElement(Element, Writer, int, String, boolean)
Number of AST nodes: 11 Number of AST nodes: 12
1
try {
2
            Manifest finalManifest = Manifest.getDefaultManifest(
1
if (namespacePolicy.qualifyElements) {
3
);
2
            String uri = getNamespaceURI(element);
4
            if (manifest == null) {
3
            
5
   
4
String prefix = (String) nsPrefixMap.get(uri);
6
             if (manifestFile != null) {
5
            if (prefix == null) {
7
                    // if we haven't got the manifest yet, attempt to
6
                
8
                    // get it now and have manifest be the final merge
9
                    manifest = getManifest(manifestFile)
7
if (nsPrefixMap.isEmpty()) {
8
                    // steal default namespace
10
;
9
                    prefix = "";
11
                }
10
                }
12
            }
11
 else {
13
            /*
12
            
14
             * Precedence: manifestFile wins over inline manifest,
15
             * over manifests read from the filesets over the original
13
        prefix = NS + (nextPrefix++);
16
             * manifest.
14
                }
17
             *
15
             
18
             * merge with null argument is a no-op
19
             */
20
            if (isInUpdateMode()) {
21
                finalManifest.merge(originalManifest);
22
            }
23
            finalManifest.merge(filesetManifest);
24
            finalManifest.merge(configuredManifest);
25
            finalManifest.merge(manifest, !mergeManifestsMain
16
   nsPrefixMap.put(uri, prefix);
17
                addNSDefinition(element, uri);
18
            }
19
            if (!"".equals(prefix)) {
26
);
20
                out.write(prefix);
27
            return finalManifest;
21
            
28
        } catch (ManifestException e) {
29
            log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR);
30
            throw new BuildException("Invalid Manifest", e, getLocation());
22
    out.write(":");
23
            }
31
        }
24
        }
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.1
Clones locationClones are in different classes
Number of node comparisons1