Project

Profile

Help

Revision c10300c0

Added by Michael Kay 12 months ago

Fix bug #4643 (etc)

View differences:

.gitattributes
1109 1109
latest10/hej/net/sf/saxon/om/Chain.java svn_eol_002dstyle=native
1110 1110
latest10/hej/net/sf/saxon/om/CodedName.java svn_eol_002dstyle=native
1111 1111
latest10/hej/net/sf/saxon/om/CopyOptions.java svn_eol_002dstyle=native
1112
latest10/hej/net/sf/saxon/om/DocumentKey.java svn_eol_002dstyle=native
1112 1113
latest10/hej/net/sf/saxon/om/DocumentPool.java svn_eol_002dstyle=native
1113
latest10/hej/net/sf/saxon/om/DocumentURI.java svn_eol_002dstyle=native
1114 1114
latest10/hej/net/sf/saxon/om/EmptyAtomicSequence.java svn_eol_002dstyle=native
1115 1115
latest10/hej/net/sf/saxon/om/EmptyAttributeMap.java svn_eol_002dstyle=native
1116 1116
latest10/hej/net/sf/saxon/om/EnumSetTool.java svn_eol_002dstyle=native
latest10/hej/net/sf/saxon/Controller.java
957 957
     *            in the document pool with this as its document URI.
958 958
     * @throws XPathException if an error occurs
959 959
     */
