Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce log-spam and prevent exception on every module availability check #347

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import static java.lang.String.format;

public class ModuleLoader {


private static final boolean BATCH_SUPPORT_CLASS_AVAILABLE = MiscUtil.classAvailable("org.simplejavamail.internal.batchsupport.BatchSupport");
private static final boolean SMIME_SUPPORT_CLASS_AVAILABLE = MiscUtil.classAvailable("org.simplejavamail.internal.smimesupport.SMIMESupport");
private static final Map<Class, Object> LOADED_MODULES = new HashMap<>();

// used from junit tests
Expand Down Expand Up @@ -82,11 +84,11 @@ public static BatchModule loadBatchModule() {
}

public static boolean batchModuleAvailable() {
return !FORCED_DISABLED_MODULES.contains(BatchModule.class) && MiscUtil.classAvailable("org.simplejavamail.internal.batchsupport.BatchSupport");
return !FORCED_DISABLED_MODULES.contains(BatchModule.class) && BATCH_SUPPORT_CLASS_AVAILABLE;
}

public static boolean smimeModuleAvailable() {
return !FORCED_DISABLED_MODULES.contains(SMIMEModule.class) && MiscUtil.classAvailable("org.simplejavamail.internal.smimesupport.SMIMESupport");
return !FORCED_DISABLED_MODULES.contains(SMIMEModule.class) && SMIME_SUPPORT_CLASS_AVAILABLE;
}

@SuppressWarnings("unchecked")
Expand Down