From 5786ae9484d448eec9c104657615428c2ade9183 Mon Sep 17 00:00:00 2001 From: Vyacheslav Rusakov Date: Sun, 19 Dec 2021 20:10:30 +0700 Subject: [PATCH] fix inner guice class usage in always executable code (OSGi issue) (fixes #187) --- CHANGELOG.md | 2 ++ .../guice/module/context/stat/GuiceStatsTracker.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9129fe112..e50fd75f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Fix inner guice class usage in always executable code (#187, OSGi issue) + ### 5.4.0 (2021-10-21) * Use direct dependency versions in pom to simplify resolution (dependencyManagement section remains but for usage as BOM only) * Fix lambda modules support (modules declared with lambda expression) (#160) diff --git a/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/GuiceStatsTracker.java b/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/GuiceStatsTracker.java index f9c356354..26c4e3523 100644 --- a/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/GuiceStatsTracker.java +++ b/src/main/java/ru/vyarus/dropwizard/guice/module/context/stat/GuiceStatsTracker.java @@ -55,7 +55,9 @@ public List getMessages() { } private Logger getLogger() { - return Logger.getLogger(com.google.inject.internal.util.ContinuousStopwatch.class.getName()); + // string used instead of safer class reference due to OSGI issue (#187) + // (internal package reference not possible - cause class not found) + return Logger.getLogger("com.google.inject.internal.util.ContinuousStopwatch"); } /**