ClassCastException in HibernateConfigurer
Brought to you by:
kstenerud
I used HSE in conjunction with Spring 2.0.5 and encountered a CCE in HibernateConfigurer (line 75).
It is assumed there that SpringPropertyHelper#getList(BeanDefinition, String, String) does yield a list of String. Though, I found that an instance of org.springframework.beans.factory.config.TypedstringValue has been returned.
IN HibernatConfigure.JAVA CHANGE THIS
Pattern pattern = Pattern.compile((String)matchIterator.next());
FOR THIS:
String stringPattern ;
Object item = matchIterator.next();
try {
stringPattern = (String)item; // Spring 1.2
}
catch(Exception e){
TypedStringValue typedStringValue = (TypedStringValue)item; // Spring 1.2+
stringPattern = typedStringValue.getValue();
}
Pattern pattern = Pattern.compile(stringPattern);