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 7d4a00be91
commit 502ee95171
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -77,7 +77,10 @@ public class LocalXmlResourceResolverTest {
"https://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", "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 { void resolve_dtd_localResource(String id, String expectedLocalResource) throws XMLStreamException {
// publicId // publicId