From: Mathieu Baudier Date: Tue, 17 Sep 2013 09:41:13 +0000 (+0000) Subject: Prevent initalization of the UI to fail if a remote repo is not accessible. X-Git-Tag: argeo-slc-2.1.7~312 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=4f3bb80a2e00103d45dd5a7959dec55ad79cf15c;p=gpl%2Fargeo-slc.git Prevent initalization of the UI to fail if a remote repo is not accessible. git-svn-id: https://svn.argeo.org/slc/trunk@6488 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/RepoElem.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/RepoElem.java index 6d07d1c67..6fdde8af2 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/RepoElem.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/RepoElem.java @@ -13,6 +13,8 @@ import javax.jcr.RepositoryFactory; import javax.jcr.Session; import javax.jcr.nodetype.NodeType; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.jcr.ArgeoJcrUtils; import org.argeo.jcr.ArgeoNames; import org.argeo.jcr.JcrUtils; @@ -26,7 +28,8 @@ import org.argeo.util.security.Keyring; * Node or just an URI and a label if user is anonymous */ public class RepoElem extends DistParentElem { - // private final static Log log = LogFactory.getLog(RepoElem.class); + private final static Log log = LogFactory.getLog(RepoElem.class); + private Repository repository; private Credentials credentials; private RepositoryFactory repositoryFactory; @@ -101,7 +104,13 @@ public class RepoElem extends DistParentElem { } public Object[] getChildren() { - connect(); + try { + connect(); + } catch (Exception e) { + log.error("Cannot connect to " + uri + " return no children.", e); + return new Object[0]; + } + Session session = null; try { session = repository.login(credentials);