Project

Profile

Help

Revision b1ace70f

Added by Michael Kay over 7 years ago

Fix bug 2104

View differences:

latest9.5/hej/net/sf/saxon/event/SequenceWriter.java
37 37
public abstract class SequenceWriter extends SequenceReceiver {
38 38
    private Receiver outputter = null;
39 39
    private Builder builder = null;
40
    private TreeModel treeModel;
40 41
    private int level = 0;
41 42
    private boolean inStartTag = false;
42 43

  
......
53 54

  
54 55
    public abstract void write(Item item) throws XPathException;
55 56

  
57
    public TreeModel getTreeModel() {
58
        return treeModel;
59
    }
60

  
61
    public void setTreeModel(TreeModel treeModel) {
62
        this.treeModel = treeModel;
63
    }
64

  
56 65
    /**
57 66
     * Start of a document node.
58 67
    */
......
75 84

  
76 85
    private void createTree(boolean mutable) throws XPathException {
77 86
        PipelineConfiguration pipe = getPipelineConfiguration();
78
        if (mutable) {
79
            TreeModel model = pipe.getController().getModel();
80
            if (model.isMutable()) {
81
                builder = pipe.getController().makeBuilder();
87
        if (treeModel != null) {
88
            builder = treeModel.makeBuilder(pipe);
89
        } else {
90
            if (mutable) {
91
                TreeModel model = pipe.getController().getModel();
92
                if (model.isMutable()) {
93
                    builder = pipe.getController().makeBuilder();
94
                } else {
95
                    builder = new LinkedTreeBuilder(pipe);
96
                }
82 97
            } else {
83
                builder = new LinkedTreeBuilder(pipe);
98
                builder = pipe.getController().makeBuilder();
84 99
            }
85
        } else {
86
            builder = pipe.getController().makeBuilder();
87 100
        }
88 101
        builder.setPipelineConfiguration(pipe);
89 102
        builder.setSystemId(getSystemId());
latest9.5/hej/net/sf/saxon/s9api/MessageListenerProxy.java
15 15
import net.sf.saxon.om.Item;
16 16
import net.sf.saxon.om.NodeInfo;
17 17
import net.sf.saxon.om.NodeName;
18
import net.sf.saxon.om.TreeModel;
18 19
import net.sf.saxon.trans.XPathException;
19 20
import net.sf.saxon.type.SchemaType;
20 21

  
......
31 32

  
32 33
    protected MessageListenerProxy(MessageListener listener, PipelineConfiguration pipe) {
33 34
        super(pipe);
35
        // See bug 2104. We use the Linked Tree model because the TinyTree can use excessive memory. This
36
        // is because the initial size allocation is based on the size of source documents, which might be large;
37
        // also because we store several messages in a single TinyTree; and because we fail to condense the tree.
38
        setTreeModel(TreeModel.LINKED_TREE);
34 39
        this.listener = listener;
35 40
    }
36 41

  

Also available in: Unified diff