Results 1 to 2 of 2

Thread: PropertiesBeanDefinitionReader bug won't allow certain views

  1. #1
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    2

    Default PropertiesBeanDefinitionReader bug won't allow certain views

    If you are using a ResourceBundleViewResolver and you want to use view names that contain a "." (that's a dot), you are out of luck.

    The offending code is located in org.springframework.beans.factory.support.Properti esBeanDefinitionReader starting at line 253:

    Code:
    public int registerBeanDefinitions(Map map, String prefix, String resourceDescription) throws BeansException {
    		if (prefix == null) {
    			prefix = "";
    		}
    		int beanCount = 0;
    
    		Set keys = map.keySet();
    		Iterator itr = keys.iterator();
    		while (itr.hasNext()) {
    			String key = (String) itr.next();
    			if (key.startsWith(prefix)) {
    				// Key is of form prefix<name>.property
    				String nameAndProperty = key.substring&#40;prefix.length&#40;&#41;&#41;;
    				int sepIndx = nameAndProperty.indexOf&#40;SEPARATOR&#41;;
    				if &#40;sepIndx != -1&#41; &#123;
    					String beanName = nameAndProperty.substring&#40;0, sepIndx&#41;;
    The problem is your view doesn't start with a prefix but the tokenizer steps in and chops the view name off at the first "." on line 266. It could be fixed by making sure prefix has a positive length on line 263.

    Until then -- no dots in your views defined by ResourceBundles.

    -a.

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Good point! Actually, the separator is between bean name and property name: The only fix requires is to use "lastIndexOf" rather than "indexOf" (a property name is not allowed to contain a dot). I've just fixed this, and also added corresponding tests.

    Juergen

Similar Threads

  1. Replies: 22
    Last Post: Feb 4th, 2010, 01:37 AM
  2. AbstractWizardController views
    By avp12 in forum Web
    Replies: 0
    Last Post: Mar 30th, 2005, 04:51 PM
  3. Multiple views and pages question
    By jwray in forum Swing
    Replies: 3
    Last Post: Feb 19th, 2005, 09:22 AM
  4. Newbie question on Pages and Views
    By ragnarwestad in forum Swing
    Replies: 8
    Last Post: Dec 13th, 2004, 10:47 PM
  5. How to map views
    By pak in forum Web
    Replies: 4
    Last Post: Sep 8th, 2004, 02:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •