incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1338487 - in /sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal: NamespaceConfigurationPrinter.java NodeTypeConfigurationPrinter.java
Date Tue, 15 May 2012 00:14:56 GMT
Author: justin
Date: Tue May 15 00:14:55 2012
New Revision: 1338487

URL: http://svn.apache.org/viewvc?rev=1338487&view=rev
Log:
SLING-2478 - logging out of sessions created by configuration printers

Modified:
    sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
    sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NodeTypeConfigurationPrinter.java

Modified: sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java?rev=1338487&r1=1338486&r2=1338487&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
(original)
+++ sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NamespaceConfigurationPrinter.java
Tue May 15 00:14:55 2012
@@ -67,8 +67,9 @@ public class NamespaceConfigurationPrint
      */
     public void printConfiguration(PrintWriter pw) {
         if (slingRepository != null) {
+            Session session = null;
             try {
-                Session session = slingRepository.loginAdministrative(null);
+                session = slingRepository.loginAdministrative(null);
                 NamespaceRegistry reg = session.getWorkspace().getNamespaceRegistry();
                 List<String> globalPrefixes = Arrays.asList(reg.getPrefixes());
                 for (String prefix : session.getNamespacePrefixes()) {
@@ -85,6 +86,10 @@ public class NamespaceConfigurationPrint
             } catch (RepositoryException e) {
                 pw.println("Unable to output namespace mappings.");
                 e.printStackTrace(pw);
+            } finally {
+                if (session != null) {
+                    session.logout();
+                }
             }
         } else {
             pw.println("SlingRepository is not available.");

Modified: sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NodeTypeConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NodeTypeConfigurationPrinter.java?rev=1338487&r1=1338486&r2=1338487&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NodeTypeConfigurationPrinter.java
(original)
+++ sling/trunk/bundles/jcr/webconsole/src/main/java/org/apache/sling/jcr/webconsole/internal/NodeTypeConfigurationPrinter.java
Tue May 15 00:14:55 2012
@@ -68,8 +68,9 @@ public class NodeTypeConfigurationPrinte
      */
     public void printConfiguration(PrintWriter pw, String mode) {
         if (slingRepository != null) {
+            Session session = null;
             try {
-                Session session = slingRepository.loginAdministrative(null);
+                session = slingRepository.loginAdministrative(null);
                 NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
                 NodeTypeIterator it = ntm.getAllNodeTypes();
                 while (it.hasNext()) {
@@ -158,9 +159,13 @@ public class NodeTypeConfigurationPrinte
             } catch (RepositoryException e) {
                 pw.println("Unable to output namespace mappings.");
                 e.printStackTrace(pw);
+            } finally {
+                if (session != null) {
+                    session.logout();
+                }
             }
         } else {
-            pw.println("SlingRepsoitory is not available.");
+            pw.println("SlingRepository is not available.");
         }
     }
 



Mime
View raw message