exceptionOcurred = true;
    public NodeSet findElementsByTagName(byte type, DocumentSet docs,            QName qname, NodeSelector selector) {//        		final long start = System.currentTimeMillis();        final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(),                256);        final SymbolTable symbols = broker.getSymbols();        DocumentImpl doc;        int docId;        int len;        short collectionId;        long gid;        VariableByteInput is = null;        ElementValue ref;        short sym, nsSym;        Collection collection;        NodeProxy p;        final short nodeType = (type == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE                : Node.ELEMENT_NODE);        final Lock lock = dbElement.getLock();        for (Iterator i = docs.getCollectionIterator(); i.hasNext();) {            collection = (Collection) i.next();            collectionId = collection.getId();            if (type == ElementValue.ATTRIBUTE_ID) {                ref = new ElementValue((byte) type, collectionId, qname                        .getLocalName());            } else {                sym = symbols.getSymbol(qname.getLocalName());                nsSym = symbols.getNSSymbol(qname.getNamespaceURI());                ref = new ElementValue((byte) type, collectionId, sym, nsSym);            }            boolean exceptionOcurred = false;            try {                lock.acquire(Lock.READ_LOCK);                is = dbElement.getAsStream(ref);            } catch (LockException e) {                LOG.warn(                        "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - "                                + "failed to acquire lock", e);                // jmv: dis = null;                exceptionOcurred = true;            } catch (IOException e) {                LOG.warn(                        "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - "                                + "io exception while reading elements for "                                + qname, e);                // jmv: dis = null;                exceptionOcurred = true;            } finally {                lock.release();            }            // jmv: if (dis == null)            // wolf: dis == null if no matching element has been found in the            // index            if (is == null || exceptionOcurred) continue;            try {                while (is.available() > 0) {                    docId = is.readInt();                    len = is.readInt();                    if ((doc = docs.getDoc(docId)) == null) {                        is.skip(len * 4);                        continue;                    }                    gid = 0;                    for (int k = 0; k < len; k++) {                        gid = gid + is.readLong();                        if(selector == null)                            p = new NodeProxy(doc, gid, nodeType, StorageAddress.read(is));                        else {                            p = selector.match(doc, gid);                            if(p != null) {                                p.setInternalAddress(StorageAddress.read(is));                                p.setNodeType(nodeType);                            } else                                is.skip(3);                        }                        if(p != null)                            result.add(p, len);                    }                }            } catch (EOFException e) {            } catch (IOException e) {                LOG.warn(                        "findElementsByTagName(byte, DocumentSet, QName, NodeSelector) - "                                + "unexpected io error", e);            }        }        //		result.sort();//        				LOG.debug(//        					"found "//        						+ qname//        						+ ": "//        						+ result.getLength()//        						+ " in "//        						+ (System.currentTimeMillis() - start)//        						+ "ms.");        return result;    }