Refine DefaultPersistenceUnitManager#determineDefaultPersistenceUnitRootUrl

This commit refines the implementation to be more
lenient when defaultPersistenceUnitRootLocation is equals
to ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION and an
IOException is thrown, which happens when running on
native image.

Closes gh-29137
This commit is contained in:
Sébastien Deleuze 2022-09-13 10:07:02 +02:00
parent 6cfbf391ec
commit 6fed342543
1 changed files with 4 additions and 0 deletions

View File

@ -579,6 +579,10 @@ public class DefaultPersistenceUnitManager
return (ResourceUtils.isJarURL(url) ? ResourceUtils.extractJarFileURL(url) : url);
}
catch (IOException ex) {
if (ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION.equals(this.defaultPersistenceUnitRootLocation)) {
logger.debug("Unable to resolve classpath root as persistence unit root URL");
return null;
}
throw new PersistenceException("Unable to resolve persistence unit root URL", ex);
}
}