/** * Create an instance */ public ValueBTreeCursor( BTree<V, V> valueBtree ) { this.valueBtree = valueBtree; // Start at -1 to be positioned before the first element try { if ( valueBtree != null ) { cursor = valueBtree.browseKeys(); } } catch ( IOException e ) { // TODO Auto-generated catch block e.printStackTrace(); } catch ( KeyNotFoundException knfe ) { // TODO Auto-generated catch block knfe.printStackTrace(); } }
/** * {@inheritDoc} */ @Override protected Iterable<String> doGetIdentities() throws KrbException { List<String> keys = new ArrayList<>(); KeyCursor<String> cursor = null; try { cursor = database.browseKeys(); while (cursor.hasNext()) { keys.add(cursor.next()); } } catch (Exception e) { throw new KrbException("Errors occurred while fetching the principals", e); } finally { if (cursor != null) { cursor.close(); } } return keys; }