You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Eric Norman (Jira)" <ji...@apache.org> on 2021/01/19 23:33:00 UTC

[jira] [Comment Edited] (SLING-10073) ErrorHandlingTest.test_errorhandling_POST_operation_SlingPostServlet fails after SLING-10006

    [ https://issues.apache.org/jira/browse/SLING-10073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17268262#comment-17268262 ] 

Eric Norman edited comment on SLING-10073 at 1/19/21, 11:32 PM:
----------------------------------------------------------------

[~rombert] Yes, I had a fix for that test and a few other new tests on my laptop that were waiting for the starter to update to the new release. 

That failure is actually an invalid assumption in the test that relied on a NPE bug in the old impl of SlingPostServlet.   Basically, a post request with an invalid ":operation" and ":sendError=true" should continue to return a 500 error code, but the old impl of SlingPostServlet threw a NPE in the PostResponseWithErrorHandling class while attempting to send the error.  In this case, the operation was not successful, but no exception was thrown so the "this.getError().toString()" statement in that class threw a NPE.  That NPE caused the test response output to be rendered by the "Throwable.jsp" script instead of the "500.jsp" script which have different text.  After the code was changed to no longer throw a NPE then the test had to change to compensate.


was (Author: enorman):
[~rombert] Yes, I had a fix for that test and a few other tests on my laptop that were waiting for the starter to update to the new release. 

That failure is actually an invalid assumption in the test that relied on a NPE bug in the old impl of SlingPostServlet.   Basically, a post request with an invalid ":operation" and ":sendError=true" should continue to return a 500 error code, but the old impl of SlingPostServlet threw a NPE in the PostResponseWithErrorHandling class while attempting to send the error.  In this case, the operation was not successful, but no exception was thrown so the "this.getError().toString()" statement in that class threw a NPE.  That NPE caused the test response output to be rendered by the "Throwable.jsp" script instead of the "500.jsp" script which have different text.  After the code was changed to no longer throw a NPE then the test had to change to compensate.

> ErrorHandlingTest.test_errorhandling_POST_operation_SlingPostServlet fails after SLING-10006
> --------------------------------------------------------------------------------------------
>
>                 Key: SLING-10073
>                 URL: https://issues.apache.org/jira/browse/SLING-10073
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets POST 2.4.2
>            Reporter: Robert Munteanu
>            Assignee: Eric Norman
>            Priority: Critical
>             Fix For: Launchpad Integration Tests 12
>
>
> After SLING-10006 the Sling ITs fail with
> {noformat}[ERROR] Failures: 
> [ERROR]   ErrorHandlingTest.test_errorhandling_POST_operation_SlingPostServlet:177->assertWithRetries:97->RenderingTestBase.assertContains:36 Content does not contain 'Exception thrown - custom error page' (content=<!--
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one
>  * or more contributor license agreements.  See the NOTICE file
>  * distributed with this work for additional information
>  * regarding copyright ownership.  The ASF licenses this file
>  * to you under the Apache License, Version 2.0 (the
>  * "License"); you may not use this file except in compliance
>  * with the License.  You may obtain a copy of the License at
>  *
>  *   http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing,
>  * software distributed under the License is distributed on an
>  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  * KIND, either express or implied.  See the License for the
>  * specific language governing permissions and limitations
>  * under the License.
> -->
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <!-- simple JSP rendering test -->
> <html>
> 	<head>
> 		<title>500 Internal Server Error</title>
> 	</head>
> 	<body>
> 		<h1>Internal Server Error (500) - custom error page</h1>
> 	</body>
> </html>){noformat}
> Looks like the error handling behaviour has changed in an incompatible manner.
> To reproduce, update to the latest servlets.post in the Sling Starter:
> {code}
> diff --git a/src/main/features/base.json b/src/main/features/base.json
> index 754bf13..f2eb6cf 100644
> --- a/src/main/features/base.json
> +++ b/src/main/features/base.json
> @@ -110,7 +110,7 @@
>              "start-order":"20"
>          },
>          {
> -            "id":"org.apache.sling:org.apache.sling.servlets.post:2.3.36",
> +            "id":"org.apache.sling:org.apache.sling.servlets.post:2.4.2",
>              "start-order":"20"
>          },
>          {
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)