]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/RepoElem.java
Prevent initalization of the UI to fail if a remote repo is not accessible.
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / model / RepoElem.java
index 6d07d1c672725063c1a49aae3ea313576b8d3d0a..6fdde8af2dfcf27640e8b0409a41ea6b28f7cbab 100644 (file)
@@ -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);