960
    public void registerDocument(TreeInfo doc, DocumentURI uri) throws XPathException {
960
    public void registerDocument(TreeInfo doc, DocumentKey uri) throws XPathException {
961 961
        if (!getExecutable().isSchemaAware() && !Untyped.getInstance().equals(doc.getRootNode().getSchemaType())) {
962 962
            boolean isXSLT = getExecutable().getHostLanguage() == HostLanguage.XSLT;
963 963
            String message;
......
1316 1316
        //globalContextItem = doc;
1317 1317
        sourceBuilder.reset();
1318 1318
        if (source.getSystemId() != null) {
1319
            registerDocument(doc.getTreeInfo(), new DocumentURI(source.getSystemId()));
1319
            registerDocument(doc.getTreeInfo(), new DocumentKey(source.getSystemId()));
1320 1320
        }
1321 1321
        doc.getTreeInfo().setSpaceStrippingRule(spaceStrippingRule);
1322 1322
        return doc;
latest10/hej/net/sf/saxon/expr/instruct/ResultDocument.java
568 568
                throw err;
569 569
            }
570 570

  
571
            DocumentURI documentKey = new DocumentURI(uri);
571
            DocumentKey documentKey = new DocumentKey(uri);
572 572
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
573 573
            synchronized(controller) {
574 574
                if (!controller.checkUniqueOutputDestination(documentKey)) {
latest10/hej/net/sf/saxon/expr/instruct/SimpleNodeConstructor.java
281 281

  
282 282
    /**
283 283
     * Run-time method to compute the name of the node being constructed. This is overridden
284
     * for nodes that have a name. The default implementation returns -1, which is suitable for
284
     * for nodes that have a name. The default implementation returns null, which is suitable for
285 285
     * unnamed nodes such as comments
286 286
     *
287 287
     * @param context the XPath dynamic evaluation context
latest10/hej/net/sf/saxon/functions/CollectionFn.java
273 273
            while ((item = iter.next()) != null) {
274 274
                if (item instanceof NodeInfo && ((NodeInfo)item).getNodeKind() == Type.DOCUMENT) {
275 275
                    String docUri = ((NodeInfo)item).getSystemId();
276
                    DocumentURI docKey = new DocumentURI(docUri);
276
                    DocumentKey docKey = new DocumentKey(docUri);
277 277
                    TreeInfo info = item instanceof TreeInfo ? (TreeInfo)item : new GenericTreeInfo(controller.getConfiguration(), (NodeInfo)item);
278 278
                    docPool.add(info, docKey);
279 279
                }
latest10/hej/net/sf/saxon/functions/DocAvailable.java
45 45
    public boolean docAvailable(String href, XPathContext context) {
46 46
        try {
47 47
            PackageData packageData = getRetainedStaticContext().getPackageData();
48
            DocumentURI documentKey = DocumentFn.computeDocumentKey(href, getStaticBaseUriString(), packageData, context);
48
            DocumentKey documentKey = DocumentFn.computeDocumentKey(href, getStaticBaseUriString(), packageData, context);
49 49
            DocumentPool pool = context.getController().getDocumentPool();
50 50
            if (pool.isMarkedUnavailable(documentKey)) {
51 51
                return false;
latest10/hej/net/sf/saxon/functions/DocumentFn.java
199 199
        }
200 200

  
201 201
        // Resolve relative URI
202
        DocumentURI documentKey = computeDocumentKey(href, baseURI, packageData, c);
202
        DocumentKey documentKey = computeDocumentKey(href, baseURI, packageData, c);
203 203

  
204 204
        // see if the document is already loaded
205 205

  
......
417 417
     * Compute a document key
418 418
     */
419 419

  
420
    protected static DocumentURI computeDocumentKey(String href, String baseURI, PackageData packageData, XPathContext c) throws XPathException {
420
    protected static DocumentKey computeDocumentKey(String href, String baseURI, PackageData packageData, XPathContext c) throws XPathException {
421 421
        // Resolve relative URI
422 422
        Controller controller = c.getController();
423 423

  
......
439 439
     *              otherwise (typically a stylesheet module)
440 440
     */
441 441

  
442
    public static DocumentURI computeDocumentKey(
442
    public static DocumentKey computeDocumentKey(
443 443
            String href, String baseURI, PackageData packageData, URIResolver resolver, boolean strip) {
444
        String documentKey;
444
        String absURI;
445 445
        if (resolver instanceof RelativeURIResolver) {
446 446
            // If this is the case, the URIResolver is responsible for absolutization as well as dereferencing
447 447
            try {
448
                documentKey = ((RelativeURIResolver) resolver).makeAbsolute(href, baseURI);
448
                absURI = ((RelativeURIResolver) resolver).makeAbsolute(href, baseURI);
449 449
            } catch (TransformerException e) {
450
                documentKey = '/' + href;
450
                absURI = '/' + href;
451 451
            }
452 452
        } else {
453 453
            // Saxon takes charge of absolutization, leaving the user URIResolver to handle dereferencing only
......
455 455
            if (baseURI == null) {    // no base URI available
456 456
                try {
457 457
                    // the href might be an absolute URL
458
                    documentKey = new URI(href).toString();
458
                    absURI = new URI(href).toString();
459 459
                } catch (URISyntaxException err) {
460 460
                    // it isn't; but the URI resolver might know how to cope
461
                    documentKey = '/' + href;
461
                    absURI = '/' + href;
462 462
                }
463 463
            } else if (href.isEmpty()) {
464 464
                // common case in XSLT, which java.net.URI#resolve() does not handle correctly
465
                documentKey = baseURI;
465
                absURI = baseURI;
466 466
            } else {
467 467
                try {
468 468
                    URI uri = new URI(baseURI).resolve(href);
469
                    documentKey = uri.toString();
469
                    absURI = uri.toString();
470 470
                } catch (URISyntaxException | IllegalArgumentException err) {
471
                    documentKey = baseURI + "/../" + href;
471
                    absURI = baseURI + "/../" + href;
472 472
                }
473 473
            }
474 474
        }
......
476 476
                ((StylesheetPackage) packageData).getSpaceStrippingRule() != NoElementsSpaceStrippingRule.getInstance()) {
477 477
            String name = ((StylesheetPackage) packageData).getPackageName();
478 478
            if (name != null) {
479
                documentKey = name + " " + ((StylesheetPackage) packageData).getPackageVersion() + " " + documentKey;
479
                return new DocumentKey(absURI, name, ((StylesheetPackage) packageData).getPackageVersion());
480 480
            }
481 481
        }
482
        return new DocumentURI(documentKey);
482
        return new DocumentKey(absURI);
483 483
    }
484 484

  
485 485
    /**
latest10/hej/net/sf/saxon/om/DocumentKey.java
1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2018-2020 Saxonica Limited
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7

  
8
package net.sf.saxon.om;
9

  
10
import net.sf.saxon.style.PackageVersion;
11

  
12
import java.io.File;
13
import java.util.Objects;
14

  
15
/**
16
 * This class encapsulates a string used as the value of the document-uri() property of a document,
17
 * together with a normalized representation of the string used for equality comparisons. The idea
18
 * is that on Windows systems, document URIs are compared using case-blind comparison, but the original
19
 * case is retained for display purposes.
20
 *
21
 * <p>The package name and version of the document reference are retained, because calls of doc()
22
 * in different packages, using the same absolute URI, may return different documents, as a result
23
 * of the treatment of whitespace and type annotations varying.</p>
24
 */
25
public class DocumentKey {
26

  
27
    public final static boolean CASE_BLIND_FILES = new File("a").equals(new File("A"));
28

  
29
    private String displayValue;
30
    private String normalizedValue;
31
    private String packageName = "";
32
    private PackageVersion packageVersion = PackageVersion.ONE;
33

  
34
    /**
35
     * Create a DocumentURI object that wraps a given URI
36
     *
37
     * @param uri the URI to be wrapped. Must not be null
38
     * @throws NullPointerException if uri is null
39
     */
40

  
41
    public DocumentKey(String uri) {
42
        Objects.requireNonNull(uri);
43
        this.displayValue = uri;
44
        this.normalizedValue = normalizeURI(uri);
45
    }
46

  
47
    public DocumentKey(String uri, String packageName, PackageVersion version) {
48
        Objects.requireNonNull(uri);
49
        this.displayValue = uri;
50
        this.normalizedValue = normalizeURI(uri);
51
        this.packageName = packageName;
52
        this.packageVersion = version;
53
    }
54

  
55
    public String getAbsoluteURI() {
56
        return displayValue;
57
    }
58

  
59

  
60
    @Override
61
    public String toString() {
62
        return displayValue;
63
    }
64

  
65
    @Override
66
    public boolean equals(Object obj) {
67
        return obj instanceof DocumentKey
68
                && normalizedValue.equals(((DocumentKey) obj).normalizedValue)
69
                && packageName.equals(((DocumentKey)obj).packageName)
70
                && packageVersion.equals(((DocumentKey)obj).packageVersion);
71
    }
72

  
73
    @Override
74
    public int hashCode() {
75
        return normalizedValue.hashCode();
76
    }
77

  
78
    /**
79
     * Normalize the representation of file: URIs to give better equality matching than straight
80
     * string comparison. The main purpose is (a) to eliminate the distinction between "file:/" and
81
     * "file:///", and (b) to normalize case in the case of Windows filenames: especially the distinction
82
     * between "file:/C:" and "file:/c:".
83
     *
84
     * @param uri the URI to be normalized
85
     * @return the normalized URI.
86
     */
87

  
88
    public static String normalizeURI(String uri) {
89
        if (uri == null) {
90
            return null;
91
        }
92
        if (uri.startsWith("FILE:")) {
93
            uri = "file:" + uri.substring(5);
94
        }
95
        if (uri.startsWith("file:")) {
96
            if (uri.startsWith("file:///")) {
97
                uri = "file:/" + uri.substring(8);
98
            }
99
            if (CASE_BLIND_FILES) {
100
                uri = uri.toLowerCase();
101
            }
102
        }
103
        return uri;
104
    }
105
}
106

  
latest10/hej/net/sf/saxon/om/DocumentPool.java
31 31
    // each time. For this purpose we use a hashtable from
32 32
    // URI to DocumentInfo object.
33 33

  
34
    private Map<DocumentURI, TreeInfo> documentNameMap = new HashMap<DocumentURI, TreeInfo>(10);
34
    private Map<DocumentKey, TreeInfo> documentNameMap = new HashMap<DocumentKey, TreeInfo>(10);
35 35

  
36 36

  
37 37
    // The set of documents known to be unavailable. These documents must remain
38 38
    // unavailable for the duration of a transformation or query!
39 39

  
40
    private Set<DocumentURI> unavailableDocuments = new HashSet<DocumentURI>(10);
40
    private Set<DocumentKey> unavailableDocuments = new HashSet<DocumentKey>(10);
41 41

  
42 42
    /**
43 43
     * Add a document to the pool
......
48 48

  
49 49
    public synchronized void add(TreeInfo doc, /*@Nullable*/ String uri) {
50 50
        if (uri != null) {
51
            documentNameMap.put(new DocumentURI(uri), doc);
51
            documentNameMap.put(new DocumentKey(uri), doc);
52 52
        }
53 53
    }
54 54

  
......
59 59
     * @param uri The document-uri property of the document.
60 60
     */
61 61

  
62
    public synchronized void add(TreeInfo doc, /*@Nullable*/ DocumentURI uri) {
62
    public synchronized void add(TreeInfo doc, /*@Nullable*/ DocumentKey uri) {
63 63
        if (uri != null) {
64 64
            documentNameMap.put(uri, doc);
65 65
        }
......
74 74
     */
75 75

  
76 76
    public synchronized TreeInfo find(String uri) {
77
        return documentNameMap.get(new DocumentURI(uri));
77
        return documentNameMap.get(new DocumentKey(uri));
78 78
    }
79 79

  
80 80
    /**
......
85 85
     *         or null if it is not found.
86 86
     */
87 87

  
88
    public synchronized TreeInfo find(DocumentURI uri) {
88
    public synchronized TreeInfo find(DocumentKey uri) {
89 89
        return documentNameMap.get(uri);
90 90
    }
91 91

  
......
100 100

  
101 101
    /*@Nullable*/
102 102
    public synchronized String getDocumentURI(NodeInfo doc) {
103
        for (DocumentURI uri : documentNameMap.keySet()) {
103
        for (DocumentKey uri : documentNameMap.keySet()) {
104 104
            TreeInfo found = find(uri);
105 105
            if (found == null) {
106 106
                continue; // can happen when discard-document() is used concurrently
......
133 133
     */
134 134

  
135 135
    public synchronized TreeInfo discard(TreeInfo doc) {
136
        for (Map.Entry<DocumentURI, TreeInfo> e : documentNameMap.entrySet()) {
137
            DocumentURI name = e.getKey();
136
        for (Map.Entry<DocumentKey, TreeInfo> e : documentNameMap.entrySet()) {
137
            DocumentKey name = e.getKey();
138 138
            TreeInfo entry = e.getValue();
139 139
            if (entry.equals(doc)) {
140 140
                documentNameMap.remove(name);
......
163 163
     * @param uri the URI of the unavailable document
164 164
     */
165 165

  
166
    public void markUnavailable(DocumentURI uri) {
166
    public void markUnavailable(DocumentKey uri) {
167 167
        unavailableDocuments.add(uri);
168 168
    }
169 169

  
......
172 172
     * has been previously called and has returned false
173 173
     */
174 174

  
175
    public boolean isMarkedUnavailable(DocumentURI uri) {
175
    public boolean isMarkedUnavailable(DocumentKey uri) {
176 176
        return unavailableDocuments.contains(uri);
177 177
    }
178 178

  
latest10/hej/net/sf/saxon/om/DocumentURI.java
1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2018-2020 Saxonica Limited
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7

  
8
package net.sf.saxon.om;
9

  
10
import java.io.File;
11

  
12
/**
13
 * This class encapsulates a string used as the value of the document-uri() property of a document,
14
 * together with a normalized representation of the string used for equality comparisons. The idea
15
 * is that on Windows systems, document URIs are compared using case-blind comparison, but the original
16
 * case is retained for display purposes.
17
 */
18
public class DocumentURI {
19

  
20
    public final static boolean CASE_BLIND_FILES = new File("a").equals(new File("A"));
21

  
22
    private String displayValue;
23
    private String normalizedValue;
24

  
25
    /**
26
     * Create a DocumentURI object that wraps a given URI
27
     *
28
     * @param uri the URI to be wrapped. Must not be null
29
     * @throws NullPointerException if uri is null
30
     */
31

  
32
    public DocumentURI(/*@Nullable*/ String uri) {
33
        if (uri == null) {
34
            throw new NullPointerException("uri");
35
        }
36
        this.displayValue = uri;
37
        this.normalizedValue = normalizeURI(uri);
38
    }
39

  
40
    @Override
41
    public String toString() {
42
        return displayValue;
43
    }
44

  
45
    @Override
46
    public boolean equals(Object obj) {
47
        return obj instanceof DocumentURI && normalizedValue.equals(((DocumentURI) obj).normalizedValue);
48
    }
49

  
50
    @Override
51
    public int hashCode() {
52
        return normalizedValue.hashCode();
53
    }
54

  
55
    /**
56
     * Normalize the representation of file: URIs to give better equality matching than straight
57
     * string comparison. The main purpose is (a) to eliminate the distinction between "file:/" and
58
     * "file:///", and (b) to normalize case in the case of Windows filenames: especially the distinction
59
     * between "file:/C:" and "file:/c:".
60
     *
61
     * @param uri the URI to be normalized
62
     * @return the normalized URI.
63
     */
64

  
65
    public static String normalizeURI(String uri) {
66
        if (uri == null) {
67
            return null;
68
        }
69
        if (uri.startsWith("FILE:")) {
70
            uri = "file:" + uri.substring(5);
71
        }
72
        if (uri.startsWith("file:")) {
73
            if (uri.startsWith("file:///")) {
74
                uri = "file:/" + uri.substring(8);
75
            }
76
            if (CASE_BLIND_FILES) {
77
                uri = uri.toLowerCase();
78
            }
79
        }
80
        return uri;
81
    }
82
}
83

  
latest10/hej/net/sf/saxon/om/QNameParser.java
133 133
            } else if (endBrace == name.length() - 1) {
134 134
                throw new XPathException("Invalid EQName: local part is missing", errorOnBadSyntax);
135 135
            }
136
            String uri = name.substring(2, endBrace).toString();
136
            String uri = Whitespace.collapseWhitespace(name.substring(2, endBrace)).toString();
137
            if (uri.contains("{")) {
138
                throw new XPathException("Invalid EQName: URI contains opening brace", errorOnBadSyntax);
139
            }
137 140
            //String uri = Whitespace.collapseWhitespace(name.substring(2, endBrace)).toString();
138 141
            if (unescaper != null && uri.contains("&")) {
139 142
                uri = unescaper.unescape(uri).toString();
latest10/hej/net/sf/saxon/query/XQueryParser.java
3506 3506
            if (vName instanceof StringValue && !(vName instanceof AnyURIValue)) {
3507 3507
                String lex = ((StringValue) vName).getStringValue();
3508 3508
                try {
3509
                    QNameParser oldQP = getQNameParser();
3510
                    setQNameParser(oldQP.withUnescaper(null));
3509 3511
                    elemName = makeNodeName(lex, true);
3512
                    setQNameParser(oldQP);
3510 3513
                    elemName.obtainFingerprint(env.getConfiguration().getNamePool());
3511 3514
                } catch (XPathException staticError) {
3512 3515
                    String code = staticError.getErrorCodeLocalPart();
......
3637 3640
                }
3638 3641
                NodeName attributeName;
3639 3642
                try {
3643
                    QNameParser oldQP = getQNameParser();
3644
                    setQNameParser(oldQP.withUnescaper(null));
3640 3645
                    attributeName = makeNodeName(lex, false);
3646
                    setQNameParser(oldQP);
3641 3647
                } catch (XPathException staticError) {
3642 3648
                    String code = staticError.getErrorCodeLocalPart();
3643 3649
                    staticError.setLocator(makeLocation());
......
3650 3656
                    throw staticError;
3651 3657
                }
3652 3658
                if (attributeName.getPrefix().isEmpty() && !attributeName.hasURI("")) {
3653
                    attributeName = new FingerprintedQName("_", attributeName.getLocalPart(),
3654
                                                           attributeName.getURI(), attributeName.getFingerprint());
3659
                    attributeName = new FingerprintedQName("_", attributeName.getURI(),
3660
                                                           attributeName.getLocalPart(),
3661
                                                           attributeName.getFingerprint());
3655 3662
                }
3656 3663
                FixedAttribute fatt = new FixedAttribute(attributeName,
3657 3664
                                                         Validation.STRIP,
latest10/hej/net/sf/saxon/style/Compilation.java
45 45
    private boolean schemaAware;
46 46
    private QNameParser qNameParser;
47 47
    private Map<StructuredQName, ValueAndPrecedence> staticVariables = new HashMap<>();
48
    private Map<DocumentURI, TreeInfo> stylesheetModules = new HashMap<>();
49
    private Stack<DocumentURI> importStack = new Stack<>(); // handles both include and import
48
    private Map<DocumentKey, TreeInfo> stylesheetModules = new HashMap<>();
49
    private Stack<DocumentKey> importStack = new Stack<>(); // handles both include and import
50 50
    private PackageData packageData;
51 51
    private boolean preScan = true;
52 52
    private boolean createsSecondaryResultDocuments = false;
......
610 610
     * @return the map from absolute URIs to (documents containing) stylesheet modules
611 611
     */
612 612

  
613
    public Map<DocumentURI, TreeInfo> getStylesheetModules() {
613
    public Map<DocumentKey, TreeInfo> getStylesheetModules() {
614 614
        return stylesheetModules;
615 615
    }
616 616

  
......
620 620
     * @return the include/import stack
621 621
     */
622 622

  
623
    public Stack<DocumentURI> getImportStack() {
623
    public Stack<DocumentKey> getImportStack() {
624 624
        return importStack;
625 625
    }
626 626

  
latest10/hej/net/sf/saxon/style/PrincipalStylesheetModule.java
96 96

  
97 97
    // cache of stylesheet documents. Note that multiple imports of the same URI
98 98
    // lead to the stylesheet tree being reused
99
    private HashMap<DocumentURI, XSLModuleRoot> moduleCache = new HashMap<>(4);
99
    private HashMap<DocumentKey, XSLModuleRoot> moduleCache = new HashMap<>(4);
100 100

  
101 101
    private TypeAliasManager typeAliasManager;
102 102

  
......
290 290
     * @param module the stylesheet document tree corresponding to this absolute URI
291 291
     */
292 292

  
293
    public void putStylesheetDocument(DocumentURI key, XSLStylesheet module) {
293
    public void putStylesheetDocument(DocumentKey key, XSLStylesheet module) {
294 294
        moduleCache.put(key, module);
295 295
    }
296 296

  
......
301 301
     * @return the stylesheet document tree corresponding to this absolute URI
302 302
     */
303 303

  
304
    public XSLModuleRoot getStylesheetDocument(DocumentURI key) {
304
    public XSLModuleRoot getStylesheetDocument(DocumentKey key) {
305 305
        XSLModuleRoot sheet = moduleCache.get(key);
306 306
        if (sheet != null) {
307 307
            XPathException warning = new XPathException(
......
519 519
            } else if (use instanceof XSLInclude) {
520 520
                String href = Whitespace.trim(use.getAttributeValue("", "href"));
521 521
                URIResolver resolver = compilation.getCompilerInfo().getURIResolver();
522
                DocumentURI key = DocumentFn.computeDocumentKey(href, use.getBaseURI(), compilation.getPackageData(), resolver, false);
522
                DocumentKey key = DocumentFn.computeDocumentKey(href, use.getBaseURI(), compilation.getPackageData(), resolver, false);
523 523
                TreeInfo includedTree = compilation.getStylesheetModules().get(key);
524 524
                StyleElement incWrapper = (StyleElement) ((DocumentImpl) includedTree.getRootNode()).getDocumentElement();
525 525
                gatherUsePackageDeclarations(compilation, incWrapper, declarations);
latest10/hej/net/sf/saxon/style/StylesheetModule.java
12 12
import net.sf.saxon.event.*;
13 13
import net.sf.saxon.expr.parser.Loc;
14 14
import net.sf.saxon.lib.*;
15
import net.sf.saxon.om.DocumentURI;
15
import net.sf.saxon.om.DocumentKey;
16 16
import net.sf.saxon.om.NoElementsSpaceStrippingRule;
17 17
import net.sf.saxon.om.NodeInfo;
18 18
import net.sf.saxon.om.StylesheetSpaceStrippingRule;
......
82 82
            Source styleSource, boolean topLevelModule, Compilation compilation, NestedIntegerValue precedence) throws XPathException {
83 83

  
84 84
        String systemId = styleSource.getSystemId();
85
        DocumentURI docURI = systemId == null ? null : new DocumentURI(systemId);
85
        DocumentKey docURI = systemId == null ? null : new DocumentKey(systemId);
86 86
        if (systemId != null && compilation.getImportStack().contains(docURI)) {
87 87
            throw new XPathException("The stylesheet module includes/imports itself directly or indirectly", "XTSE0180");
88 88
        }
......
183 183
        }
184 184

  
185 185
        String systemId = styleSource.getSystemId();
186
        DocumentURI docURI = systemId == null ? null : new DocumentURI(systemId);
186
        DocumentKey docURI = systemId == null ? null : new DocumentKey(systemId);
187 187
        if (systemId != null && compilation.getImportStack().contains(docURI)) {
188 188
            throw new XPathException("The stylesheet module includes/imports itself directly or indirectly", "XTSE0180");
189 189
        }
latest10/hej/net/sf/saxon/style/UseWhenFilter.java
290 290

  
291 291
        URIResolver resolver = compilation.getCompilerInfo().getURIResolver();
292 292
        String baseUriStr = baseUri.toString();
293
        DocumentURI key = DocumentFn.computeDocumentKey(href, baseUriStr, compilation.getPackageData(), resolver, false);
294
        Map<DocumentURI, TreeInfo> map = compilation.getStylesheetModules();
293
        DocumentKey key = DocumentFn.computeDocumentKey(href, baseUriStr, compilation.getPackageData(), resolver, false);
294
        Map<DocumentKey, TreeInfo> map = compilation.getStylesheetModules();
295 295
        if (map.containsKey(key)) {
296 296
            return (DocumentImpl)map.get(key);
297 297
        } else {
latest10/hej/net/sf/saxon/style/XSLGeneralIncorporate.java
10 10
import net.sf.saxon.Configuration;
11 11
import net.sf.saxon.functions.DocumentFn;
12 12
import net.sf.saxon.om.AttributeInfo;
13
import net.sf.saxon.om.DocumentURI;
13
import net.sf.saxon.om.DocumentKey;
14 14
import net.sf.saxon.om.NodeName;
15 15
import net.sf.saxon.trans.XPathException;
16 16
import net.sf.saxon.tree.linked.DocumentImpl;
......
108 108
            XSLStylesheet includedSheet;
109 109
            StylesheetModule incModule;
110 110

  
111
            DocumentURI key = DocumentFn.computeDocumentKey(href, getBaseURI(), getCompilation().getPackageData(), resolver, false);
111
            DocumentKey key = DocumentFn.computeDocumentKey(href, getBaseURI(), getCompilation().getPackageData(), resolver, false);
112 112
            includedSheet = (XSLStylesheet)psm.getStylesheetDocument(key);
113 113
            if (includedSheet != null) {
114 114
                // we already have the stylesheet document in cache; but we need to create a new module,
......
184 184

  
185 185
        if (source.getSystemId() != null) {
186 186
            while (anc != null) {
187
                if (DocumentURI.normalizeURI(source.getSystemId())
188
                        .equals(DocumentURI.normalizeURI(anc.getRootElement().getSystemId()))) {
187
                if (DocumentKey.normalizeURI(source.getSystemId())
188
                        .equals(DocumentKey.normalizeURI(anc.getRootElement().getSystemId()))) {
189 189
                    compileError("A stylesheet cannot " + getLocalPart() + " itself",
190 190
                            this instanceof XSLInclude ? "XTSE0180" : "XTSE0210");
191 191
                    return true;
latest10/hej/net/sf/saxon/trans/XsltController.java
49 49
    private Supplier<Receiver> messageFactory = () -> new NamespaceDifferencer(new MessageEmitter(), new Properties());
50 50
    private boolean assertionsEnabled = true;
51 51
    private ResultDocumentResolver resultDocumentResolver;
52
    private HashSet<DocumentURI> allOutputDestinations;
52
    private HashSet<DocumentKey> allOutputDestinations;
53 53
    private Component.M initialMode = null;
54 54
    private Function initialFunction = null;
55 55
    private Map<StructuredQName, Sequence> initialTemplateParams;
......
226 226
     * @return true if the URI is available for use; false if it has already been used.
227 227
     */
228 228

  
229
    public synchronized boolean checkUniqueOutputDestination(/*@Nullable*/ DocumentURI uri) {
229
    public synchronized boolean checkUniqueOutputDestination(/*@Nullable*/ DocumentKey uri) {
230 230
        if (uri == null) {
231 231
            return true;    // happens when writing say to an anonymous StringWriter
232 232
        }
......
244 244
     * @param uri A URI that is not available as an output destination
245 245
     */
246 246

  
247
    public void addUnavailableOutputDestination(DocumentURI uri) {
247
    public void addUnavailableOutputDestination(DocumentKey uri) {
248 248
        if (allOutputDestinations == null) {
249 249
            allOutputDestinations = new HashSet<>(20);
250 250
        }
......
258 258
     * @param uri A URI that is being made available as an output destination
259 259
     */
260 260

  
261
    public void removeUnavailableOutputDestination(DocumentURI uri) {
261
    public void removeUnavailableOutputDestination(DocumentKey uri) {
262 262
        if (allOutputDestinations != null) {
263 263
            allOutputDestinations.remove(uri);
264 264
        }
......
275 275
     * it may return different results for the same URI at different points in the transformation.
276 276
     */
277 277

  
278
    public boolean isUnusedOutputDestination(DocumentURI uri) {
278
    public boolean isUnusedOutputDestination(DocumentKey uri) {
279 279
        return allOutputDestinations == null || !allOutputDestinations.contains(uri);
280 280
    }
281 281

  

Also available in: Unified diff