Project

Profile

Help

Revision dc68baf5

Added by Michael Kay over 15 years ago

Fix bug 1552815 (rereading a document after saxon:discard-document()

View differences:

latest8.8/bj/net/sf/saxon/Controller.java
456 456
        }
457 457
        allOutputDestinations.add(uri);
458 458
    }
459
    
460
    /**
461
     * Remove a URI from the set of output destinations that cannot be written to or read from.
462
     * Used to support saxon:discard-document()
463
     */
464

  
465
    public void removeUnavailableOutputDestination(String uri) {
466
        if (allOutputDestinations != null) {
467
            allOutputDestinations.remove(uri);
468
        }
469
    }
470
    
459 471

  
460 472
    /**
461 473
     * Determine whether an output URI is available for use. This method is intended
latest8.8/bj/net/sf/saxon/functions/Extensions.java
127 127
     * select="saxon:discard-document(document('a.xml'))"
128 128
     */
129 129

  
130
    public static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc) {
130
   public static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc) {
131 131
        if (doc == null) {
132 132
            return null;
133 133
        }
134
        return context.getController().getDocumentPool().discard(doc);
134
        Controller c = context.getController();
135
        String uri = c.getDocumentPool().getDocumentURI(doc);
136
        if (uri != null) {
137
            c.removeUnavailableOutputDestination(uri);
138
        }
139
        return c.getDocumentPool().discard(doc);
135 140
    }
136 141

  
142

  
137 143
    /**
138 144
    * Determine whether two node-sets contain the same nodes
139 145
    * @param p1 The first node-set. The iterator must be correctly ordered.

Also available in: Unified diff