doc.calculateTreeLevelStartPoints();
try { doc.calculateTreeLevelStartPoints(); } catch(EXistException e) { }
    private DocumentImpl readDocument( ResultSet r ) throws SQLException {        int doc_id = r.getShort( 1 );        String doctype = r.getString( 2 );        String publicId = r.getString( 3 );        String systemId = r.getString( 4 );        int children = r.getInt( 5 );        String name = r.getString( 6 );        DocumentImpl doc = new DocumentImpl( this, name );        doc.setChildCount( children );        doc.setDocId( doc_id );        doc.setBroker( this );        if ( doctype != null && doctype.length() > 0 ) {            DocumentTypeImpl docType =                new DocumentTypeImpl( doctype, publicId, systemId );            doc.setDocumentType( docType );        }        m_getTreeInfo.setInt( 1, doc_id );        ResultSet rs = m_getTreeInfo.executeQuery();        int o;        int level = 0;        while ( rs.next() ) {            o = rs.getInt( 1 );            doc.setTreeLevelOrder( level++, o );        }        doc.setMaxDepth( level + 1 );        doc.calculateTreeLevelStartPoints();        return doc;    }