• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • Configuration
  • hsingh
  • Reporter: benze
  • September 30, 2009
  • 0
  • Watchers: 0
  • February 12, 2013
  • November 04, 2009

Attachments

Description

If a region-name contains any trailing spaces in the tc-hibernate-cache.xml config file (ie: before the closing </region-name> tag), the spaces are considered verbatim.

I would have expected prefix’ing and trailing spaces to be ignored by the xml parser.

For example, I would have expected

My.Region

to be the same as

My.Region

Comments

Chris Dennis 2009-11-03

This is obviously a trivial thing to fix, but just to muddy the waters slightly I thought I had better ask this first:

As far as I can tell from the source code Hibernate does not ever trim the text in the mapping xml. This means that in principle you can define an entity to use a cache whose name has whitespace in it. Sounds crazy I know. Do we want to implement this, and then prevent those people from using us without changing their cache names?

Chris

Chris Dennis 2009-11-04

I’ve modified the xpath expression that matches against the region name text to normalize the whitespace of the text before attempting the match. This will trim the leading and trailing whitespace, and collapse internal whitespace sequences to a single space character. I also added a test to XMLConfigurationTest.

Himadri Singh 2009-12-15

used attached tc-hibernate.xml file in h2lcperf.

Running with Terracotta 3.1.1, as of 20091008-111057 (Revision 13788 by cruise@su10mo5 from 3.1) 2009-12-14 21:42:20,107 [main] INFO com.tc.plugins.ModulesLoader - BuildInfo for module: org.terracotta.modules.tim-hibernate-cache-provider-3.2 BuildInfo-User: cruise BuildInfo-Revision: 19059 BuildInfo-Timestamp: 20091009-152019 BuildInfo-URL: http://svn.terracotta.org/svn/forge/projects/tim-hibernate-cache/tags/release-1.0.1/tim-hibernate-cache-provider-3.2 BuildInfo-Host: kong.terracotta.lan

Got following logs: 2009-12-14 21:42:26,332 INFO [XMLConfigurationProvider] - <No cache-specific configuration for : org.springframework.samples.petclinic.Owner> 2009-12-14 21:42:26,415 INFO [XMLConfigurationProvider] - <No cache-specific configuration for : org.springframework.samples.petclinic.Owner.petsInternal>

Running withTerracotta 3.2.0, as of 20091212-151212 (Revision 14206 by cruise@su10mo5 from 3.2) 2009-12-14 21:48:25,680 [main] INFO com.tc.plugins.ModulesLoader - BuildInfo for module: org.terracotta.modules.tim-hibernate-cache-provider-3.2 BuildInfo-User: cruise BuildInfo-Revision: 19676 BuildInfo-Timestamp: 20091212-051857 BuildInfo-URL: http://svn.terracotta.org/svn/forge/projects/tim-hibernate-cache/tags/release-1.1.0/tim-hibernate-cache-provider-3.2 BuildInfo-Host: kong.terracotta.lan

Got following logs: 2009-12-14 21:48:31,949 INFO [XMLConfigurationProvider] - <Found cache-specific configuration for : org.springframework.samples.petclinic.Owner> 2009-12-14 21:48:32,046 INFO [XMLConfigurationProvider] - <Found cache-specific configuration for : org.springframework.samples.petclinic.Owner.petsInternal>

Verified.