SSHD-388 - update to ensure we gracefully skip providers that have a missing dependency
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/02dd0f69 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/02dd0f69 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/02dd0f69 Branch: refs/heads/master Commit: 02dd0f693c435028b649b66a840e40f8f8b7894a Parents: ae2b900 Author: Jonathan Anstey <[email protected]> Authored: Wed Dec 24 11:33:50 2014 -0330 Committer: Jonathan Anstey <[email protected]> Committed: Wed Dec 24 11:33:50 2014 -0330 ---------------------------------------------------------------------- .../sshd/common/io/DefaultIoServiceFactoryFactory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/02dd0f69/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java index 7bf42c0..6cc56a6 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java @@ -68,10 +68,14 @@ public class DefaultIoServiceFactoryFactory implements IoServiceFactoryFactory { } private static <T> T tryLoad(ServiceLoader<T> loader) { + Iterator<T> it = loader.iterator(); try { - Iterator<T> it = loader.iterator(); while (it.hasNext()) { - return it.next(); + try { + return it.next(); + } catch (Throwable t) { + LOGGER.trace("Exception while loading factory from ServiceLoader", t); + } } } catch (Throwable t) { LOGGER.trace("Exception while loading factory from ServiceLoader", t);
