• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009

Description

Having cache names with slashes leads to problems. For instance, RMICacheManagerPeerProvider does the following:

static String extractCacheName(String rmiUrl) { return rmiUrl.substring(rmiUrl.lastIndexOf(‘/’) + 1); }

This one bit me pretty hard.

Maybe names with slashes should be disallowed completely?

Sourceforge Ticket ID: 1521699 - Opened By: daniel_wiell - 13 Jul 2006 09:35 UTC

Comments

Sourceforge Tracker 2009-09-21

Logged In: YES user_id=693320

Daniel

I did not see that one coming. Fixed. This is in trunk and will be in ehcache-1.2.2. Also added a test to Cache.

/**
 * Checks when and how we can set the cache name.
 */
public void testSetCacheName() throws CacheException {
    //Not put into manager.
    Ehcache cache = new Cache("testCache", 1, true, false, 5, 2);

    try {
        cache.setName(null);
        fail();
    } catch (IllegalArgumentException e) {
        //expected
    }

    try {
        cache.setName("illegal/name");
        fail();
    } catch (IllegalArgumentException e) {
        //expected
    }

    manager.addCache(cache);
    try {
        cache.setName("trying_to_change_name_after_initialised");
        fail();
    } catch (IllegalStateException e) {
        //expected
    }
}

Thanks for the report.

Greg Comment by: gregluck - 16 Jul 2006 06:23 UTC

Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira