slingshot: fix usage of already closed ResourceResolver

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1705028 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java b/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
index 6cd65bc..9ff026a 100644
--- a/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
+++ b/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
@@ -82,6 +82,12 @@
             c.setCreatedBy(userId);
 
             this.commentsService.addComment(reqResource, c);
+            
+
+            // send redirect at the end
+            final String path = request.getResource().getPath();
+
+            response.sendRedirect(resolver.map(request.getContextPath() + path + ".html"));            
         } catch ( final LoginException le ) {
             throw new ServletException("Unable to login", le);
         } finally {
@@ -89,11 +95,6 @@
                 resolver.close();
             }
         }
-
-        // send redirect at the end
-        final String path = request.getResource().getPath();
-
-        response.sendRedirect(resolver.map(request.getContextPath() + path + ".html"));
     }
 
 }