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 | }
|