Skip to content

Commit

Permalink
Guard against NoClassDefFoundError when trying to load Unsafe.
Browse files Browse the repository at this point in the history
Motivation:

OSGI and other enviroments may not allow to even load Unsafe which will lead to an NoClassDefFoundError when trying to access it. We should guard against this.

Modifications:

Catch NoClassDefFoundError when trying to load Unsafe.

Result:

Be able to use netty with a strict OSGI config.
  • Loading branch information
normanmaurer committed Nov 24, 2017
1 parent f9cadc0 commit 65cacc9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public Object run() {
return e;
} catch (IllegalAccessException e) {
return e;
} catch (NoClassDefFoundError e) {
// Also catch NoClassDefFoundError in case someone uses for example OSGI and it made
// Unsafe unloadable.
return e;
}
}
});
Expand Down

0 comments on commit 65cacc9

Please sign in to comment.