HHH-8364 exclude-unlisted-classes parsing handles content incorrectly

Parsing for exclude-unlisted-classes handles content within the element incorrectly. The value correctly defaults to false. <exclude-unlisted-classes /> and <exclude-unlisted-classes>true</exclude-unlisted-classes> are correctly parsed as true. However, <exclude-unlisted-classes>false</exclude-unlisted-classes> is incorrectly parsed as true. This commit fixes that.
This commit is contained in:
beamerblvd 2013-08-17 01:36:45 -05:00 committed by Brett Meyer
parent 3869845ee0
commit 34965da78f
1 changed files with 9 additions and 1 deletions

View File

@ -217,7 +217,7 @@ public class PersistenceXmlParser {
persistenceUnit.addJarFileUrl( ArchiveHelper.getURLFromPath( extractContent( element ) ) ); persistenceUnit.addJarFileUrl( ArchiveHelper.getURLFromPath( extractContent( element ) ) );
} }
else if ( tag.equals( "exclude-unlisted-classes" ) ) { else if ( tag.equals( "exclude-unlisted-classes" ) ) {
persistenceUnit.setExcludeUnlistedClasses( true ); persistenceUnit.setExcludeUnlistedClasses( extractBooleanContent(element, true) );
} }
else if ( tag.equals( "delimited-identifiers" ) ) { else if ( tag.equals( "delimited-identifiers" ) ) {
persistenceUnit.setUseQuotedIdentifiers( true ); persistenceUnit.setUseQuotedIdentifiers( true );
@ -270,6 +270,14 @@ public class PersistenceXmlParser {
return result.toString().trim(); return result.toString().trim();
} }
private static boolean extractBooleanContent(Element element, boolean defaultBool) {
String content = extractContent( element );
if (content != null && content.length() > 0) {
return Boolean.valueOf(content);
}
return defaultBool;
}
private static PersistenceUnitTransactionType parseTransactionType(String value) { private static PersistenceUnitTransactionType parseTransactionType(String value) {
if ( StringHelper.isEmpty( value ) ) { if ( StringHelper.isEmpty( value ) ) {
return null; return null;