Code example for CacheException

0
        try { 
            Element element = new Element( key, value ); 
            cache.put( element ); 
        } 
        catch ( IllegalArgumentException e ) {
            throw new CacheException( e );
        } 
        catch ( IllegalStateException e ) {
            throw new CacheException( e );
        } 
        catch ( net.sf.ehcache.CacheException e ) {
            if ( e instanceof NonStopCacheException ) {
                HibernateNonstopCacheExceptionHandler.getInstance() 
                        .handleNonstopCacheException( (NonStopCacheException) e );
            } 
            else { 
                throw new CacheException( e );
            } 
        } 
    }