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 6b4ac625e1
commit c53050c7c3
1 changed files with 11 additions and 1 deletions

View File

@ -119,7 +119,7 @@ public 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" );
}
}
@ -137,6 +137,16 @@ public 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();