HHH-15094 Handle http://hibernate.org and https://hibernate.org for DTDs in LocalXmlResourceResolver

This commit is contained in:
Yoann Rodière 2022-03-01 11:09:43 +01:00 committed by Sanne Grinovero
parent 19073672db
commit 4f7d4b7fdb
2 changed files with 24 additions and 0 deletions

View File

@ -79,6 +79,10 @@ public class LocalXmlResourceResolver implements javax.xml.stream.XMLResolver {
return openUrlStream( MAPPING_DTD.localSchemaUrl );
}
if ( ALTERNATE_MAPPING_DTD.matches( publicID, systemID ) ) {
return openUrlStream( ALTERNATE_MAPPING_DTD.localSchemaUrl );
}
if ( LEGACY_MAPPING_DTD.matches( publicID, systemID ) ) {
DEPRECATION_LOGGER.recognizedObsoleteHibernateNamespace( LEGACY_MAPPING_DTD.getIdentifierBase(), MAPPING_DTD.getIdentifierBase() );
return openUrlStream( MAPPING_DTD.localSchemaUrl );
@ -88,6 +92,10 @@ public class LocalXmlResourceResolver implements javax.xml.stream.XMLResolver {
return openUrlStream( CFG_DTD.localSchemaUrl );
}
if ( ALTERNATE_CFG_DTD.matches( publicID, systemID ) ) {
return openUrlStream( ALTERNATE_CFG_DTD.localSchemaUrl );
}
if ( LEGACY_CFG_DTD.matches( publicID, systemID ) ) {
DEPRECATION_LOGGER.recognizedObsoleteHibernateNamespace( LEGACY_CFG_DTD.getIdentifierBase(), CFG_DTD.getIdentifierBase() );
return openUrlStream( CFG_DTD.localSchemaUrl );
@ -137,6 +145,11 @@ public class LocalXmlResourceResolver implements javax.xml.stream.XMLResolver {
"org/hibernate/hibernate-mapping-3.0.dtd"
);
public static final DtdDescriptor ALTERNATE_MAPPING_DTD = new DtdDescriptor(
"hibernate.org/dtd/hibernate-mapping",
"org/hibernate/hibernate-mapping-3.0.dtd"
);
public static final DtdDescriptor LEGACY_MAPPING_DTD = new DtdDescriptor(
"hibernate.sourceforge.net/hibernate-mapping",
"org/hibernate/hibernate-mapping-3.0.dtd"
@ -147,6 +160,11 @@ public class LocalXmlResourceResolver implements javax.xml.stream.XMLResolver {
"org/hibernate/hibernate-configuration-3.0.dtd"
);
public static final DtdDescriptor ALTERNATE_CFG_DTD = new DtdDescriptor(
"hibernate.org/dtd/hibernate-configuration",
"org/hibernate/hibernate-configuration-3.0.dtd"
);
public static final DtdDescriptor LEGACY_CFG_DTD = new DtdDescriptor(
"hibernate.sourceforge.net/hibernate-configuration",
"org/hibernate/hibernate-configuration-3.0.dtd"

View File

@ -64,12 +64,18 @@ public class LocalXmlResourceResolverTest {
"http://www.hibernate.org/dtd/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"https://www.hibernate.org/dtd/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"http://hibernate.org/dtd/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"https://hibernate.org/dtd/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"http://hibernate.sourceforge.net/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"https://hibernate.sourceforge.net/hibernate-mapping,org/hibernate/hibernate-mapping-3.0.dtd",
"http://www.hibernate.org/dtd/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"https://www.hibernate.org/dtd/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"http://hibernate.org/dtd/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"https://hibernate.org/dtd/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"http://hibernate.sourceforge.net/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"https://hibernate.sourceforge.net/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd"
})