sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1705028 - /sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
Date Thu, 24 Sep 2015 10:47:44 GMT
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"));
     }
 
 }



Mime
View raw message