You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/09/24 12:47:44 UTC

svn commit: r1705028 - /sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java

Author: rombert
Date: Thu Sep 24 10:47:44 2015
New Revision: 1705028

URL: http://svn.apache.org/viewvc?rev=1705028&view=rev
Log:
slingshot: fix usage of already closed ResourceResolver

Modified:
    sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java

Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java?rev=1705028&r1=1705027&r2=1705028&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java Thu Sep 24 10:47:44 2015
@@ -82,6 +82,12 @@ public class CommentPostServlet extends
             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 @@ public class CommentPostServlet extends
                 resolver.close();
             }
         }
-
-        // send redirect at the end
-        final String path = request.getResource().getPath();
-
-        response.sendRedirect(resolver.map(request.getContextPath() + path + ".html"));
     }
 
 }