Announcement Announcement Module
No announcement yet.
PropertiesBeanDefinitionReader bug won't allow certain views Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 esBeanDefinitionReader starting at line 253:

    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);
    			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.


  • #2
    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.