[jboss-user] [JBoss Cache: Core Edition] - Re: JDBMCacheLoader location property

cavani do-not-reply at jboss.com
Wed Nov 26 06:28:36 EST 2008


'#data' is a parameter of location property.

The expected behavior is: when there is no '#databaseName', cluster name is used for this purpose.

The code is just inverted.

At JDBMCacheLoader start method:
(is basically the same for BDBJE)


  |       // test location
  |       File location = new File(locationStr);
  |       if (!location.exists())
  |       {
  |          boolean created = location.mkdirs();
  |          if (!created) throw new IOException("Unable to create cache loader location " + location);
  | 
  |       }
  |       if (!location.isDirectory())
  |       {
  |          throw new IOException("Cache loader location [" + location + "] is not a directory!");
  |       }
  | 
  |       /* Parse config string. */
  |       File homeDir;
  |       int offset = locationStr.indexOf('#');
  |       String cacheDbName;
  |       if (offset >= 0 && offset < locationStr.length() - 1)
  |       {
  |          homeDir = new File(locationStr.substring(0, offset));
  |          cacheDbName = locationStr.substring(offset + 1);
  |       }
  |       else
  |       {
  |          homeDir = new File(locationStr);
  |          cacheDbName = cache.getClusterName();
  |       }
  | 

my suggestion:
('homeDir' is unnecessary, just use 'location' where it is used)


  |       /* Parse config string. */
  |       int offset = locationStr.indexOf('#');
  |       String cacheDbName;
  |       if (offset >= 0 && offset < locationStr.length() - 1)
  |       {
  |          cacheDbName = locationStr.substring(offset + 1);
  |          locationStr = locationStr.substring(0, offset);
  |       }
  |       else
  |       {
  |          cacheDbName = cache.getClusterName();
  |       }
  | 
  |       // test location
  |       File location = new File(locationStr);
  |       if (!location.exists())
  |       {
  |          boolean created = location.mkdirs();
  |          if (!created) throw new IOException("Unable to create cache loader location " + location);
  | 
  |       }
  |       if (!location.isDirectory())
  |       {
  |          throw new IOException("Cache loader location [" + location + "] is not a directory!");
  |       }
  | 

Thanks,

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192418#4192418

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4192418



More information about the jboss-user mailing list