Close forgotten session
authorbsinou <bsinou@argeo.org>
Sat, 21 Jan 2017 17:55:08 +0000 (18:55 +0100)
committerbsinou <bsinou@argeo.org>
Sat, 21 Jan 2017 17:55:08 +0000 (18:55 +0100)
org.argeo.cms.ui/src/org/argeo/cms/ui/fs/CmsFsBrowser.java

index 8562138a96a6341785f4e70a7a1c7b0073f9a699..8aab1ec21277a4afee48c2c8d78d9599e6076dc9 100644 (file)
@@ -28,6 +28,7 @@ import org.argeo.eclipse.ui.fs.FsTableViewer;
 import org.argeo.eclipse.ui.fs.FsUiConstants;
 import org.argeo.eclipse.ui.fs.FsUiUtils;
 import org.argeo.eclipse.ui.fs.NioFileLabelProvider;
+import org.argeo.jcr.JcrUtils;
 import org.argeo.node.NodeUtils;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -93,13 +94,16 @@ public class CmsFsBrowser extends Composite {
        private final static String NODE_PREFIX = "node://";
 
        private String getCurrentHomePath() {
+               Session session = null;
                try {
                        Repository repo = currentBaseContext.getSession().getRepository();
-                       Session session = CurrentUser.tryAs(() -> repo.login());
+                       session = CurrentUser.tryAs(() -> repo.login());
                        String homepath = NodeUtils.getUserHome(session).getPath();
                        return homepath;
                } catch (Exception e) {
                        throw new CmsException("Cannot retrieve Current User Home Path", e);
+               } finally {
+                       JcrUtils.logoutQuietly(session);
                }
        }