Value name; try { name = new Value(collection.getURI().toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException uee) { LOG.debug(uee); name = new Value(collection.getURI().toString().getBytes()); }
Value name = new CollectionStore.CollectionKey(collection.getURI().toString());
    public void saveCollection(Txn transaction, Collection collection) throws PermissionDeniedException {        if (collection == null) {            LOG.error("NativeBroker.saveCollection called with collection == null! Aborting.");            return;        }        if (readOnly)            throw new PermissionDeniedException(DATABASE_IS_READ_ONLY);        if (!pool.isInitializing())            // don't cache the collection during initialization: SecurityManager is not yet online            pool.getCollectionsCache().add(collection);                Lock lock = collectionsDb.getLock();        try {                       lock.acquire(Lock.WRITE_LOCK);            if (collection.getId() == Collection.UNKNOWN_COLLECTION_ID)                collection.setId(getNextCollectionId(transaction));            Value name;            try {                name = new Value(collection.getURI().toString().getBytes("UTF-8"));            } catch (UnsupportedEncodingException uee) {                LOG.debug(uee);                name = new Value(collection.getURI().toString().getBytes());            }                        try {                final VariableByteOutputStream ostream = new VariableByteOutputStream(8);                collection.write(this, ostream);                final long addr = collectionsDb.put(transaction, name, ostream.data(), true);                if (addr == BFile.UNKNOWN_ADDRESS) {                    //TODO : exception !!! -pb                    LOG.warn("could not store collection data for '" + collection.getURI()+ "'");                    return;                }                collection.setAddress(addr);                ostream.close();            } catch (IOException ioe) {                LOG.debug(ioe);            }        } catch (ReadOnlyException e) {            LOG.warn(DATABASE_IS_READ_ONLY);        } catch (LockException e) {            LOG.warn("Failed to acquire lock on " + collectionsDb.getFile().getName(), e);        } finally {            lock.release();        }    }