HHH-15322 Allow JNDI lookups using the osgi scheme

This commit is contained in:
Sanne Grinovero 2022-07-06 12:32:35 +01:00 committed by Sanne Grinovero
parent 1b60e350c4
commit 20b9d99a18
1 changed files with 11 additions and 1 deletions

View File

@ -116,7 +116,7 @@ final class JndiServiceImpl implements JndiService {
try {
final URI uri = new URI( jndiName );
final String scheme = uri.getScheme();
if ( scheme != null && (! "java".equals( scheme ) ) ) {
if ( scheme != null && (! allowedScheme( scheme ) ) ) {
throw new JndiException( "JNDI lookups for scheme '" + scheme + "' are not allowed" );
}
}
@ -134,6 +134,16 @@ final class JndiServiceImpl implements JndiService {
}
}
private static boolean allowedScheme(final String scheme) {
switch ( scheme ) {
case "java" :
case "osgi" :
return true;
default:
return false;
}
}
private void cleanUp(InitialContext initialContext) {
try {
initialContext.close();