Skip to content

Commit 34965da

Browse files
beamerblvdbrmeyer
authored andcommitted
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.
1 parent 3869845 commit 34965da

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hibernate-entitymanager/src/main/java/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ else if ( tag.equals( "jar-file" ) ) {
217217
persistenceUnit.addJarFileUrl( ArchiveHelper.getURLFromPath( extractContent( element ) ) );
218218
}
219219
else if ( tag.equals( "exclude-unlisted-classes" ) ) {
220-
persistenceUnit.setExcludeUnlistedClasses( true );
220+
persistenceUnit.setExcludeUnlistedClasses( extractBooleanContent(element, true) );
221221
}
222222
else if ( tag.equals( "delimited-identifiers" ) ) {
223223
persistenceUnit.setUseQuotedIdentifiers( true );
@@ -270,6 +270,14 @@ private static String extractContent(Element element, String defaultStr) {
270270
return result.toString().trim();
271271
}
272272

273+
private static boolean extractBooleanContent(Element element, boolean defaultBool) {
274+
String content = extractContent( element );
275+
if (content != null && content.length() > 0) {
276+
return Boolean.valueOf(content);
277+
}
278+
return defaultBool;
279+
}
280+
273281
private static PersistenceUnitTransactionType parseTransactionType(String value) {
274282
if ( StringHelper.isEmpty( value ) ) {
275283
return null;

0 commit comments

Comments
 (0)