Fix theme resource loading on Windows, and enable additional test in jdk-integration-tests (#33512)

Closes #33508

Signed-off-by: stianst <stianst@gmail.com>
This commit is contained in:
Stian Thorgersen 2024-10-03 11:37:49 +02:00 committed by GitHub
parent de151e6a03
commit 6092524d79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -15,7 +15,12 @@ public class ResourceLoader {
Path rootPath = Path.of("/", root).normalize().toAbsolutePath(); Path rootPath = Path.of("/", root).normalize().toAbsolutePath();
Path resourcePath = rootPath.resolve(resource).normalize().toAbsolutePath(); Path resourcePath = rootPath.resolve(resource).normalize().toAbsolutePath();
if (resourcePath.startsWith(rootPath)) { if (resourcePath.startsWith(rootPath)) {
URL url = classLoader().getResource(resourcePath.toString().substring(1)); if (File.separatorChar == '/') {
resource = resourcePath.toString().substring(1);
} else {
resource = resourcePath.toString().substring(2).replace('\\', '/');
}
URL url = classLoader().getResource(resource);
return url != null ? url.openStream() : null; return url != null ? url.openStream() : null;
} else { } else {
return null; return null;

View file

@ -15,3 +15,4 @@ SSOTest
SamlClientTest SamlClientTest
TransactionsTest TransactionsTest
X509BrowserLoginTest X509BrowserLoginTest
ThemeResourceProviderTest