} finally {
} catch (TriggerException e) { throw new XMLDBException( ErrorCodes.INVALID_RESOURCE, e.getMessage(), e); } finally {
    public void removeResource( Resource res ) throws XMLDBException {        if( !(res instanceof XMLResource) )            throw new XMLDBException( ErrorCodes.NOT_IMPLEMENTED );        if ( res == null )            return;        String name = getPath();        name = name + '/' + ((XMLResource)res).getDocumentId();        DocumentImpl doc = collection.getDocument( name );        if ( doc == null )            throw new XMLDBException( ErrorCodes.INVALID_RESOURCE,                "resource " + name + " not found" );        DBBroker broker = null;        try {            broker = brokerPool.get();            broker.removeDocument( user, name );        } catch ( EXistException e ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR,                e.getMessage(),                e );        } catch ( PermissionDeniedException e ) {            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED,                e.getMessage(),                e );        } finally {            brokerPool.release( broker );        }        needsSync = true;		load(getPath());    }