Skip to content

Commit

Permalink
HV-1950 Suppress java.lang.NoClassDefFoundError: com/sun/el/Expressio…
Browse files Browse the repository at this point in the history
…nFactoryImpl

It will mislead user that hibernate validator will rely on particular EL implementation.
  • Loading branch information
quaff committed May 26, 2023
1 parent d212156 commit 1fa92d6
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* @author Kevin Pollet <[email protected]> (C) 2011 SERLI
* @author Adam Stawicki
* @author Guillaume Smet
* @author Yanming Zhou
*/
public class ResourceBundleMessageInterpolator extends AbstractMessageInterpolator {

Expand Down Expand Up @@ -200,11 +201,16 @@ private static ExpressionFactory buildExpressionFactory() {

// Finally we try the CL of the EL implementation itself. This is necessary for OSGi now that the
// implementation is separated from the API.
run( SetContextClassLoader.action( ExpressionFactoryImpl.class.getClassLoader() ) );
if ( canLoadExpressionFactory() ) {
ExpressionFactory expressionFactory = ELManager.getExpressionFactory();
LOG.debug( "Loaded expression factory via com.sun.el classloader" );
return expressionFactory;
try {
run( SetContextClassLoader.action( ExpressionFactoryImpl.class.getClassLoader() ) );
if ( canLoadExpressionFactory() ) {
ExpressionFactory expressionFactory = ELManager.getExpressionFactory();
LOG.debug( "Loaded expression factory via com.sun.el classloader" );
return expressionFactory;
}
}
catch (NoClassDefFoundError err) {
// ignore
}
}
catch (Throwable e) {
Expand Down

0 comments on commit 1fa92d6

Please sign in to comment.