Skip to content
Permalink
Browse files
remove IllegalStateException catch block
That will ALWAYS get wrapped in a InvocationTargetException anyway, as we
are calling it via reflection.
  • Loading branch information
struberg committed Apr 30, 2021
1 parent 62f9bd6 commit 35a0264fa8e952ba25ff2c5b72ba76d8591fd700
Showing 1 changed file with 2 additions and 5 deletions.
@@ -111,13 +111,10 @@ public BeanManager getBeanManager() {
try {
return (BeanManager) CDI_GET_BEAN_MANAGER_METHOD.invoke(CDI_CURRENT_METHOD.invoke(null));
} catch (Exception e) {
if (e instanceof IllegalStateException) {
if (e instanceof InvocationTargetException && e.getCause() instanceof IllegalStateException) {
// all fine, that just means that no CDI container is available right now.
// Maybe we only have the spec jar in the classpath, but no container is started?
return null;
}
if (e instanceof InvocationTargetException && e.getCause() instanceof IllegalStateException) {
// same as above
// we always get it wrapped in a InvocationTargetException as we use reflection.
return null;
}

0 comments on commit 35a0264

Please sign in to comment.