HHH-16892 Fix LocalXmlResourceResolver not resolving some dtd URLs that use the https scheme

This commit is contained in:
Yoann Rodière 2023-07-05 09:10:40 +02:00
parent 5201a45055
commit f55fa0cce4
2 changed files with 6 additions and 3 deletions

View File

@ -259,14 +259,14 @@ public class LocalXmlResourceResolver implements javax.xml.stream.XMLResolver {
public boolean matches(String publicId, String systemId) {
if ( publicId != null ) {
if ( publicId.startsWith( httpBase )
|| publicId.matches( httpsBase ) ) {
|| publicId.startsWith( httpsBase ) ) {
return true;
}
}
if ( systemId != null ) {
if ( systemId.startsWith( httpBase )
|| systemId.matches( httpsBase ) ) {
|| systemId.startsWith( httpsBase ) ) {
return true;
}
}

View File

@ -72,7 +72,10 @@ public class LocalXmlResourceResolverTest {
"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"
"https://hibernate.sourceforge.net/hibernate-configuration,org/hibernate/hibernate-configuration-3.0.dtd",
"http://hibernate.org/dtd/hibernate-mapping-3.0.dtd,org/hibernate/hibernate-mapping-3.0.dtd",
"https://hibernate.org/dtd/hibernate-mapping-3.0.dtd,org/hibernate/hibernate-mapping-3.0.dtd"
})
void resolve_dtd_localResource(String id, String expectedLocalResource) throws XMLStreamException {
// publicId