LOG.debug("Found: " + result.getLength() + " for " + qname);
    public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname, NodeSelector selector) {        short nodeType;        switch (type) {               case ElementValue.ATTRIBUTE_ID : //is this correct ? -pb            case ElementValue.ATTRIBUTE :                nodeType = Node.ATTRIBUTE_NODE;                break;                        case ElementValue.ELEMENT :                nodeType = Node.ELEMENT_NODE;                 break;                        default :                throw new IllegalArgumentException("Invalid type");        }                final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256);        final SymbolTable symbols = broker.getSymbols();        final Lock lock = dbNodes.getLock();        for (Iterator i = docs.getCollectionIterator(); i.hasNext();) {            //Compute a key for the node            Collection collection = (Collection) i.next();            short collectionId = collection.getId();                        ElementValue ref;            if (type == ElementValue.ATTRIBUTE_ID) {                ref = new ElementValue((byte) type, collectionId, qname.getLocalName());            } else {                short sym = symbols.getSymbol(qname.getLocalName());                short nsSym = symbols.getNSSymbol(qname.getNamespaceURI());                ref = new ElementValue((byte) type, collectionId, sym, nsSym);            }            try {                lock.acquire(Lock.READ_LOCK);                VariableByteInput is = dbNodes.getAsStream(ref);                 //Does the node already has data in the index ?                if (is == null)                     continue;                                while (is.available() > 0) {                    int storedDocId = is.readInt();                    int gidsCount = is.readInt();                    //TOUNDERSTAND -pb                    int size = is.readFixedInt();                    DocumentImpl storedDocument = docs.getDoc(storedDocId);                    //Exit if the document is not concerned                    if (storedDocument == null) {                        is.skipBytes(size);                        continue;                    }                                   //Process the nodes                    long previousGID = 0;                    for (int k = 0; k < gidsCount; k++) {                        long delta = is.readLong();                        long storedGID = previousGID + delta;                         long address = StorageAddress.read(is);                        if (selector == null) {                            NodeProxy storedNode = new NodeProxy(storedDocument, storedGID, nodeType, address);                            result.add(storedNode, gidsCount);                                                } else {                            //Filter out the node if requested to do so                            NodeProxy storedNode = selector.match(storedDocument, storedGID);                            if (storedNode != null) {                                storedNode.setInternalAddress(address);                                storedNode.setNodeType(nodeType);                                result.add(storedNode, gidsCount);                            }                                                        }                        previousGID = storedGID;                                            }                }            } catch (EOFException e) {                //EOFExceptions are expected here            } catch (LockException e) {                LOG.warn("Failed to acquire lock for '" + dbNodes.getFile().getName() + "'", e);            } catch (IOException e) {                LOG.error(e.getMessage(), e);                               //TODO : return ?            } finally {                lock.release();            }        }        LOG.debug("Found: " + result.getLength() + " for " + qname);        return result;    }