Avoid direct URL construction and URL equality checks
Closes gh-29486
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -312,7 +312,7 @@ final class PersistenceUnitReader {
|
||||
// relative to the persistence unit root, according to the JPA spec
|
||||
URL rootUrl = unitInfo.getPersistenceUnitRootUrl();
|
||||
if (rootUrl != null) {
|
||||
unitInfo.addJarFileUrl(new URL(rootUrl, value));
|
||||
unitInfo.addJarFileUrl(ResourceUtils.toRelativeURL(rootUrl, value));
|
||||
}
|
||||
else {
|
||||
logger.warn("Cannot resolve jar-file entry [" + value + "] in persistence unit '" +
|
||||
@@ -363,7 +363,7 @@ final class PersistenceUnitReader {
|
||||
if (persistenceUnitRoot.endsWith("/")) {
|
||||
persistenceUnitRoot = persistenceUnitRoot.substring(0, persistenceUnitRoot.length() - 1);
|
||||
}
|
||||
return new URL(persistenceUnitRoot);
|
||||
return ResourceUtils.toURL(persistenceUnitRoot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user