[hibernate-issues] [Hibernate-JIRA] Created: (HV-162) XML based configuration should be tolerant to line breaks and white spaces where appropriate

Gunnar Morling (JIRA) noreply at atlassian.com
Tue May 5 08:58:17 EDT 2009


XML based configuration should be tolerant to line breaks and white spaces where appropriate
--------------------------------------------------------------------------------------------

                 Key: HV-162
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-162
             Project: Hibernate Validator
          Issue Type: Bug
    Affects Versions: 4.0.0.Beta1
            Reporter: Gunnar Morling
            Priority: Minor


When using the XML based configuration approach, unnecessary line breaks can cause some trouble. Eclipse formatted a config file of mine as follows:

	...
	<default-package>org.hibernate.validation.bugscenario
	</default-package>

	<bean class="Order" ignore-annotations="false">
	...

which leads to a ClassNotFoundException:

java.lang.ClassNotFoundException: org.hibernate.validation.bugscenario
	.Order

(note the line break after the package name), that is caught in XmlMappingParser, line 558 and rethrown as ValidationException. The problem goes away, if I format the package name as follows:

	<default-package>org.hibernate.validation.bugscenario</default-package>

To make the XML based configuration more robust, trimming Strings such as the package name could be considered. This could be achieved by 
leveraging JAXB's CollapsedStringAdapter (https://jaxb.dev.java.net/nonav/2.1.11/docs/api/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.html).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list